Skip to content

Commit

Permalink
[POWERPC] ps3: always make sure were running on a PS3
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Geert Uytterhoeven authored and Arnd Bergmann committed Mar 9, 2007
1 parent 94b2a43 commit ef596c6
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/ps3/mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/ps3/system-bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 8 additions & 1 deletion drivers/ps3/ps3av.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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",
Expand Down
6 changes: 6 additions & 0 deletions drivers/ps3/sys-manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
#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");
Expand Down Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/ps3/vuart.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ef596c6

Please sign in to comment.