Commit aad06846 authored by Guenter Roeck's avatar Guenter Roeck Committed by Greg Kroah-Hartman

usb: ehci: Simplify platform driver registration

Use platform_register_drivers() and platform_unregister_drivers() to
register and unregister ehci platform drivers. This simplifies the code
and prevents the following build errors seen with sparc:allmodconfig.

drivers/usb/host/ehci-hcd.c:1301: error:
	"PLATFORM_DRIVER" redefined
drivers/usb/host/ehci-sh.c:173:31: error:
	'ehci_hcd_sh_driver' defined but not used
Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20210907123002.3951446-1-linux@roeck-us.netSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 91fac074
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/platform_device.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
...@@ -1278,29 +1279,39 @@ MODULE_LICENSE ("GPL"); ...@@ -1278,29 +1279,39 @@ MODULE_LICENSE ("GPL");
#ifdef CONFIG_USB_EHCI_SH #ifdef CONFIG_USB_EHCI_SH
#include "ehci-sh.c" #include "ehci-sh.c"
#define PLATFORM_DRIVER ehci_hcd_sh_driver
#endif #endif
#ifdef CONFIG_PPC_PS3 #ifdef CONFIG_PPC_PS3
#include "ehci-ps3.c" #include "ehci-ps3.c"
#define PS3_SYSTEM_BUS_DRIVER ps3_ehci_driver
#endif #endif
#ifdef CONFIG_USB_EHCI_HCD_PPC_OF #ifdef CONFIG_USB_EHCI_HCD_PPC_OF
#include "ehci-ppc-of.c" #include "ehci-ppc-of.c"
#define OF_PLATFORM_DRIVER ehci_hcd_ppc_of_driver
#endif #endif
#ifdef CONFIG_XPS_USB_HCD_XILINX #ifdef CONFIG_XPS_USB_HCD_XILINX
#include "ehci-xilinx-of.c" #include "ehci-xilinx-of.c"
#define XILINX_OF_PLATFORM_DRIVER ehci_hcd_xilinx_of_driver
#endif #endif
#ifdef CONFIG_SPARC_LEON #ifdef CONFIG_SPARC_LEON
#include "ehci-grlib.c" #include "ehci-grlib.c"
#define PLATFORM_DRIVER ehci_grlib_driver
#endif #endif
static struct platform_driver * const platform_drivers[] = {
#ifdef CONFIG_USB_EHCI_SH
&ehci_hcd_sh_driver,
#endif
#ifdef CONFIG_USB_EHCI_HCD_PPC_OF
&ehci_hcd_ppc_of_driver,
#endif
#ifdef CONFIG_XPS_USB_HCD_XILINX
&ehci_hcd_xilinx_of_driver,
#endif
#ifdef CONFIG_SPARC_LEON
&ehci_grlib_driver,
#endif
};
static int __init ehci_hcd_init(void) static int __init ehci_hcd_init(void)
{ {
int retval = 0; int retval = 0;
...@@ -1324,47 +1335,23 @@ static int __init ehci_hcd_init(void) ...@@ -1324,47 +1335,23 @@ static int __init ehci_hcd_init(void)
ehci_debug_root = debugfs_create_dir("ehci", usb_debug_root); ehci_debug_root = debugfs_create_dir("ehci", usb_debug_root);
#endif #endif
#ifdef PLATFORM_DRIVER retval = platform_register_drivers(platform_drivers, ARRAY_SIZE(platform_drivers));
retval = platform_driver_register(&PLATFORM_DRIVER);
if (retval < 0) if (retval < 0)
goto clean0; goto clean0;
#endif
#ifdef PS3_SYSTEM_BUS_DRIVER
retval = ps3_ehci_driver_register(&PS3_SYSTEM_BUS_DRIVER);
if (retval < 0)
goto clean2;
#endif
#ifdef OF_PLATFORM_DRIVER #ifdef CONFIG_PPC_PS3
retval = platform_driver_register(&OF_PLATFORM_DRIVER); retval = ps3_ehci_driver_register(&ps3_ehci_driver);
if (retval < 0) if (retval < 0)
goto clean3; goto clean1;
#endif #endif
#ifdef XILINX_OF_PLATFORM_DRIVER return 0;
retval = platform_driver_register(&XILINX_OF_PLATFORM_DRIVER);
if (retval < 0)
goto clean4;
#endif
return retval;
#ifdef XILINX_OF_PLATFORM_DRIVER #ifdef CONFIG_PPC_PS3
/* platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER); */ clean1:
clean4:
#endif
#ifdef OF_PLATFORM_DRIVER
platform_driver_unregister(&OF_PLATFORM_DRIVER);
clean3:
#endif
#ifdef PS3_SYSTEM_BUS_DRIVER
ps3_ehci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
clean2:
#endif #endif
#ifdef PLATFORM_DRIVER platform_unregister_drivers(platform_drivers, ARRAY_SIZE(platform_drivers));
platform_driver_unregister(&PLATFORM_DRIVER);
clean0: clean0:
#endif
#ifdef CONFIG_DYNAMIC_DEBUG #ifdef CONFIG_DYNAMIC_DEBUG
debugfs_remove(ehci_debug_root); debugfs_remove(ehci_debug_root);
ehci_debug_root = NULL; ehci_debug_root = NULL;
...@@ -1376,18 +1363,10 @@ module_init(ehci_hcd_init); ...@@ -1376,18 +1363,10 @@ module_init(ehci_hcd_init);
static void __exit ehci_hcd_cleanup(void) static void __exit ehci_hcd_cleanup(void)
{ {
#ifdef XILINX_OF_PLATFORM_DRIVER #ifdef CONFIG_PPC_PS3
platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER); ps3_ehci_driver_unregister(&ps3_ehci_driver);
#endif
#ifdef OF_PLATFORM_DRIVER
platform_driver_unregister(&OF_PLATFORM_DRIVER);
#endif
#ifdef PLATFORM_DRIVER
platform_driver_unregister(&PLATFORM_DRIVER);
#endif
#ifdef PS3_SYSTEM_BUS_DRIVER
ps3_ehci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
#endif #endif
platform_unregister_drivers(platform_drivers, ARRAY_SIZE(platform_drivers));
#ifdef CONFIG_DYNAMIC_DEBUG #ifdef CONFIG_DYNAMIC_DEBUG
debugfs_remove(ehci_debug_root); debugfs_remove(ehci_debug_root);
#endif #endif
......
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