Message ID | 1652097288-19909-3-git-send-email-quic_linyyuan@quicinc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | usb: gadget: update DECLARE_USB_FUNCTION(_INIT) macro | expand |
On Mon, May 09, 2022 at 07:54:46PM +0800, Linyu Yuan wrote: > 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. Please properly format your paragraphs. Why the odd line-break? > 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@quicinc.com> > --- > v3: new add What does "new add" mean? Please be explicit and verbose. confused, greg k-h
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,
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@quicinc.com> --- 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(-)