All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Staging: gdm724x: gdm_usb.c: Use module_usb_driver
@ 2015-09-29  4:56 Shraddha Barke
  2015-09-29  4:56 ` [PATCH 2/2] Staging: gdm724x: gdm_mux.c: " Shraddha Barke
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Shraddha Barke @ 2015-09-29  4:56 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Shraddha Barke

Macro module_usb_driver is used for drivers whose init
and exit paths does only register and unregister.Remove
boilerplate code by using module_usb_driver.

Problem found using Coccinelle.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 drivers/staging/gdm724x/gdm_usb.c | 38 +-------------------------------------
 1 file changed, 1 insertion(+), 37 deletions(-)

diff --git a/drivers/staging/gdm724x/gdm_usb.c b/drivers/staging/gdm724x/gdm_usb.c
index ed1a12f..3977663 100644
--- a/drivers/staging/gdm724x/gdm_usb.c
+++ b/drivers/staging/gdm724x/gdm_usb.c
@@ -998,43 +998,7 @@ static struct usb_driver gdm_usb_lte_driver = {
 	.reset_resume = gdm_usb_resume,
 };
 
-static int __init gdm_usb_lte_init(void)
-{
-	if (gdm_lte_event_init() < 0) {
-		pr_err("error creating event\n");
-		return -1;
-	}
-
-	usb_tx_wq = create_workqueue("usb_tx_wq");
-	if (usb_tx_wq == NULL)
-		return -1;
-
-	usb_rx_wq = create_workqueue("usb_rx_wq");
-	if (usb_rx_wq == NULL)
-		return -1;
-
-	return usb_register(&gdm_usb_lte_driver);
-}
-
-static void __exit gdm_usb_lte_exit(void)
-{
-	gdm_lte_event_exit();
-
-	usb_deregister(&gdm_usb_lte_driver);
-
-	if (usb_tx_wq) {
-		flush_workqueue(usb_tx_wq);
-		destroy_workqueue(usb_tx_wq);
-	}
-
-	if (usb_rx_wq) {
-		flush_workqueue(usb_rx_wq);
-		destroy_workqueue(usb_rx_wq);
-	}
-}
-
-module_init(gdm_usb_lte_init);
-module_exit(gdm_usb_lte_exit);
+module_usb_driver(gdm_usb_lte_driver);
 
 MODULE_VERSION(DRIVER_VERSION);
 MODULE_DESCRIPTION("GCT LTE USB Device Driver");
-- 
2.1.4



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

end of thread, other threads:[~2015-09-29  5:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-29  4:56 [PATCH 1/2] Staging: gdm724x: gdm_usb.c: Use module_usb_driver Shraddha Barke
2015-09-29  4:56 ` [PATCH 2/2] Staging: gdm724x: gdm_mux.c: " Shraddha Barke
2015-09-29  5:19 ` [Outreachy kernel] [PATCH 1/2] Staging: gdm724x: gdm_usb.c: " Sudip Mukherjee
2015-09-29  5:48   ` Shraddha Barke
2015-09-29  5:40 ` Julia Lawall
2015-09-29  5:55   ` Shraddha Barke

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.