kernel/0067-fix-fix-the-issue-of-getting-hub-descriptor-fail.patch

56 lines
1.5 KiB
Diff
Raw Normal View History

2024-12-19 21:34:44 +00:00
From 3d18dfe335aaa59fdb845bfd844ca8fe113934e3 Mon Sep 17 00:00:00 2001
2024-12-15 18:29:23 +00:00
From: liangshuang <liangshuang@eswincomputing.com>
Date: Tue, 9 Jul 2024 09:38:51 +0800
Subject: [PATCH 067/219] fix:fix the issue of getting hub descriptor fail.
Changelogs:
1.fix the issue of hub not being able to read descriptor.
Signed-off-by: liangshuang <liangshuang@eswincomputing.com>
---
drivers/usb/core/hub.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 1ba3feb5e190..af159223bd48 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1407,6 +1407,7 @@ static int hub_configure(struct usb_hub *hub,
unsigned unit_load;
unsigned full_load;
unsigned maxchild;
+ int try_cnt = 0;
hub->buffer = kmalloc(sizeof(*hub->buffer), GFP_KERNEL);
if (!hub->buffer) {
@@ -1427,6 +1428,7 @@ static int hub_configure(struct usb_hub *hub,
goto fail;
}
+retry:
/* Request the entire hub descriptor.
* hub->descriptor can handle USB_MAXCHILDREN ports,
* but a (non-SS) hub can/will return fewer bytes here.
@@ -1446,9 +1448,15 @@ static int hub_configure(struct usb_hub *hub,
ret = -ENODEV;
goto fail;
} else if (hub->descriptor->bNbrPorts == 0) {
- message = "hub doesn't have any ports!";
- ret = -ENODEV;
- goto fail;
+ try_cnt++;
+ if (try_cnt < 10) {
+ mdelay(10);
+ goto retry;
+ } else {
+ message = "hub doesn't have any ports!";
+ ret = -ENODEV;
+ goto fail;
+ }
}
/*
--
2.47.0