[PATCH v3 2/4] usb: gadget: f_sourcesink: use DECLARE_USB_FUNCTION_INIT()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



First there is no reason call lb_modinit() and lb_modexit()
which belong to f_loopback.c,
let's remove them here and remove two function prototype from g_zero.h.

After first step, we can use DECLARE_USB_FUNCTION_INIT() macro
to create module init/exit function implicit as it only
register/unregister one usb function driver.

Signed-off-by: Linyu Yuan <quic_linyyuan@xxxxxxxxxxx>
---
v3: new add

 drivers/usb/gadget/function/f_sourcesink.c | 22 +---------------------
 drivers/usb/gadget/function/g_zero.h       |  3 ---
 2 files changed, 1 insertion(+), 24 deletions(-)

diff --git a/drivers/usb/gadget/function/f_sourcesink.c b/drivers/usb/gadget/function/f_sourcesink.c
index 6803cd6..f4a0793 100644
--- a/drivers/usb/gadget/function/f_sourcesink.c
+++ b/drivers/usb/gadget/function/f_sourcesink.c
@@ -1263,27 +1263,7 @@ static struct usb_function_instance *source_sink_alloc_inst(void)
 
 	return &ss_opts->func_inst;
 }
-DECLARE_USB_FUNCTION(SourceSink, source_sink_alloc_inst,
+DECLARE_USB_FUNCTION_INIT(SourceSink, source_sink_alloc_inst,
 		source_sink_alloc_func);
 
-static int __init sslb_modinit(void)
-{
-	int ret;
-
-	ret = usb_function_register(&SourceSinkusb_func);
-	if (ret)
-		return ret;
-	ret = lb_modinit();
-	if (ret)
-		usb_function_unregister(&SourceSinkusb_func);
-	return ret;
-}
-static void __exit sslb_modexit(void)
-{
-	usb_function_unregister(&SourceSinkusb_func);
-	lb_modexit();
-}
-module_init(sslb_modinit);
-module_exit(sslb_modexit);
-
 MODULE_LICENSE("GPL");
diff --git a/drivers/usb/gadget/function/g_zero.h b/drivers/usb/gadget/function/g_zero.h
index 98b8462..c1ea285 100644
--- a/drivers/usb/gadget/function/g_zero.h
+++ b/drivers/usb/gadget/function/g_zero.h
@@ -62,9 +62,6 @@ struct f_lb_opts {
 	int				refcnt;
 };
 
-void lb_modexit(void);
-int lb_modinit(void);
-
 /* common utilities */
 void disable_endpoints(struct usb_composite_dev *cdev,
 		struct usb_ep *in, struct usb_ep *out,
-- 
2.7.4




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux