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