From: Geert Uytterhoeven Date: Fri, 9 Mar 2007 23:05:38 +0000 (+0100) Subject: [POWERPC] ps3: always make sure were running on a PS3 X-Git-Tag: v2.6.21-rc4~41^2~3^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ef596c697a4d80048eccf50530153d7e3330c127;p=platform%2Fkernel%2Flinux-exynos.git [POWERPC] ps3: always make sure were running on a PS3 Add missing checks to PS3 specific drivers ps3av and sys-manager to verify that we are actually running on a PS3 (pointed out by Arnd). Correct existing checks in other subsystems/drivers to return -ENODEV instead of zero. Signed-off-by: Geert Uytterhoeven Signed-off-by: Arnd Bergmann --- diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c index 42354de..2014d2b 100644 --- a/arch/powerpc/platforms/ps3/mm.c +++ b/arch/powerpc/platforms/ps3/mm.c @@ -294,7 +294,7 @@ static int __init ps3_mm_add_memory(void) unsigned long nr_pages; if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) - return 0; + return -ENODEV; BUG_ON(!mem_init_done); diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c index a9f7e4a..3c48cce 100644 --- a/arch/powerpc/platforms/ps3/system-bus.c +++ b/arch/powerpc/platforms/ps3/system-bus.c @@ -172,7 +172,7 @@ int __init ps3_system_bus_init(void) int result; if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) - return 0; + return -ENODEV; result = bus_register(&ps3_system_bus_type); BUG_ON(result); diff --git a/drivers/ps3/ps3av.c b/drivers/ps3/ps3av.c index 1926b4d..d21e04c 100644 --- a/drivers/ps3/ps3av.c +++ b/drivers/ps3/ps3av.c @@ -24,6 +24,8 @@ #include #include #include + +#include #include #include #include @@ -947,7 +949,12 @@ static struct ps3_vuart_port_driver ps3av_driver = { static int ps3av_module_init(void) { - int error = ps3_vuart_port_driver_register(&ps3av_driver); + int error; + + if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) + return -ENODEV; + + error = ps3_vuart_port_driver_register(&ps3av_driver); if (error) { printk(KERN_ERR "%s: ps3_vuart_port_driver_register failed %d\n", diff --git a/drivers/ps3/sys-manager.c b/drivers/ps3/sys-manager.c index 0fc30be..3aa2b0d 100644 --- a/drivers/ps3/sys-manager.c +++ b/drivers/ps3/sys-manager.c @@ -22,7 +22,10 @@ #include #include #include + +#include #include + #include "vuart.h" MODULE_AUTHOR("Sony Corporation"); @@ -598,6 +601,9 @@ static struct ps3_vuart_port_driver ps3_sys_manager = { static int __init ps3_sys_manager_init(void) { + if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) + return -ENODEV; + return ps3_vuart_port_driver_register(&ps3_sys_manager); } diff --git a/drivers/ps3/vuart.c b/drivers/ps3/vuart.c index 7462981..1adf186 100644 --- a/drivers/ps3/vuart.c +++ b/drivers/ps3/vuart.c @@ -1031,7 +1031,7 @@ int __init ps3_vuart_bus_init(void) pr_debug("%s:%d:\n", __func__, __LINE__); if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) - return 0; + return -ENODEV; init_MUTEX(&vuart_bus_priv.probe_mutex); result = bus_register(&ps3_vuart_bus);