Skip to contentSkip to conversation

USB: HCD: remove logic about which hcd is loaded

PATCH In review Greg Kroah-Hartman 2 participants 5 messages Jan 7 – Jan 11

Subsystems (5)
lore
Share & tools
lore

Greg Kroah-Hartman

author maintainer
#0 lore raw

PATCH 1/1 USB: HCD: remove logic about which hcd is loaded

It turns out that warning about which USB host controller is loaded before another one doesn't really matter. All that really is needed is the PCI softdep module loading logic, which has been present in the kernel ever since commit 05c92da0c524 ("usb: ohci/uhci - add soft dependencies on ehci_pci")

So remove the warning messages, they are not useful, not needed, and only confuse people. As can be seen in the discussion at
https://lore.kernel.org/r/[email protected]

---
 drivers/usb/core/hcd.c            | 4 ----
 drivers/usb/fotg210/fotg210-hcd.c | 6 ------
 drivers/usb/host/ehci-hcd.c       | 8 --------
 drivers/usb/host/ohci-hcd.c       | 3 ---
 drivers/usb/host/uhci-hcd.c       | 5 -----
 include/linux/usb/hcd.h           | 6 ------
 6 files changed, 32 deletions(-)
drivers/usb/core/hcd.c +0 -4
index 24feb0de1c00..2d99a59d9f3f 100644
@@ -77,10 +77,6 @@
 
 /*-------------------------------------------------------------------------*/
 
-/* Keep track of which host controller drivers are loaded */
-unsigned long usb_hcds_loaded;
-EXPORT_SYMBOL_GPL(usb_hcds_loaded);
-
 /* host controllers we manage */
 DEFINE_IDR (usb_bus_idr);
 EXPORT_SYMBOL_GPL (usb_bus_idr);
drivers/usb/fotg210/fotg210-hcd.c +0 -6
index 64c4965a160f..fbb5d590eab6 100644
@@ -5625,11 +5625,6 @@ int __init fotg210_hcd_init(void)
 	if (usb_disabled())
 		return -ENODEV;
 
-	set_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
-	if (test_bit(USB_UHCI_LOADED, &usb_hcds_loaded) ||
-			test_bit(USB_OHCI_LOADED, &usb_hcds_loaded))
-		pr_warn("Warning! fotg210_hcd should always be loaded before uhci_hcd and ohci_hcd, not after\n");
-
 	pr_debug("%s: block sizes: qh %zd qtd %zd itd %zd\n",
 			hcd_name, sizeof(struct fotg210_qh),
 			sizeof(struct fotg210_qtd),
@@ -5643,5 +5638,4 @@ int __init fotg210_hcd_init(void)
 void __exit fotg210_hcd_cleanup(void)
 {
 	debugfs_remove(fotg210_debug_root);
-	clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
 }
drivers/usb/host/ehci-hcd.c +0 -8
index 6d1d190c914d..3c46bb18c7f3 100644
@@ -1354,12 +1354,6 @@ static int __init ehci_hcd_init(void)
 	if (usb_disabled())
 		return -ENODEV;
 
-	set_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
-	if (test_bit(USB_UHCI_LOADED, &usb_hcds_loaded) ||
-			test_bit(USB_OHCI_LOADED, &usb_hcds_loaded))
-		printk(KERN_WARNING "Warning! ehci_hcd should always be loaded"
-				" before uhci_hcd and ohci_hcd, not after\n");
-
 	pr_debug("%s: block sizes: qh %zd qtd %zd itd %zd sitd %zd\n",
 		 hcd_name,
 		 sizeof(struct ehci_qh), sizeof(struct ehci_qtd),
@@ -1390,7 +1384,6 @@ static int __init ehci_hcd_init(void)
 	debugfs_remove(ehci_debug_root);
 	ehci_debug_root = NULL;
 #endif
-	clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
 	return retval;
 }
 module_init(ehci_hcd_init);
@@ -1404,6 +1397,5 @@ static void __exit ehci_hcd_cleanup(void)
 #ifdef CONFIG_DYNAMIC_DEBUG
 	debugfs_remove(ehci_debug_root);
 #endif
-	clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
 }
 module_exit(ehci_hcd_cleanup);
drivers/usb/host/ohci-hcd.c +0 -3
index 9c7f3008646e..30840922f729 100644
@@ -1282,7 +1282,6 @@ static int __init ohci_hcd_mod_init(void)
 
 	pr_debug ("%s: block sizes: ed %zd td %zd\n", hcd_name,
 		sizeof (struct ed), sizeof (struct td));
-	set_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
 
 	ohci_debug_root = debugfs_create_dir("ohci", usb_debug_root);
 
@@ -1332,7 +1331,6 @@ static int __init ohci_hcd_mod_init(void)
 	debugfs_remove(ohci_debug_root);
 	ohci_debug_root = NULL;
 
-	clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
 	return retval;
 }
 module_init(ohci_hcd_mod_init);
@@ -1352,7 +1350,6 @@ static void __exit ohci_hcd_mod_exit(void)
 	ps3_ohci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
 #endif
 	debugfs_remove(ohci_debug_root);
-	clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
 }
 module_exit(ohci_hcd_mod_exit);
 
drivers/usb/host/uhci-hcd.c +0 -5
index 14e6dfef16c6..8bb11109b66c 100644
@@ -867,8 +867,6 @@ static int __init uhci_hcd_init(void)
 	if (usb_disabled())
 		return -ENODEV;
 
-	set_bit(USB_UHCI_LOADED, &usb_hcds_loaded);
-
 #ifdef CONFIG_DYNAMIC_DEBUG
 	errbuf = kmalloc(ERRBUF_LEN, GFP_KERNEL);
 	if (!errbuf)
@@ -912,8 +910,6 @@ static int __init uhci_hcd_init(void)
 
 errbuf_failed:
 #endif
-
-	clear_bit(USB_UHCI_LOADED, &usb_hcds_loaded);
 	return retval;
 }
 
@@ -930,7 +926,6 @@ static void __exit uhci_hcd_cleanup(void)
 #ifdef CONFIG_DYNAMIC_DEBUG
 	kfree(errbuf);
 #endif
-	clear_bit(USB_UHCI_LOADED, &usb_hcds_loaded);
 }
 
 module_init(uhci_hcd_init);
include/linux/usb/hcd.h +0 -6
index ac95e7c89df5..181db044c4d2 100644
@@ -760,12 +760,6 @@ static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
  */
 extern struct rw_semaphore ehci_cf_port_reset_rwsem;
 
-/* Keep track of which host controller drivers are loaded */
-#define USB_UHCI_LOADED		0
-#define USB_OHCI_LOADED		1
-#define USB_EHCI_LOADED		2
-extern unsigned long usb_hcds_loaded;
-
 #endif /* __KERNEL__ */
 
 #endif /* __USB_CORE_HCD_H */
Signature · 1 line
2.52.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines

-----原始邮件-----
发件人: "Greg Kroah-Hartman" <[email protected]>
发送时间:2026-01-07 23:25:40 (星期三)
收件人: [email protected]
抄送: [email protected], "Greg Kroah-Hartman" <[email protected]>, "Huacai Chen" <[email protected]>, "Alan Stern" <[email protected]> 主题: [PATCH] USB: HCD: remove logic about which hcd is loaded

It turns out that warning about which USB host controller is loaded before another one doesn't really matter. All that really is needed is the PCI softdep module loading logic, which has been present in the kernel ever since commit 05c92da0c524 ("usb: ohci/uhci - add soft dependencies on ehci_pci")

Quoted 7 lines

So remove the warning messages, they are not useful, not needed, and only confuse people. As can be seen in the discussion at
https://lore.kernel.org/r/[email protected]

And it should be backported to stable branches?

Huacai

Quoted 155 lines
---
 drivers/usb/core/hcd.c            | 4 ----
 drivers/usb/fotg210/fotg210-hcd.c | 6 ------
 drivers/usb/host/ehci-hcd.c       | 8 --------
 drivers/usb/host/ohci-hcd.c       | 3 ---
 drivers/usb/host/uhci-hcd.c       | 5 -----
 include/linux/usb/hcd.h           | 6 ------
 6 files changed, 32 deletions(-)
drivers/usb/core/hcd.c +0 -4
index 24feb0de1c00..2d99a59d9f3f 100644
@@ -77,10 +77,6 @@
 
 /*-------------------------------------------------------------------------*/
 
-/* Keep track of which host controller drivers are loaded */
-unsigned long usb_hcds_loaded;
-EXPORT_SYMBOL_GPL(usb_hcds_loaded);
-
 /* host controllers we manage */
 DEFINE_IDR (usb_bus_idr);
 EXPORT_SYMBOL_GPL (usb_bus_idr);
drivers/usb/fotg210/fotg210-hcd.c +0 -6
index 64c4965a160f..fbb5d590eab6 100644
@@ -5625,11 +5625,6 @@ int __init fotg210_hcd_init(void)
 	if (usb_disabled())
 		return -ENODEV;
 
-	set_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
-	if (test_bit(USB_UHCI_LOADED, &usb_hcds_loaded) ||
-			test_bit(USB_OHCI_LOADED, &usb_hcds_loaded))
-		pr_warn("Warning! fotg210_hcd should always be loaded before uhci_hcd and ohci_hcd, not after\n");
-
 	pr_debug("%s: block sizes: qh %zd qtd %zd itd %zd\n",
 			hcd_name, sizeof(struct fotg210_qh),
 			sizeof(struct fotg210_qtd),
@@ -5643,5 +5638,4 @@ int __init fotg210_hcd_init(void)
 void __exit fotg210_hcd_cleanup(void)
 {
 	debugfs_remove(fotg210_debug_root);
-	clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
 }
drivers/usb/host/ehci-hcd.c +0 -8
index 6d1d190c914d..3c46bb18c7f3 100644
@@ -1354,12 +1354,6 @@ static int __init ehci_hcd_init(void)
 	if (usb_disabled())
 		return -ENODEV;
 
-	set_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
-	if (test_bit(USB_UHCI_LOADED, &usb_hcds_loaded) ||
-			test_bit(USB_OHCI_LOADED, &usb_hcds_loaded))
-		printk(KERN_WARNING "Warning! ehci_hcd should always be loaded"
-				" before uhci_hcd and ohci_hcd, not after\n");
-
 	pr_debug("%s: block sizes: qh %zd qtd %zd itd %zd sitd %zd\n",
 		 hcd_name,
 		 sizeof(struct ehci_qh), sizeof(struct ehci_qtd),
@@ -1390,7 +1384,6 @@ static int __init ehci_hcd_init(void)
 	debugfs_remove(ehci_debug_root);
 	ehci_debug_root = NULL;
 #endif
-	clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
 	return retval;
 }
 module_init(ehci_hcd_init);
@@ -1404,6 +1397,5 @@ static void __exit ehci_hcd_cleanup(void)
 #ifdef CONFIG_DYNAMIC_DEBUG
 	debugfs_remove(ehci_debug_root);
 #endif
-	clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
 }
 module_exit(ehci_hcd_cleanup);
drivers/usb/host/ohci-hcd.c +0 -3
index 9c7f3008646e..30840922f729 100644
@@ -1282,7 +1282,6 @@ static int __init ohci_hcd_mod_init(void)
 
 	pr_debug ("%s: block sizes: ed %zd td %zd\n", hcd_name,
 		sizeof (struct ed), sizeof (struct td));
-	set_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
 
 	ohci_debug_root = debugfs_create_dir("ohci", usb_debug_root);
 
@@ -1332,7 +1331,6 @@ static int __init ohci_hcd_mod_init(void)
 	debugfs_remove(ohci_debug_root);
 	ohci_debug_root = NULL;
 
-	clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
 	return retval;
 }
 module_init(ohci_hcd_mod_init);
@@ -1352,7 +1350,6 @@ static void __exit ohci_hcd_mod_exit(void)
 	ps3_ohci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
 #endif
 	debugfs_remove(ohci_debug_root);
-	clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
 }
 module_exit(ohci_hcd_mod_exit);
 
drivers/usb/host/uhci-hcd.c +0 -5
index 14e6dfef16c6..8bb11109b66c 100644
@@ -867,8 +867,6 @@ static int __init uhci_hcd_init(void)
 	if (usb_disabled())
 		return -ENODEV;
 
-	set_bit(USB_UHCI_LOADED, &usb_hcds_loaded);
-
 #ifdef CONFIG_DYNAMIC_DEBUG
 	errbuf = kmalloc(ERRBUF_LEN, GFP_KERNEL);
 	if (!errbuf)
@@ -912,8 +910,6 @@ static int __init uhci_hcd_init(void)
 
 errbuf_failed:
 #endif
-
-	clear_bit(USB_UHCI_LOADED, &usb_hcds_loaded);
 	return retval;
 }
 
@@ -930,7 +926,6 @@ static void __exit uhci_hcd_cleanup(void)
 #ifdef CONFIG_DYNAMIC_DEBUG
 	kfree(errbuf);
 #endif
-	clear_bit(USB_UHCI_LOADED, &usb_hcds_loaded);
 }
 
 module_init(uhci_hcd_init);
include/linux/usb/hcd.h +0 -6
index ac95e7c89df5..181db044c4d2 100644
@@ -760,12 +760,6 @@ static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
  */
 extern struct rw_semaphore ehci_cf_port_reset_rwsem;
 
-/* Keep track of which host controller drivers are loaded */
-#define USB_UHCI_LOADED		0
-#define USB_OHCI_LOADED		1
-#define USB_EHCI_LOADED		2
-extern unsigned long usb_hcds_loaded;
-
 #endif /* __KERNEL__ */
 
 #endif /* __USB_CORE_HCD_H */
Signature · 1 line
2.52.0

本邮件及其附件含有龙芯中科的商业秘密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制或散发)本邮件及其附件中的信息。如果您错收本邮件,请您立即电话或邮件通知发件人并删除本邮件。
This email and its attachments contain confidential information from Loongson Technology , which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this email in error, please notify the sender by phone or email immediately and delete it.

author maintainer
#2 lore raw
Quoted 20 lines · 陈华才
Quoted 20 lines

-----原始邮件-----
发件人: "Greg Kroah-Hartman" <[email protected]>
发送时间:2026-01-07 23:25:40 (星期三)
收件人: [email protected]
抄送: [email protected], "Greg Kroah-Hartman" <[email protected]>, "Huacai Chen" <[email protected]>, "Alan Stern" <[email protected]> 主题: [PATCH] USB: HCD: remove logic about which hcd is loaded

It turns out that warning about which USB host controller is loaded before another one doesn't really matter. All that really is needed is the PCI softdep module loading logic, which has been present in the kernel ever since commit 05c92da0c524 ("usb: ohci/uhci - add soft dependencies on ehci_pci")

So remove the warning messages, they are not useful, not needed, and only confuse people. As can be seen in the discussion at
https://lore.kernel.org/r/[email protected]

Quoted 6 lines
Quoted 3 lines

And it should be backported to stable branches?

It doesn't change any behavior, so why would it be needed anywhere else? It's just removing a message that people have been ignoring for a very very long time :)

thanks,

greg k-h

#3 lore raw
Quoted 34 lines

-----原始邮件-----
发件人: "Greg Kroah-Hartman" <[email protected]>
发送时间:2026-01-10 17:54:10 (星期六)
收件人: 陈华才 <[email protected]>
抄送: [email protected], [email protected], "Alan Stern" <[email protected]> 主题: Re: [PATCH] USB: HCD: remove logic about which hcd is loaded

Quoted 23 lines · 陈华才
Quoted 23 lines

-----原始邮件-----
发件人: "Greg Kroah-Hartman" <[email protected]>
发送时间:2026-01-07 23:25:40 (星期三)
收件人: [email protected]
抄送: [email protected], "Greg Kroah-Hartman" <[email protected]>, "Huacai Chen" <[email protected]>, "Alan Stern" <[email protected]> 主题: [PATCH] USB: HCD: remove logic about which hcd is loaded

It turns out that warning about which USB host controller is loaded before another one doesn't really matter. All that really is needed is the PCI softdep module loading logic, which has been present in the kernel ever since commit 05c92da0c524 ("usb: ohci/uhci - add soft dependencies on ehci_pci")

So remove the warning messages, they are not useful, not needed, and only confuse people. As can be seen in the discussion at
https://lore.kernel.org/r/[email protected]

Quoted 7 lines
Quoted 3 lines

And it should be backported to stable branches?

It doesn't change any behavior, so why would it be needed anywhere else? It's just removing a message that people have been ignoring for a very very long time :)

Because I (and others) don't want to see a bogus warning when I use LTS branches.

Huacai

Quoted 4 lines

thanks,

greg k-h

本邮件及其附件含有龙芯中科的商业秘密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制或散发)本邮件及其附件中的信息。如果您错收本邮件,请您立即电话或邮件通知发件人并删除本邮件。
This email and its attachments contain confidential information from Loongson Technology , which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this email in error, please notify the sender by phone or email immediately and delete it.

author maintainer
#4 lore raw
Quoted 2 lines · 陈华才

本邮件及其附件含有龙芯中科的商业秘密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制或散发)本邮件及其附件中的信息。如果您错收本邮件,请您立即电话或邮件通知发件人并删除本邮件。
This email and its attachments contain confidential information from Loongson Technology , which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this email in error, please notify the sender by phone or email immediately and delete it.

Now deleted.