This patch renames usb_connect() to usb_choose_address(). It also adds
equivalent functionality for root hubs into usb_register_root_hub() so
that host controller drivers won't need to call it. That makes the
function internal to usbcore, so it's not exported any more.
Since the hc_simple driver doesn't call usb_register_root_hub(), I added
the necessary code manually.
If David agrees, this is ready to be applied.
Alan Stern
# This is a BitKeeper generated patch for the following project:
# Project Name: greg k-h's linux 2.5 USB kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1657 -> 1.1658
# drivers/usb/core/usb.c 1.213 -> 1.214
# drivers/usb/core/hub.c 1.112 -> 1.113
# drivers/usb/core/hcd.h 1.53 -> 1.54
# drivers/usb/host/ehci-hcd.c 1.87 -> 1.88
# drivers/usb/host/hc_sl811_rh.c 1.9 -> 1.10
# drivers/usb/host/uhci-hcd.c 1.55 -> 1.56
# drivers/usb/host/ohci-hcd.c 1.70 -> 1.71
# drivers/usb/core/hcd.c 1.111 -> 1.112
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/07/24 [EMAIL PROTECTED] 1.1658
# Put root hub address selection into register_root_hub().
# Rename usb_connect() to usb_choose_address().
# --------------------------------------------
#
diff -Nru a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
--- a/drivers/usb/core/hcd.c Thu Jul 24 16:36:39 2003
+++ b/drivers/usb/core/hcd.c Thu Jul 24 16:36:39 2003
@@ -734,14 +734,21 @@
* The USB host controller calls this function to register the root hub
* properly with the USB subsystem. It sets up the device properly in
* the driverfs tree, and then calls usb_new_device() to register the
- * usb device.
+ * usb device. It also assigns the root hub's USB address (always 1).
*/
int usb_register_root_hub (struct usb_device *usb_dev, struct device *parent_dev)
{
+ const int devnum = 1;
int retval;
sprintf (&usb_dev->dev.bus_id[0], "usb%d", usb_dev->bus->busnum);
usb_dev->state = USB_STATE_DEFAULT;
+
+ usb_dev->descriptor.bMaxPacketSize0 = 8;
+ usb_dev->devnum = devnum;
+ usb_dev->bus->devnum_next = devnum + 1;
+ set_bit (devnum, usb_dev->bus->devmap.devicemap);
+
retval = usb_new_device (usb_dev, parent_dev);
if (retval)
dev_err (parent_dev, "can't register root hub for %s, %d\n",
diff -Nru a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
--- a/drivers/usb/core/hcd.h Thu Jul 24 16:36:39 2003
+++ b/drivers/usb/core/hcd.h Thu Jul 24 16:36:39 2003
@@ -246,7 +246,7 @@
/* Enumeration is only for the hub driver, or HCD virtual root hubs */
extern int usb_new_device(struct usb_device *dev, struct device *parent);
-extern void usb_connect(struct usb_device *dev);
+extern void usb_choose_address(struct usb_device *dev);
extern void usb_disconnect(struct usb_device **);
/* exported to hub driver ONLY to support usb_reset_device () */
diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c Thu Jul 24 16:36:39 2003
+++ b/drivers/usb/core/hub.c Thu Jul 24 16:36:39 2003
@@ -932,7 +932,7 @@
}
/* Find a new address for it */
- usb_connect(dev);
+ usb_choose_address(dev);
/* Set up TT records, if needed */
if (hub->tt) {
diff -Nru a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
--- a/drivers/usb/core/usb.c Thu Jul 24 16:36:39 2003
+++ b/drivers/usb/core/usb.c Thu Jul 24 16:36:39 2003
@@ -945,15 +945,15 @@
}
/**
- * usb_connect - pick device address (usbcore-internal)
+ * usb_choose_address - pick device address (usbcore-internal)
* @dev: newly detected device (in DEFAULT state)
*
* Picks a device address. It's up to the hub (or root hub) driver
* to handle and manage enumeration, starting from the DEFAULT state.
- * Only hub drivers (including virtual root hub drivers for host
+ * Only hub drivers (but not virtual root hub drivers for host
* controllers) should ever call this.
*/
-void usb_connect(struct usb_device *dev)
+void usb_choose_address(struct usb_device *dev)
{
int devnum;
// FIXME needs locking for SMP!!
@@ -1608,7 +1608,6 @@
EXPORT_SYMBOL(usb_new_device);
EXPORT_SYMBOL(usb_reset_device);
-EXPORT_SYMBOL(usb_connect);
EXPORT_SYMBOL(usb_disconnect);
EXPORT_SYMBOL(__usb_get_extra_descriptor);
diff -Nru a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
--- a/drivers/usb/host/ehci-hcd.c Thu Jul 24 16:36:39 2003
+++ b/drivers/usb/host/ehci-hcd.c Thu Jul 24 16:36:39 2003
@@ -496,7 +496,6 @@
* Before this point the HC was idle/ready. After, khubd
* and device drivers may start it running.
*/
- usb_connect (udev);
udev->speed = USB_SPEED_HIGH;
if (hcd_register_root (hcd) != 0) {
if (hcd->state == USB_STATE_RUNNING)
diff -Nru a/drivers/usb/host/hc_sl811_rh.c b/drivers/usb/host/hc_sl811_rh.c
--- a/drivers/usb/host/hc_sl811_rh.c Thu Jul 24 16:36:39 2003
+++ b/drivers/usb/host/hc_sl811_rh.c Thu Jul 24 16:36:39 2003
@@ -564,7 +564,11 @@
return -ENOMEM;
hci->bus->root_hub = usb_dev;
- usb_connect (usb_dev);
+ usb_dev->descriptor.bMaxPacketSize0 = 8;
+ usb_dev->devnum = 1;
+ usb_dev->bus->devnum_next = usb_dev->devnum + 1;
+ set_bit (usb_dev->devnum, usb_dev->bus->devmap.devicemap);
+
if (usb_new_device (usb_dev) != 0) {
usb_put_dev (usb_dev);
return -ENODEV;
diff -Nru a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
--- a/drivers/usb/host/ohci-hcd.c Thu Jul 24 16:36:39 2003
+++ b/drivers/usb/host/ohci-hcd.c Thu Jul 24 16:36:39 2003
@@ -538,7 +538,6 @@
return -ENOMEM;
}
- usb_connect (udev);
udev->speed = USB_SPEED_FULL;
if (hcd_register_root (&ohci->hcd) != 0) {
usb_put_dev (udev);
diff -Nru a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
--- a/drivers/usb/host/uhci-hcd.c Thu Jul 24 16:36:39 2003
+++ b/drivers/usb/host/uhci-hcd.c Thu Jul 24 16:36:39 2003
@@ -2336,7 +2336,6 @@
/* disable legacy emulation */
pci_write_config_word(hcd->pdev, USBLEGSUP, USBLEGSUP_DEFAULT);
- usb_connect(udev);
udev->speed = USB_SPEED_FULL;
if (usb_register_root_hub(udev, &hcd->pdev->dev) != 0) {
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel