public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: zhouscd <zhouscd@gmail.com>
To: gregkh@linuxfoundation.org
Cc: dan.scally@ideasonboard.com, laurent.pinchart@ideasonboard.com,
	m.grzeschik@pengutronix.de, john@keeping.me.uk,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	zhouscd <zhouscd@gmail.com>
Subject: [PATCH] USB: gadget: Fix the function name error in sourcesink/loopback.
Date: Mon, 31 Jul 2023 21:54:49 -0700	[thread overview]
Message-ID: <20230801045449.156348-1-zhouscd@gmail.com> (raw)

Inconsistent function names can cause the USB config FS not work.

Signed-off-by: zhouscd <zhouscd@gmail.com>
---
 drivers/usb/gadget/function/f_loopback.c   | 13 +----------
 drivers/usb/gadget/function/f_sourcesink.c | 25 ++--------------------
 drivers/usb/gadget/function/g_zero.h       |  3 ---
 3 files changed, 3 insertions(+), 38 deletions(-)

diff --git a/drivers/usb/gadget/function/f_loopback.c b/drivers/usb/gadget/function/f_loopback.c
index ae41f556eb75..45f542b5ff55 100644
--- a/drivers/usb/gadget/function/f_loopback.c
+++ b/drivers/usb/gadget/function/f_loopback.c
@@ -583,16 +583,5 @@ static struct usb_function_instance *loopback_alloc_instance(void)
 
 	return  &lb_opts->func_inst;
 }
-DECLARE_USB_FUNCTION(Loopback, loopback_alloc_instance, loopback_alloc);
-
-int __init lb_modinit(void)
-{
-	return usb_function_register(&Loopbackusb_func);
-}
-
-void __exit lb_modexit(void)
-{
-	usb_function_unregister(&Loopbackusb_func);
-}
-
+DECLARE_USB_FUNCTION_INIT(loopback, loopback_alloc_instance, loopback_alloc);
 MODULE_LICENSE("GPL");
diff --git a/drivers/usb/gadget/function/f_sourcesink.c b/drivers/usb/gadget/function/f_sourcesink.c
index 6803cd60cc6d..f6d1c095aa2c 100644
--- a/drivers/usb/gadget/function/f_sourcesink.c
+++ b/drivers/usb/gadget/function/f_sourcesink.c
@@ -858,7 +858,7 @@ static struct usb_function *source_sink_alloc_func(
 	ss->bulk_qlen = ss_opts->bulk_qlen;
 	ss->iso_qlen = ss_opts->iso_qlen;
 
-	ss->function.name = "source/sink";
+	ss->function.name = "sourcesink";
 	ss->function.bind = sourcesink_bind;
 	ss->function.set_alt = sourcesink_set_alt;
 	ss->function.get_alt = sourcesink_get_alt;
@@ -1263,27 +1263,6 @@ 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 98b8462ad538..c1ea28526c73 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.25.1


             reply	other threads:[~2023-08-01  4:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-01  4:54 zhouscd [this message]
2023-08-01  5:06 ` [PATCH] USB: gadget: Fix the function name error in sourcesink/loopback Greg KH
2023-08-01  6:15   ` 周城东
2023-08-01  6:22     ` Greg KH
2023-08-01  7:27       ` chengdong zhou
2023-08-01  7:34         ` Greg KH
2023-08-01  8:00           ` chengdong zhou
2023-08-01 14:57 ` kernel test robot
2023-08-01 21:39 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230801045449.156348-1-zhouscd@gmail.com \
    --to=zhouscd@gmail.com \
    --cc=dan.scally@ideasonboard.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=john@keeping.me.uk \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.grzeschik@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox