linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] usb: gadget: fsl: Two improvements
@ 2024-02-23 17:33 Uwe Kleine-König
  2024-02-23 17:33 ` [PATCH 1/2] usb: gadget: fsl: Add of device table to enable module autoloading Uwe Kleine-König
  2024-02-23 17:33 ` [PATCH 2/2] usb: gadget: fsl: Increase size of name buffer for endpoints Uwe Kleine-König
  0 siblings, 2 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2024-02-23 17:33 UTC (permalink / raw)
  To: Li Yang, Greg Kroah-Hartman; +Cc: linux-usb, linuxppc-dev, kernel

Hello,

here come two patches that I created while debugging an issue around USB
on MPC8313.

Best regards
Uwe

Uwe Kleine-König (2):
  usb: gadget: fsl: Add of device table to enable module autoloading
  usb: gadget: fsl: Increase size of name buffer for endpoints

 drivers/usb/gadget/udc/fsl_udc_core.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

base-commit: 33e1d31873f87d119e5120b88cd350efa68ef276
-- 
2.43.0


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

* [PATCH 1/2] usb: gadget: fsl: Add of device table to enable module autoloading
  2024-02-23 17:33 [PATCH 0/2] usb: gadget: fsl: Two improvements Uwe Kleine-König
@ 2024-02-23 17:33 ` Uwe Kleine-König
  2024-02-23 17:33 ` [PATCH 2/2] usb: gadget: fsl: Increase size of name buffer for endpoints Uwe Kleine-König
  1 sibling, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2024-02-23 17:33 UTC (permalink / raw)
  To: Li Yang, Greg Kroah-Hartman; +Cc: linux-usb, linuxppc-dev, kernel

With this table added, the fsl_usb2_udc module is automatically loaded
by udev in the presence of a matching device.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/usb/gadget/udc/fsl_udc_core.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
index e8042c158f6d..65346a322a77 100644
--- a/drivers/usb/gadget/udc/fsl_udc_core.c
+++ b/drivers/usb/gadget/udc/fsl_udc_core.c
@@ -2666,6 +2666,15 @@ static const struct platform_device_id fsl_udc_devtype[] = {
 	}
 };
 MODULE_DEVICE_TABLE(platform, fsl_udc_devtype);
+
+static const struct of_device_id fsl_udc_dt_ids[] = {
+	{ .compatible = "fsl-usb2-dr" },
+	{ .compatible = "fsl-usb2-mph" },
+	{ .compatible = "fsl,mpc5121-usb2-dr" },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, fsl_udc_dt_ids);
+
 static struct platform_driver udc_driver = {
 	.probe		= fsl_udc_probe,
 	.remove_new	= fsl_udc_remove,
@@ -2675,6 +2684,7 @@ static struct platform_driver udc_driver = {
 	.resume		= fsl_udc_resume,
 	.driver		= {
 			.name = driver_name,
+			.of_match_table = fsl_udc_dt_ids,
 			/* udc suspend/resume called from OTG driver */
 			.suspend = fsl_udc_otg_suspend,
 			.resume  = fsl_udc_otg_resume,
-- 
2.43.0


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

* [PATCH 2/2] usb: gadget: fsl: Increase size of name buffer for endpoints
  2024-02-23 17:33 [PATCH 0/2] usb: gadget: fsl: Two improvements Uwe Kleine-König
  2024-02-23 17:33 ` [PATCH 1/2] usb: gadget: fsl: Add of device table to enable module autoloading Uwe Kleine-König
@ 2024-02-23 17:33 ` Uwe Kleine-König
  1 sibling, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2024-02-23 17:33 UTC (permalink / raw)
  To: Li Yang, Greg Kroah-Hartman; +Cc: linux-usb, linuxppc-dev, kernel

This fixes a W=1 warning about sprintf writing up to 16 bytes into a
buffer of size 14. There is no practical relevance because there are not
more than 32 endpoints.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,

I hesitated to add a Fixes: trailer because the problem is never hit in
practise. Anyhow, if you think it's a good idea to add one, the commit
introducing the too small buffer is:

	b504882da539 ("USB: add Freescale high-speed USB SOC device controller driver")

Best regards
Uwe

 drivers/usb/gadget/udc/fsl_udc_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
index 65346a322a77..b7e7ae5e051b 100644
--- a/drivers/usb/gadget/udc/fsl_udc_core.c
+++ b/drivers/usb/gadget/udc/fsl_udc_core.c
@@ -2486,7 +2486,7 @@ static int fsl_udc_probe(struct platform_device *pdev)
 	/* setup the udc->eps[] for non-control endpoints and link
 	 * to gadget.ep_list */
 	for (i = 1; i < (int)(udc_controller->max_ep / 2); i++) {
-		char name[14];
+		char name[16];
 
 		sprintf(name, "ep%dout", i);
 		struct_ep_setup(udc_controller, i * 2, name, 1);
-- 
2.43.0


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

end of thread, other threads:[~2024-02-23 17:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-23 17:33 [PATCH 0/2] usb: gadget: fsl: Two improvements Uwe Kleine-König
2024-02-23 17:33 ` [PATCH 1/2] usb: gadget: fsl: Add of device table to enable module autoloading Uwe Kleine-König
2024-02-23 17:33 ` [PATCH 2/2] usb: gadget: fsl: Increase size of name buffer for endpoints Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).