aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>2007-03-09 18:05:38 -0500
committerArnd Bergmann <arnd@klappe.arndb.de>2007-03-09 18:07:51 -0500
commitef596c697a4d80048eccf50530153d7e3330c127 (patch)
treeafd1d1cf9c4fc2c53d557a669d0fdba085dc3e35
parent94b2a4393c500a620de90c3266d595926302e26b (diff)
[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>
-rw-r--r--arch/powerpc/platforms/ps3/mm.c2
-rw-r--r--arch/powerpc/platforms/ps3/system-bus.c2
-rw-r--r--drivers/ps3/ps3av.c9
-rw-r--r--drivers/ps3/sys-manager.c6
-rw-r--r--drivers/ps3/vuart.c2
5 files changed, 17 insertions, 4 deletions
diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c
index 42354de3f557..2014d2b44449 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)
294 unsigned long nr_pages; 294 unsigned long nr_pages;
295 295
296 if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) 296 if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
297 return 0; 297 return -ENODEV;
298 298
299 BUG_ON(!mem_init_done); 299 BUG_ON(!mem_init_done);
300 300
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c
index a9f7e4a39a2a..3c48cce98a5c 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)
172 int result; 172 int result;
173 173
174 if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) 174 if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
175 return 0; 175 return -ENODEV;
176 176
177 result = bus_register(&ps3_system_bus_type); 177 result = bus_register(&ps3_system_bus_type);
178 BUG_ON(result); 178 BUG_ON(result);
diff --git a/drivers/ps3/ps3av.c b/drivers/ps3/ps3av.c
index 1926b4d3e1f4..d21e04ccb021 100644
--- a/drivers/ps3/ps3av.c
+++ b/drivers/ps3/ps3av.c
@@ -24,6 +24,8 @@
24#include <linux/reboot.h> 24#include <linux/reboot.h>
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/ioctl.h> 26#include <linux/ioctl.h>
27
28#include <asm/firmware.h>
27#include <asm/lv1call.h> 29#include <asm/lv1call.h>
28#include <asm/ps3av.h> 30#include <asm/ps3av.h>
29#include <asm/ps3.h> 31#include <asm/ps3.h>
@@ -947,7 +949,12 @@ static struct ps3_vuart_port_driver ps3av_driver = {
947 949
948static int ps3av_module_init(void) 950static int ps3av_module_init(void)
949{ 951{
950 int error = ps3_vuart_port_driver_register(&ps3av_driver); 952 int error;
953
954 if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
955 return -ENODEV;
956
957 error = ps3_vuart_port_driver_register(&ps3av_driver);
951 if (error) { 958 if (error) {
952 printk(KERN_ERR 959 printk(KERN_ERR
953 "%s: ps3_vuart_port_driver_register failed %d\n", 960 "%s: ps3_vuart_port_driver_register failed %d\n",
diff --git a/drivers/ps3/sys-manager.c b/drivers/ps3/sys-manager.c
index 0fc30be8b81e..3aa2b0dcc369 100644
--- a/drivers/ps3/sys-manager.c
+++ b/drivers/ps3/sys-manager.c
@@ -22,7 +22,10 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/workqueue.h> 23#include <linux/workqueue.h>
24#include <linux/reboot.h> 24#include <linux/reboot.h>
25
26#include <asm/firmware.h>
25#include <asm/ps3.h> 27#include <asm/ps3.h>
28
26#include "vuart.h" 29#include "vuart.h"
27 30
28MODULE_AUTHOR("Sony Corporation"); 31MODULE_AUTHOR("Sony Corporation");
@@ -598,6 +601,9 @@ static struct ps3_vuart_port_driver ps3_sys_manager = {
598 601
599static int __init ps3_sys_manager_init(void) 602static int __init ps3_sys_manager_init(void)
600{ 603{
604 if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
605 return -ENODEV;
606
601 return ps3_vuart_port_driver_register(&ps3_sys_manager); 607 return ps3_vuart_port_driver_register(&ps3_sys_manager);
602} 608}
603 609
diff --git a/drivers/ps3/vuart.c b/drivers/ps3/vuart.c
index 746298107d6f..1adf186bfaf5 100644
--- a/drivers/ps3/vuart.c
+++ b/drivers/ps3/vuart.c
@@ -1031,7 +1031,7 @@ int __init ps3_vuart_bus_init(void)
1031 pr_debug("%s:%d:\n", __func__, __LINE__); 1031 pr_debug("%s:%d:\n", __func__, __LINE__);
1032 1032
1033 if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) 1033 if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
1034 return 0; 1034 return -ENODEV;
1035 1035
1036 init_MUTEX(&vuart_bus_priv.probe_mutex); 1036 init_MUTEX(&vuart_bus_priv.probe_mutex);
1037 result = bus_register(&ps3_vuart_bus); 1037 result = bus_register(&ps3_vuart_bus);