Commit ef596c69 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Arnd Bergmann

[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: default avatarGeert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: default avatarArnd Bergmann <arnd.bergmann@de.ibm.com>
parent 94b2a439
...@@ -294,7 +294,7 @@ static int __init ps3_mm_add_memory(void) ...@@ -294,7 +294,7 @@ static int __init ps3_mm_add_memory(void)
unsigned long nr_pages; unsigned long nr_pages;
if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
return 0; return -ENODEV;
BUG_ON(!mem_init_done); BUG_ON(!mem_init_done);
......
...@@ -172,7 +172,7 @@ int __init ps3_system_bus_init(void) ...@@ -172,7 +172,7 @@ int __init ps3_system_bus_init(void)
int result; int result;
if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
return 0; return -ENODEV;
result = bus_register(&ps3_system_bus_type); result = bus_register(&ps3_system_bus_type);
BUG_ON(result); BUG_ON(result);
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/ioctl.h> #include <linux/ioctl.h>
#include <asm/firmware.h>
#include <asm/lv1call.h> #include <asm/lv1call.h>
#include <asm/ps3av.h> #include <asm/ps3av.h>
#include <asm/ps3.h> #include <asm/ps3.h>
...@@ -947,7 +949,12 @@ static struct ps3_vuart_port_driver ps3av_driver = { ...@@ -947,7 +949,12 @@ static struct ps3_vuart_port_driver ps3av_driver = {
static int ps3av_module_init(void) 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) { if (error) {
printk(KERN_ERR printk(KERN_ERR
"%s: ps3_vuart_port_driver_register failed %d\n", "%s: ps3_vuart_port_driver_register failed %d\n",
......
...@@ -22,7 +22,10 @@ ...@@ -22,7 +22,10 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <asm/firmware.h>
#include <asm/ps3.h> #include <asm/ps3.h>
#include "vuart.h" #include "vuart.h"
MODULE_AUTHOR("Sony Corporation"); MODULE_AUTHOR("Sony Corporation");
...@@ -598,6 +601,9 @@ static struct ps3_vuart_port_driver ps3_sys_manager = { ...@@ -598,6 +601,9 @@ static struct ps3_vuart_port_driver ps3_sys_manager = {
static int __init ps3_sys_manager_init(void) 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); return ps3_vuart_port_driver_register(&ps3_sys_manager);
} }
......
...@@ -1031,7 +1031,7 @@ int __init ps3_vuart_bus_init(void) ...@@ -1031,7 +1031,7 @@ int __init ps3_vuart_bus_init(void)
pr_debug("%s:%d:\n", __func__, __LINE__); pr_debug("%s:%d:\n", __func__, __LINE__);
if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
return 0; return -ENODEV;
init_MUTEX(&vuart_bus_priv.probe_mutex); init_MUTEX(&vuart_bus_priv.probe_mutex);
result = bus_register(&ps3_vuart_bus); result = bus_register(&ps3_vuart_bus);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment