Patchwork [for,2.6.31] powerpc/ps3: Add missing check for PS3 to rtc-ps3 platform device registration

login
register
mail settings
Submitter Geert Uytterhoeven
Date Aug. 24, 2009, 8:54 a.m.
Message ID <alpine.LRH.2.00.0908241053190.31587@vixen.sonytel.be>
Download mbox | patch
Permalink /patch/31895/
State Accepted, archived
Headers show

Comments

Geert Uytterhoeven - Aug. 24, 2009, 8:54 a.m.
On non-PS3, we get:

| kernel BUG at drivers/rtc/rtc-ps3.c:36!

because the rtc-ps3 platform device is registered unconditionally in a kernel
with builtin support for PS3.

Reported-by: Sachin Sant <sachinp@in.ibm.com>
Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
---
 arch/powerpc/platforms/ps3/time.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
Sachin P. Sant - Aug. 24, 2009, 9:07 a.m.
Geert Uytterhoeven wrote:
> On non-PS3, we get:
>
> | kernel BUG at drivers/rtc/rtc-ps3.c:36!
>
> because the rtc-ps3 platform device is registered unconditionally in a kernel
> with builtin support for PS3.
>
> Reported-by: Sachin Sant <sachinp@in.ibm.com>
> Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
> ---
>  arch/powerpc/platforms/ps3/time.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
Thanks, boots fine now.

Tested-by : Sachin Sant <sachinp@in.ibm.com>

Regards
-Sachin
Geert Uytterhoeven - Aug. 24, 2009, 9:29 a.m.
On Mon, 24 Aug 2009, Sachin Sant wrote:
> Geert Uytterhoeven wrote:
> > On non-PS3, we get:
> >
> > | kernel BUG at drivers/rtc/rtc-ps3.c:36!
> >
> > because the rtc-ps3 platform device is registered unconditionally in a
> > kernel
> > with builtin support for PS3.
> >
> > Reported-by: Sachin Sant <sachinp@in.ibm.com>
> > Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
> > ---
> >  arch/powerpc/platforms/ps3/time.c |    4 ++++
> >  1 files changed, 4 insertions(+), 0 deletions(-)
> Thanks, boots fine now.
> 
> Tested-by : Sachin Sant <sachinp@in.ibm.com>

Thanks for testing! We want this for 2.6.30-stable, too.

With kind regards,

Geert Uytterhoeven
Software Architect
Techsoft Centre

Technology and Software Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone:    +32 (0)2 700 8453
Fax:      +32 (0)2 700 8622
E-mail:   Geert.Uytterhoeven@sonycom.com
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 · RPR Brussels
Fortis · BIC GEBABEBB · IBAN BE41293037680010
Geoff Levand - Aug. 24, 2009, 6:41 p.m.
On 08/24/2009 01:54 AM, Geert Uytterhoeven wrote:
> On non-PS3, we get:
> 
> | kernel BUG at drivers/rtc/rtc-ps3.c:36!
> 
> because the rtc-ps3 platform device is registered unconditionally in a kernel
> with builtin support for PS3.
> 
> Reported-by: Sachin Sant <sachinp@in.ibm.com>
> Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
> ---
>  arch/powerpc/platforms/ps3/time.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)

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

Patch

diff --git a/arch/powerpc/platforms/ps3/time.c b/arch/powerpc/platforms/ps3/time.c
index b178a1e..40b5cb4 100644
--- a/arch/powerpc/platforms/ps3/time.c
+++ b/arch/powerpc/platforms/ps3/time.c
@@ -21,6 +21,7 @@ 
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 
+#include <asm/firmware.h>
 #include <asm/rtc.h>
 #include <asm/lv1call.h>
 #include <asm/ps3.h>
@@ -84,6 +85,9 @@  static int __init ps3_rtc_init(void)
 {
 	struct platform_device *pdev;
 
+	if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
+		return -ENODEV;
+
 	pdev = platform_device_register_simple("rtc-ps3", -1, NULL, 0);
 	if (IS_ERR(pdev))
 		return PTR_ERR(pdev);