powerpc/pseries: Switch pseries drivers to use machine_xxx_initcall()

A lot of the code in platforms/pseries is using non-machine initcalls.
That means if a kernel built with pseries support runs on another
platform, for example powernv, the initcalls will still run.

Most of these cases are OK, though sometimes only due to luck. Some were
having more effect:

 * hcall_inst_init
  - Checking FW_FEATURE_LPAR which is set on ps3 & celleb.
 * mobility_sysfs_init
  - created sysfs files unconditionally
  - but no effect due to ENOSYS from rtas_ibm_suspend_me()
 * apo_pm_init
  - created sysfs, allows write
  - nothing checks the value written to though
 * alloc_dispatch_log_kmem_cache
  - creating kmem_cache on non-pseries machines

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
Michael Ellerman 2014-07-16 12:02:43 +10:00 committed by Benjamin Herrenschmidt
parent b14726c51c
commit 8e83e9053f
11 changed files with 19 additions and 23 deletions

View File

@ -29,6 +29,7 @@
#include <asm/lppaca.h>
#include <asm/debug.h>
#include <asm/plpar_wrappers.h>
#include <asm/machdep.h>
struct dtl {
struct dtl_entry *buf;
@ -391,4 +392,4 @@ err_remove_dir:
err:
return rc;
}
arch_initcall(dtl_init);
machine_arch_initcall(pseries, dtl_init);

View File

@ -743,10 +743,7 @@ static struct eeh_ops pseries_eeh_ops = {
*/
static int __init eeh_pseries_init(void)
{
int ret = -EINVAL;
if (!machine_is(pseries))
return ret;
int ret;
ret = eeh_ops_register(&pseries_eeh_ops);
if (!ret)
@ -757,5 +754,4 @@ static int __init eeh_pseries_init(void)
return ret;
}
early_initcall(eeh_pseries_init);
machine_early_initcall(pseries, eeh_pseries_init);

View File

@ -27,6 +27,7 @@
#include <asm/firmware.h>
#include <asm/cputable.h>
#include <asm/trace.h>
#include <asm/machdep.h>
DEFINE_PER_CPU(struct hcall_stats[HCALL_STAT_ARRAY_SIZE], hcall_stats);
@ -162,4 +163,4 @@ static int __init hcall_inst_init(void)
return 0;
}
__initcall(hcall_inst_init);
machine_device_initcall(pseries, hcall_inst_init);

View File

@ -18,6 +18,7 @@
#include <linux/delay.h>
#include <linux/slab.h>
#include <asm/machdep.h>
#include <asm/rtas.h>
#include "pseries.h"
@ -362,4 +363,4 @@ static int __init mobility_sysfs_init(void)
return rc;
}
device_initcall(mobility_sysfs_init);
machine_device_initcall(pseries, mobility_sysfs_init);

View File

@ -16,6 +16,7 @@
#include <asm/rtas.h>
#include <asm/hw_irq.h>
#include <asm/ppc-pci.h>
#include <asm/machdep.h>
static int query_token, change_token;
@ -532,5 +533,4 @@ static int rtas_msi_init(void)
return 0;
}
arch_initcall(rtas_msi_init);
machine_arch_initcall(pseries, rtas_msi_init);

View File

@ -25,6 +25,7 @@
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <asm/machdep.h>
unsigned long rtas_poweron_auto; /* default and normal state is 0 */
@ -71,11 +72,11 @@ static int __init pm_init(void)
return -ENOMEM;
return sysfs_create_group(power_kobj, &attr_group);
}
core_initcall(pm_init);
machine_core_initcall(pseries, pm_init);
#else
static int __init apo_pm_init(void)
{
return (sysfs_create_file(power_kobj, &auto_poweron_attr.attr));
}
__initcall(apo_pm_init);
machine_device_initcall(pseries, apo_pm_init);
#endif

View File

@ -71,7 +71,7 @@ static int __init init_ras_IRQ(void)
return 0;
}
subsys_initcall(init_ras_IRQ);
machine_subsys_initcall(pseries, init_ras_IRQ);
#define EPOW_SHUTDOWN_NORMAL 1
#define EPOW_SHUTDOWN_ON_UPS 2

View File

@ -446,13 +446,10 @@ static int proc_ppc64_create_ofdt(void)
{
struct proc_dir_entry *ent;
if (!machine_is(pseries))
return 0;
ent = proc_create("powerpc/ofdt", S_IWUSR, NULL, &ofdt_fops);
if (ent)
proc_set_size(ent, 0);
return 0;
}
__initcall(proc_ppc64_create_ofdt);
machine_device_initcall(pseries, proc_ppc64_create_ofdt);

View File

@ -42,4 +42,4 @@ static __init int rng_init(void)
return 0;
}
subsys_initcall(rng_init);
machine_subsys_initcall(pseries, rng_init);

View File

@ -351,7 +351,7 @@ static int alloc_dispatch_log_kmem_cache(void)
return alloc_dispatch_logs();
}
early_initcall(alloc_dispatch_log_kmem_cache);
machine_early_initcall(pseries, alloc_dispatch_log_kmem_cache);
static void pseries_lpar_idle(void)
{

View File

@ -265,7 +265,7 @@ static int __init pseries_suspend_init(void)
{
int rc;
if (!machine_is(pseries) || !firmware_has_feature(FW_FEATURE_LPAR))
if (!firmware_has_feature(FW_FEATURE_LPAR))
return 0;
suspend_data.token = rtas_token("ibm,suspend-me");
@ -280,5 +280,4 @@ static int __init pseries_suspend_init(void)
suspend_set_ops(&pseries_suspend_ops);
return 0;
}
__initcall(pseries_suspend_init);
machine_device_initcall(pseries, pseries_suspend_init);