public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
* [PATCH] ps3: always make sure we're running on a PS3
@ 2007-02-22 15:43 Geert Uytterhoeven
  2007-02-22 17:30 ` Arnd Bergmann
  2007-02-26 14:40 ` Geoff Levand
  0 siblings, 2 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2007-02-22 15:43 UTC (permalink / raw)
  To: Arnd Bergmann, Geoff Levand, Paul Mackerras; +Cc: Linux/PPC Development

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>
---
 arch/powerpc/platforms/ps3/mm.c         |    2 +-
 arch/powerpc/platforms/ps3/system-bus.c |    2 +-
 drivers/ps3/ps3av.c                     |    9 ++++++++-
 drivers/ps3/sys-manager.c               |    6 ++++++
 drivers/ps3/vuart.c                     |    2 +-
 5 files changed, 17 insertions(+), 4 deletions(-)

--- ps3-linux-2.6.21-rc1.orig/arch/powerpc/platforms/ps3/mm.c
+++ ps3-linux-2.6.21-rc1/arch/powerpc/platforms/ps3/mm.c
@@ -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);
 
--- ps3-linux-2.6.21-rc1.orig/arch/powerpc/platforms/ps3/system-bus.c
+++ ps3-linux-2.6.21-rc1/arch/powerpc/platforms/ps3/system-bus.c
@@ -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);
--- ps3-linux-2.6.21-rc1.orig/drivers/ps3/ps3av.c
+++ ps3-linux-2.6.21-rc1/drivers/ps3/ps3av.c
@@ -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>
@@ -947,7 +949,12 @@ static struct ps3_vuart_port_driver ps3a
 
 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",
--- ps3-linux-2.6.21-rc1.orig/drivers/ps3/sys-manager.c
+++ ps3-linux-2.6.21-rc1/drivers/ps3/sys-manager.c
@@ -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");
@@ -598,6 +601,9 @@ static struct ps3_vuart_port_driver ps3_
 
 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);
 }
 
--- ps3-linux-2.6.21-rc1.orig/drivers/ps3/vuart.c
+++ ps3-linux-2.6.21-rc1/drivers/ps3/vuart.c
@@ -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);

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- Sony Network and Software Technology Center Europe (NSCE)
Geert.Uytterhoeven@sonycom•com ------- The Corporate Village, Da Vincilaan 7-D1
Voice +32-2-7008453 Fax +32-2-7008622 ---------------- B-1935 Zaventem, Belgium

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ps3: always make sure we're running on a PS3
  2007-02-22 15:43 [PATCH] ps3: always make sure we're running on a PS3 Geert Uytterhoeven
@ 2007-02-22 17:30 ` Arnd Bergmann
  2007-02-26 14:40 ` Geoff Levand
  1 sibling, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2007-02-22 17:30 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Linux/PPC Development, Paul Mackerras

On Thursday 22 February 2007, Geert Uytterhoeven wrote:
> 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>

Acked-by: Arnd Bergmann <arnd.bergmann@de•ibm.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ps3: always make sure we're running on a PS3
  2007-02-22 15:43 [PATCH] ps3: always make sure we're running on a PS3 Geert Uytterhoeven
  2007-02-22 17:30 ` Arnd Bergmann
@ 2007-02-26 14:40 ` Geoff Levand
  1 sibling, 0 replies; 3+ messages in thread
From: Geoff Levand @ 2007-02-26 14:40 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: Geert Uytterhoeven, Linux/PPC Development, Arnd Bergmann

Geert Uytterhoeven wrote:
> 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>

Paul, please apply.

Acked-by: Geoff Levand <geoffrey.levand@am•sony.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-02-26 14:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-22 15:43 [PATCH] ps3: always make sure we're running on a PS3 Geert Uytterhoeven
2007-02-22 17:30 ` Arnd Bergmann
2007-02-26 14:40 ` Geoff Levand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox