All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ps3: don't call ps3_system_bus_driver_register on other platforms
@ 2007-02-14  7:04 Ishizaki Kou
  2007-02-14 19:27 ` Geoff Levand
  2007-02-14 21:22 ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 4+ messages in thread
From: Ishizaki Kou @ 2007-02-14  7:04 UTC (permalink / raw)
  To: dbrownell, greg, geoffrey.levand; +Cc: linuxppc-dev, linux-usb-devel

ps3_system_bus_driver_register is PS3 platform specific function.
On other platforms, it triggers WARN_ON in kref_get.

Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp>
---

Index: linux-powerpc-git/drivers/usb/host/ehci-hcd.c
diff -u linux-powerpc-git/drivers/usb/host/ehci-hcd.c:1.1.1.2 linux-powerpc-git/drivers/usb/host/ehci-hcd.c:1.4
--- linux-powerpc-git/drivers/usb/host/ehci-hcd.c:1.1.1.2	Fri Feb  9 13:44:37 2007
+++ linux-powerpc-git/drivers/usb/host/ehci-hcd.c	Wed Feb 14 12:30:56 2007
@@ -42,6 +42,9 @@
 #include <asm/irq.h>
 #include <asm/system.h>
 #include <asm/unaligned.h>
+#ifdef CONFIG_PPC_PS3
+#include <asm/firmware.h>
+#endif
 
 
 /*-------------------------------------------------------------------------*/
@@ -951,15 +954,18 @@
 #endif
 
 #ifdef PS3_SYSTEM_BUS_DRIVER
-	retval = ps3_system_bus_driver_register(&PS3_SYSTEM_BUS_DRIVER);
-	if (retval < 0) {
+	if (firmware_has_feature(FW_FEATURE_PS3_LV1)) {
+		retval = ps3_system_bus_driver_register(
+				&PS3_SYSTEM_BUS_DRIVER);
+		if (retval < 0) {
 #ifdef PLATFORM_DRIVER
-		platform_driver_unregister(&PLATFORM_DRIVER);
+			platform_driver_unregister(&PLATFORM_DRIVER);
 #endif
 #ifdef PCI_DRIVER
-		pci_unregister_driver(&PCI_DRIVER);
+			pci_unregister_driver(&PCI_DRIVER);
 #endif
-		return retval;
+			return retval;
+		}
 	}
 #endif
 
@@ -976,7 +982,8 @@
 	pci_unregister_driver(&PCI_DRIVER);
 #endif
 #ifdef PS3_SYSTEM_BUS_DRIVER
-	ps3_system_bus_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
+	if (firmware_has_feature(FW_FEATURE_PS3_LV1))
+		ps3_system_bus_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
 #endif
 }
 module_exit(ehci_hcd_cleanup);
Index: linux-powerpc-git/drivers/usb/host/ohci-hcd.c
diff -u linux-powerpc-git/drivers/usb/host/ohci-hcd.c:1.1.1.4 linux-powerpc-git/drivers/usb/host/ohci-hcd.c:1.2
--- linux-powerpc-git/drivers/usb/host/ohci-hcd.c:1.1.1.4	Fri Feb  9 13:44:37 2007
+++ linux-powerpc-git/drivers/usb/host/ohci-hcd.c	Wed Feb 14 12:30:56 2007
@@ -42,6 +42,9 @@
 #include <asm/system.h>
 #include <asm/unaligned.h>
 #include <asm/byteorder.h>
+#ifdef CONFIG_PPC_PS3
+#include <asm/firmware.h>
+#endif
 
 #include "../core/hcd.h"
 
@@ -944,9 +947,12 @@
 		sizeof (struct ed), sizeof (struct td));
 
 #ifdef PS3_SYSTEM_BUS_DRIVER
-	retval = ps3_system_bus_driver_register(&PS3_SYSTEM_BUS_DRIVER);
-	if (retval < 0)
-		goto error_ps3;
+	if (firmware_has_feature(FW_FEATURE_PS3_LV1)) {
+		retval = ps3_system_bus_driver_register(
+				&PS3_SYSTEM_BUS_DRIVER);
+		if (retval < 0)
+			goto error_ps3;
+	}
 #endif
 
 #ifdef PLATFORM_DRIVER
@@ -992,7 +998,8 @@
  error_platform:
 #endif
 #ifdef PS3_SYSTEM_BUS_DRIVER
-	ps3_system_bus_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
+	if (firmware_has_feature(FW_FEATURE_PS3_LV1))
+		ps3_system_bus_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
  error_ps3:
 #endif
 	return retval;
@@ -1014,7 +1021,8 @@
 	platform_driver_unregister(&PLATFORM_DRIVER);
 #endif
 #ifdef PS3_SYSTEM_BUS_DRIVER
-	ps3_system_bus_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
+	if (firmware_has_feature(FW_FEATURE_PS3_LV1))
+		ps3_system_bus_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
 #endif
 }
 module_exit(ohci_hcd_mod_exit);

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

* Re: [PATCH] ps3: don't call ps3_system_bus_driver_register on other platforms
  2007-02-14  7:04 [PATCH] ps3: don't call ps3_system_bus_driver_register on other platforms Ishizaki Kou
@ 2007-02-14 19:27 ` Geoff Levand
  2007-02-17  1:33   ` David Brownell
  2007-02-14 21:22 ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 4+ messages in thread
From: Geoff Levand @ 2007-02-14 19:27 UTC (permalink / raw)
  To: Ishizaki Kou; +Cc: greg, dbrownell, linux-usb-devel, linuxppc-dev

Ishizaki Kou wrote:
> ps3_system_bus_driver_register is PS3 platform specific function.
> On other platforms, it triggers WARN_ON in kref_get.

> +++ linux-powerpc-git/drivers/usb/host/ehci-hcd.c
> +++ linux-powerpc-git/drivers/usb/host/ohci-hcd.c

I would think we only need to modify ps3_system_bus_driver_register()
and ps3_system_bus_driver_unregister() to do the proper thing, not the
usb host drivers that make those calls.  I'll look into that solution.

-Geoff

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

* Re: [PATCH] ps3: don't call ps3_system_bus_driver_register on other platforms
  2007-02-14  7:04 [PATCH] ps3: don't call ps3_system_bus_driver_register on other platforms Ishizaki Kou
  2007-02-14 19:27 ` Geoff Levand
@ 2007-02-14 21:22 ` Benjamin Herrenschmidt
  1 sibling, 0 replies; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2007-02-14 21:22 UTC (permalink / raw)
  To: Ishizaki Kou; +Cc: greg, dbrownell, linux-usb-devel, linuxppc-dev

On Wed, 2007-02-14 at 16:04 +0900, Ishizaki Kou wrote:
> ps3_system_bus_driver_register is PS3 platform specific function.
> On other platforms, it triggers WARN_ON in kref_get.
> 
> Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp>

A bit nasty but that's the price of wanting to have all the bus glues in
one file (I didn't agree but that's what David prefers...)

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> ---
> 
> Index: linux-powerpc-git/drivers/usb/host/ehci-hcd.c
> diff -u linux-powerpc-git/drivers/usb/host/ehci-hcd.c:1.1.1.2 linux-powerpc-git/drivers/usb/host/ehci-hcd.c:1.4
> --- linux-powerpc-git/drivers/usb/host/ehci-hcd.c:1.1.1.2	Fri Feb  9 13:44:37 2007
> +++ linux-powerpc-git/drivers/usb/host/ehci-hcd.c	Wed Feb 14 12:30:56 2007
> @@ -42,6 +42,9 @@
>  #include <asm/irq.h>
>  #include <asm/system.h>
>  #include <asm/unaligned.h>
> +#ifdef CONFIG_PPC_PS3
> +#include <asm/firmware.h>
> +#endif
>  
> 
>  /*-------------------------------------------------------------------------*/
> @@ -951,15 +954,18 @@
>  #endif
>  
>  #ifdef PS3_SYSTEM_BUS_DRIVER
> -	retval = ps3_system_bus_driver_register(&PS3_SYSTEM_BUS_DRIVER);
> -	if (retval < 0) {
> +	if (firmware_has_feature(FW_FEATURE_PS3_LV1)) {
> +		retval = ps3_system_bus_driver_register(
> +				&PS3_SYSTEM_BUS_DRIVER);
> +		if (retval < 0) {
>  #ifdef PLATFORM_DRIVER
> -		platform_driver_unregister(&PLATFORM_DRIVER);
> +			platform_driver_unregister(&PLATFORM_DRIVER);
>  #endif
>  #ifdef PCI_DRIVER
> -		pci_unregister_driver(&PCI_DRIVER);
> +			pci_unregister_driver(&PCI_DRIVER);
>  #endif
> -		return retval;
> +			return retval;
> +		}
>  	}
>  #endif
>  
> @@ -976,7 +982,8 @@
>  	pci_unregister_driver(&PCI_DRIVER);
>  #endif
>  #ifdef PS3_SYSTEM_BUS_DRIVER
> -	ps3_system_bus_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
> +	if (firmware_has_feature(FW_FEATURE_PS3_LV1))
> +		ps3_system_bus_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
>  #endif
>  }
>  module_exit(ehci_hcd_cleanup);
> Index: linux-powerpc-git/drivers/usb/host/ohci-hcd.c
> diff -u linux-powerpc-git/drivers/usb/host/ohci-hcd.c:1.1.1.4 linux-powerpc-git/drivers/usb/host/ohci-hcd.c:1.2
> --- linux-powerpc-git/drivers/usb/host/ohci-hcd.c:1.1.1.4	Fri Feb  9 13:44:37 2007
> +++ linux-powerpc-git/drivers/usb/host/ohci-hcd.c	Wed Feb 14 12:30:56 2007
> @@ -42,6 +42,9 @@
>  #include <asm/system.h>
>  #include <asm/unaligned.h>
>  #include <asm/byteorder.h>
> +#ifdef CONFIG_PPC_PS3
> +#include <asm/firmware.h>
> +#endif
>  
>  #include "../core/hcd.h"
>  
> @@ -944,9 +947,12 @@
>  		sizeof (struct ed), sizeof (struct td));
>  
>  #ifdef PS3_SYSTEM_BUS_DRIVER
> -	retval = ps3_system_bus_driver_register(&PS3_SYSTEM_BUS_DRIVER);
> -	if (retval < 0)
> -		goto error_ps3;
> +	if (firmware_has_feature(FW_FEATURE_PS3_LV1)) {
> +		retval = ps3_system_bus_driver_register(
> +				&PS3_SYSTEM_BUS_DRIVER);
> +		if (retval < 0)
> +			goto error_ps3;
> +	}
>  #endif
>  
>  #ifdef PLATFORM_DRIVER
> @@ -992,7 +998,8 @@
>   error_platform:
>  #endif
>  #ifdef PS3_SYSTEM_BUS_DRIVER
> -	ps3_system_bus_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
> +	if (firmware_has_feature(FW_FEATURE_PS3_LV1))
> +		ps3_system_bus_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
>   error_ps3:
>  #endif
>  	return retval;
> @@ -1014,7 +1021,8 @@
>  	platform_driver_unregister(&PLATFORM_DRIVER);
>  #endif
>  #ifdef PS3_SYSTEM_BUS_DRIVER
> -	ps3_system_bus_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
> +	if (firmware_has_feature(FW_FEATURE_PS3_LV1))
> +		ps3_system_bus_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
>  #endif
>  }
>  module_exit(ohci_hcd_mod_exit);
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

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

* Re: [PATCH] ps3: don't call ps3_system_bus_driver_register on other platforms
  2007-02-14 19:27 ` Geoff Levand
@ 2007-02-17  1:33   ` David Brownell
  0 siblings, 0 replies; 4+ messages in thread
From: David Brownell @ 2007-02-17  1:33 UTC (permalink / raw)
  To: Geoff Levand; +Cc: linuxppc-dev, greg, linux-usb-devel

On Wednesday 14 February 2007 11:27 am, Geoff Levand wrote:
> Ishizaki Kou wrote:
> > ps3_system_bus_driver_register is PS3 platform specific function.
> > On other platforms, it triggers WARN_ON in kref_get.
> 
> > +++ linux-powerpc-git/drivers/usb/host/ehci-hcd.c
> > +++ linux-powerpc-git/drivers/usb/host/ohci-hcd.c
> 
> I would think we only need to modify ps3_system_bus_driver_register()
> and ps3_system_bus_driver_unregister() to do the proper thing, not the
> usb host drivers that make those calls.  I'll look into that solution.

Right, that seems like the real bug.  When that's fixed, this patch
can/should be backed out...

- Dave

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

end of thread, other threads:[~2007-02-17  1:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-14  7:04 [PATCH] ps3: don't call ps3_system_bus_driver_register on other platforms Ishizaki Kou
2007-02-14 19:27 ` Geoff Levand
2007-02-17  1:33   ` David Brownell
2007-02-14 21:22 ` Benjamin Herrenschmidt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.