]> err.no Git - linux-2.6/commitdiff
[POWERPC] ps3: always make sure we're running on a PS3
authorGeert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Thu, 22 Feb 2007 15:43:12 +0000 (16:43 +0100)
committerPaul Mackerras <paulus@samba.org>
Fri, 9 Mar 2007 04:03:23 +0000 (15:03 +1100)
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 <Geert.Uytterhoeven@sonycom.com>
Acked-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/platforms/ps3/mm.c
arch/powerpc/platforms/ps3/system-bus.c
drivers/ps3/ps3av.c
drivers/ps3/sys-manager.c
drivers/ps3/vuart.c

index 42354de3f557e41e16202580181ab6dc160c79a8..2014d2b444496f95526b4e659f3715134361ff67 100644 (file)
@@ -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);
 
index a9f7e4a39a2ae26041e3928fbaf7c969ea3c12a8..3c48cce98a5c0bba2ff7a063702ac7d49330d949 100644 (file)
@@ -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);
index 1926b4d3e1f40b85d629a50514d2643728c80828..d21e04ccb02143163de7ed90bf7306fbf6b59f28 100644 (file)
@@ -24,6 +24,8 @@
 #include <linux/reboot.h>
 #include <linux/kernel.h>
 #include <linux/ioctl.h>
+
+#include <asm/firmware.h>
 #include <asm/lv1call.h>
 #include <asm/ps3av.h>
 #include <asm/ps3.h>
@@ -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",
index 0fc30be8b81e0ab120410931bba42e4e7b72a1e0..3aa2b0dcc36956d6afc9622530ea78b00e5b3290 100644 (file)
 #include <linux/module.h>
 #include <linux/workqueue.h>
 #include <linux/reboot.h>
+
+#include <asm/firmware.h>
 #include <asm/ps3.h>
+
 #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);
 }
 
index 746298107d6fa97d5611f05a0e33d58b717281ed..1adf186bfaf55a84295dc40b1a9974bf97567aa4 100644 (file)
@@ -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);