[PATCH 1/7] usb: gadget: fsl_udc: simplify driver init

Christoph Fritz chf.fritz at googlemail.com
Fri Oct 19 21:24:39 EST 2012


To initialize this driver use 'module_platform_driver' instead
of '__init' and '__exit'.

Signed-off-by: Christoph Fritz <chf.fritz at googlemail.com>
---
 drivers/usb/gadget/fsl_udc_core.c |   37 +++++++++++--------------------------
 1 files changed, 11 insertions(+), 26 deletions(-)

diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index 6ae70cb..340451d 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -49,13 +49,14 @@
 
 #include "fsl_usb2_udc.h"
 
+#define	DRIVER_NAME	"fsl-usb2-udc"
 #define	DRIVER_DESC	"Freescale High-Speed USB SOC Device Controller driver"
 #define	DRIVER_AUTHOR	"Li Yang/Jiang Bo"
 #define	DRIVER_VERSION	"Apr 20, 2007"
 
 #define	DMA_ADDR_INVALID	(~(dma_addr_t)0)
 
-static const char driver_name[] = "fsl-usb2-udc";
+static const char driver_name[] = DRIVER_NAME;
 static const char driver_desc[] = DRIVER_DESC;
 
 static struct usb_dr_device *dr_regs;
@@ -2761,35 +2762,19 @@ static int fsl_udc_otg_resume(struct device *dev)
 	Register entry point for the peripheral controller driver
 --------------------------------------------------------------------------*/
 
-static struct platform_driver udc_driver = {
-	.remove  = __exit_p(fsl_udc_remove),
-	/* these suspend and resume are not usb suspend and resume */
-	.suspend = fsl_udc_suspend,
-	.resume  = fsl_udc_resume,
-	.driver  = {
-		.name = (char *)driver_name,
-		.owner = THIS_MODULE,
-		/* udc suspend/resume called from OTG driver */
+static struct platform_driver fsl_udc_driver = {
+	.probe		= fsl_udc_probe,
+	.remove		= __devexit_p(fsl_udc_remove),
+	.suspend	= fsl_udc_suspend,
+	.resume		= fsl_udc_resume,
+	.driver		= {
+		.name	= DRIVER_NAME,
+		.owner	= THIS_MODULE,
 		.suspend = fsl_udc_otg_suspend,
 		.resume  = fsl_udc_otg_resume,
 	},
 };
-
-static int __init udc_init(void)
-{
-	printk(KERN_INFO "%s (%s)\n", driver_desc, DRIVER_VERSION);
-	return platform_driver_probe(&udc_driver, fsl_udc_probe);
-}
-
-module_init(udc_init);
-
-static void __exit udc_exit(void)
-{
-	platform_driver_unregister(&udc_driver);
-	printk(KERN_WARNING "%s unregistered\n", driver_desc);
-}
-
-module_exit(udc_exit);
+module_platform_driver(fsl_udc_driver);
 
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_AUTHOR(DRIVER_AUTHOR);
-- 
1.7.2.5



More information about the Linuxppc-dev mailing list