[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 <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>

authored by Geert Uytterhoeven and committed by Arnd Bergmann ef596c69 94b2a439

+17 -4
+1 -1
arch/powerpc/platforms/ps3/mm.c
··· 294 unsigned long nr_pages; 295 296 if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) 297 - return 0; 298 299 BUG_ON(!mem_init_done); 300
··· 294 unsigned long nr_pages; 295 296 if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) 297 + return -ENODEV; 298 299 BUG_ON(!mem_init_done); 300
+1 -1
arch/powerpc/platforms/ps3/system-bus.c
··· 172 int result; 173 174 if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) 175 - return 0; 176 177 result = bus_register(&ps3_system_bus_type); 178 BUG_ON(result);
··· 172 int result; 173 174 if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) 175 + return -ENODEV; 176 177 result = bus_register(&ps3_system_bus_type); 178 BUG_ON(result);
+8 -1
drivers/ps3/ps3av.c
··· 24 #include <linux/reboot.h> 25 #include <linux/kernel.h> 26 #include <linux/ioctl.h> 27 #include <asm/lv1call.h> 28 #include <asm/ps3av.h> 29 #include <asm/ps3.h> ··· 949 950 static int ps3av_module_init(void) 951 { 952 - int error = ps3_vuart_port_driver_register(&ps3av_driver); 953 if (error) { 954 printk(KERN_ERR 955 "%s: ps3_vuart_port_driver_register failed %d\n",
··· 24 #include <linux/reboot.h> 25 #include <linux/kernel.h> 26 #include <linux/ioctl.h> 27 + 28 + #include <asm/firmware.h> 29 #include <asm/lv1call.h> 30 #include <asm/ps3av.h> 31 #include <asm/ps3.h> ··· 947 948 static int ps3av_module_init(void) 949 { 950 + int error; 951 + 952 + if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) 953 + return -ENODEV; 954 + 955 + error = ps3_vuart_port_driver_register(&ps3av_driver); 956 if (error) { 957 printk(KERN_ERR 958 "%s: ps3_vuart_port_driver_register failed %d\n",
+6
drivers/ps3/sys-manager.c
··· 22 #include <linux/module.h> 23 #include <linux/workqueue.h> 24 #include <linux/reboot.h> 25 #include <asm/ps3.h> 26 #include "vuart.h" 27 28 MODULE_AUTHOR("Sony Corporation"); ··· 601 602 static int __init ps3_sys_manager_init(void) 603 { 604 return ps3_vuart_port_driver_register(&ps3_sys_manager); 605 } 606
··· 22 #include <linux/module.h> 23 #include <linux/workqueue.h> 24 #include <linux/reboot.h> 25 + 26 + #include <asm/firmware.h> 27 #include <asm/ps3.h> 28 + 29 #include "vuart.h" 30 31 MODULE_AUTHOR("Sony Corporation"); ··· 598 599 static int __init ps3_sys_manager_init(void) 600 { 601 + if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) 602 + return -ENODEV; 603 + 604 return ps3_vuart_port_driver_register(&ps3_sys_manager); 605 } 606
+1 -1
drivers/ps3/vuart.c
··· 1031 pr_debug("%s:%d:\n", __func__, __LINE__); 1032 1033 if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) 1034 - return 0; 1035 1036 init_MUTEX(&vuart_bus_priv.probe_mutex); 1037 result = bus_register(&ps3_vuart_bus);
··· 1031 pr_debug("%s:%d:\n", __func__, __LINE__); 1032 1033 if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) 1034 + return -ENODEV; 1035 1036 init_MUTEX(&vuart_bus_priv.probe_mutex); 1037 result = bus_register(&ps3_vuart_bus);