Re: [PATCH 01/10] USB: Set usb port's DeviceRemovable according acpi information in EHCI

2012-12-05 Thread Alan Stern
On Wed, 5 Dec 2012, Lan Tianyu wrote:

 Hi Alan:
   how about following patch?
 
 Index: usb/drivers/usb/core/hub.c
 ===
 --- usb.orig/drivers/usb/core/hub.c
 +++ usb/drivers/usb/core/hub.c

 +void usb_hub_adjust_DeviceRemovable(struct usb_device *hdev,
 +   struct usb_hub_descriptor *desc)
 +{
 +   enum usb_port_connect_type connect_type;
 +   int i;
 +
 +   if (!hub_is_superspeed(hdev)) {
 +   for (i = 1; i = hdev-maxchild; i++) {
 +   connect_type =
 +   usb_get_hub_port_connect_type(hdev, i);
 +
 +   if (connect_type ==
 USB_PORT_CONNECT_TYPE_HARD_WIRED) {
 +   u8 mask = 1  (i%8);
 +
 +   if (!(desc-u.hs.DeviceRemovable[i/8] 
 mask))
 +   dev_dbg(hdev-dev, usb2.0

There's no need to specify usb2.0.  The kernel log already mentions 
the hub's speed.

 port%d's DeviceRemovable is changed to 1 according platform
 information.\n, i);

s/according/according to/

 +
 +   desc-u.hs.DeviceRemovable[i/8]
 +   |= mask;

You might as well put this line inside the if statement.

 +   }
 +   }
 +   } else {
 +   u16 port_removable =
 +   le16_to_cpu(desc-u.ss.DeviceRemovable);
 +
 +   for (i = 1; i = hdev-maxchild; i++) {
 +   connect_type =
 +   usb_get_hub_port_connect_type(hdev, i);
 +
 +   if (connect_type ==
 USB_PORT_CONNECT_TYPE_HARD_WIRED) {
 +   u16 mask = 1  i;
 +
 +   if (!(port_removable  mask))
 +   dev_dbg(hdev-dev, usb3.0
 port%d's DeviceRemovable is changed to 1 according platform
 information.\n, i);
 +
 +   port_removable |= mask;

Same comments here.

 +   }
 +   }
 +
 +   desc-u.ss.DeviceRemovable =
 +   cpu_to_le16(port_removable);
 +   }
 +}

The rest looks okay.  Remember to run your patches through checkpatch 
before submitting them.

Alan Stern

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/10] USB: Set usb port's DeviceRemovable according acpi information in EHCI

2012-12-05 Thread Lan Tianyu
On 2012年12月05日 23:58, Alan Stern wrote:
 On Wed, 5 Dec 2012, Lan Tianyu wrote:
 
 Hi Alan:
  how about following patch?

 Index: usb/drivers/usb/core/hub.c
 ===
 --- usb.orig/drivers/usb/core/hub.c
 +++ usb/drivers/usb/core/hub.c
 
 +void usb_hub_adjust_DeviceRemovable(struct usb_device *hdev,
 +   struct usb_hub_descriptor *desc)
 +{
 +   enum usb_port_connect_type connect_type;
 +   int i;
 +
 +   if (!hub_is_superspeed(hdev)) {
 +   for (i = 1; i = hdev-maxchild; i++) {
 +   connect_type =
 +   usb_get_hub_port_connect_type(hdev, i);
 +
 +   if (connect_type ==
 USB_PORT_CONNECT_TYPE_HARD_WIRED) {
 +   u8 mask = 1  (i%8);
 +
 +   if (!(desc-u.hs.DeviceRemovable[i/8] 
 mask))
 +   dev_dbg(hdev-dev, usb2.0
 
 There's no need to specify usb2.0.  The kernel log already mentions 
 the hub's speed.
 
 port%d's DeviceRemovable is changed to 1 according platform
 information.\n, i);
 
 s/according/according to/
 
 +
 +   desc-u.hs.DeviceRemovable[i/8]
 +   |= mask;
 
 You might as well put this line inside the if statement.
 
 +   }
 +   }
 +   } else {
 +   u16 port_removable =
 +   le16_to_cpu(desc-u.ss.DeviceRemovable);
 +
 +   for (i = 1; i = hdev-maxchild; i++) {
 +   connect_type =
 +   usb_get_hub_port_connect_type(hdev, i);
 +
 +   if (connect_type ==
 USB_PORT_CONNECT_TYPE_HARD_WIRED) {
 +   u16 mask = 1  i;
 +
 +   if (!(port_removable  mask))
 +   dev_dbg(hdev-dev, usb3.0
 port%d's DeviceRemovable is changed to 1 according platform
 information.\n, i);
 +
 +   port_removable |= mask;
 
 Same comments here.
 
 +   }
 +   }
 +
 +   desc-u.ss.DeviceRemovable =
 +   cpu_to_le16(port_removable);
 +   }
 +}
 
 The rest looks okay.  Remember to run your patches through checkpatch 
 before submitting them.
Ok. I get it.
 
 Alan Stern
 


-- 
Best regards
Tianyu Lan
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/10] USB: Set usb port's DeviceRemovable according acpi information in EHCI

2012-12-04 Thread Lan Tianyu
On 2012年11月29日 08:08, Alan Stern wrote:
 On Wed, 28 Nov 2012, Sarah Sharp wrote:
 
 The shared code to overwrite the bits should probably print a warning if
 the host and ACPI bits differ.

 I'm not so sure about that.  For one thing, who wants warnings to be 
 logged every time they run lsusb -v?

 Yeah, that's probably not a great idea.

 Also, this sort of thing might be more common than you might expect.  
 I'd guess that if the ACPI information contains anything useful at all, 
 it will be different from the [Ex]HCI information.

 Tianyu's patches log such warnings for xHCI but not for EHCI.  That 
 inconsistency is another reason to rework them.

 Tianyu did that because I asked him to for xHCI.  I didn't think about
 the lsusb implications.  You're right that it will probably be annoying
 to the user, so he should just drop the warning in the shared code.
 
 It could be changed to a dev_dbg.  That wouldn't bother people and it 
 might be useful.
 
 Alan Stern
 
Hi Alan:
how about following patch?

Index: usb/drivers/usb/core/hub.c
===
--- usb.orig/drivers/usb/core/hub.c
+++ usb/drivers/usb/core/hub.c
@@ -1441,6 +1441,8 @@ static int hub_configure(struct usb_hub
dev_err(hub-intfdev,
couldn't create port%d device.\n, i + 1);

+   usb_hub_adjust_DeviceRemovable(hdev, hub-descriptor);
+
hub_activate(hub, HUB_INIT);
return 0;

@@ -5086,8 +5088,56 @@ usb_get_hub_port_connect_type(struct usb
 {
struct usb_hub *hub = hdev_to_hub(hdev);

+   if (!hub)
+   return USB_PORT_CONNECT_TYPE_UNKNOWN;
+
return hub-ports[port1 - 1]-connect_type;
 }
+EXPORT_SYMBOL_GPL(usb_get_hub_port_connect_type);
+
+void usb_hub_adjust_DeviceRemovable(struct usb_device *hdev,
+   struct usb_hub_descriptor *desc)
+{
+   enum usb_port_connect_type connect_type;
+   int i;
+
+   if (!hub_is_superspeed(hdev)) {
+   for (i = 1; i = hdev-maxchild; i++) {
+   connect_type =
+   usb_get_hub_port_connect_type(hdev, i);
+
+   if (connect_type ==
USB_PORT_CONNECT_TYPE_HARD_WIRED) {
+   u8 mask = 1  (i%8);
+
+   if (!(desc-u.hs.DeviceRemovable[i/8] 
mask))
+   dev_dbg(hdev-dev, usb2.0
port%d's DeviceRemovable is changed to 1 according platform
information.\n, i);
+
+   desc-u.hs.DeviceRemovable[i/8]
+   |= mask;
+   }
+   }
+   } else {
+   u16 port_removable =
+   le16_to_cpu(desc-u.ss.DeviceRemovable);
+
+   for (i = 1; i = hdev-maxchild; i++) {
+   connect_type =
+   usb_get_hub_port_connect_type(hdev, i);
+
+   if (connect_type ==
USB_PORT_CONNECT_TYPE_HARD_WIRED) {
+   u16 mask = 1  i;
+
+   if (!(port_removable  mask))
+   dev_dbg(hdev-dev, usb3.0
port%d's DeviceRemovable is changed to 1 according platform
information.\n, i);
+
+   port_removable |= mask;
+   }
+   }
+
+   desc-u.ss.DeviceRemovable =
+   cpu_to_le16(port_removable);
+   }
+}

 #ifdef CONFIG_ACPI
 /**
Index: usb/drivers/usb/core/usb.h
===
--- usb.orig/drivers/usb/core/usb.h
+++ usb/drivers/usb/core/usb.h
@@ -1,5 +1,6 @@
 #include linux/pm.h
 #include linux/acpi.h
+#include linux/usb/ch11.h

 struct dev_state;

@@ -169,10 +170,13 @@ extern void usb_notify_add_device(struct
 extern void usb_notify_remove_device(struct usb_device *udev);
 extern void usb_notify_add_bus(struct usb_bus *ubus);
 extern void usb_notify_remove_bus(struct usb_bus *ubus);
+
 extern enum usb_port_connect_type
usb_get_hub_port_connect_type(struct usb_device *hdev, int port1);
 extern void usb_set_hub_port_connect_type(struct usb_device *hdev, int
port1,
enum usb_port_connect_type type);
+extern void usb_hub_adjust_DeviceRemovable(struct usb_device *hdev,
+   struct usb_hub_descriptor *desc);

 #ifdef CONFIG_ACPI
 extern int usb_acpi_register(void);
Index: usb/drivers/usb/core/hcd.c
===
--- usb.orig/drivers/usb/core/hcd.c
+++ usb/drivers/usb/core/hcd.c
@@ -619,6 +619,10 @@ nongeneric:
status = hcd-driver-hub_control (hcd,
typeReq, wValue, wIndex,
tbuf, wLength);
+
+   if (typeReq == GetHubDescriptor)
+   usb_hub_adjust_DeviceRemovable(hcd-self.root_hub,
+   

Re: [PATCH 01/10] USB: Set usb port's DeviceRemovable according acpi information in EHCI

2012-11-28 Thread Alan Stern
On Sat, 17 Nov 2012, Lan Tianyu wrote:

 ACPI provide _PLD and _UPC aml methods to describe usb port
 visibility and connectability. This patch is to use those information
 to change ehci root hub descriptors and set usb hub port's DeviceRemovable
 in the hub_configure(). When hub descriptor request is issued at first time,
 usb port device isn't created and usb port is not bound with acpi. So first
 hub descriptor request is not changed based on ACPI information. After usb
 port device being created, set hub port's DeviceRemovable according ACPI
 information and this also works for non-root hub.

I think this patch, and patch 2/10, can both be improved.

 --- a/drivers/usb/core/hub.c
 +++ b/drivers/usb/core/hub.c
 @@ -1546,6 +1546,25 @@ static int hub_configure(struct usb_hub *hub,
   dev_err(hub-intfdev,
   couldn't create port%d device.\n, i + 1);
  
 + if (!hub_is_superspeed(hdev)) {
 + for (i = 1; i = hdev-maxchild; i++)
 + if (hub-ports[i - 1]-connect_type
 + == USB_PORT_CONNECT_TYPE_HARD_WIRED)
 + hub-descriptor-u.hs.DeviceRemovable[i/8]
 + |= 1  (i%8);
 + } else {
 + u16 port_removable =
 + le16_to_cpu(hub-descriptor-u.ss.DeviceRemovable);
 +
 + for (i = 1; i = hdev-maxchild; i++)
 + if (hub-ports[i - 1]-connect_type
 + == USB_PORT_CONNECT_TYPE_HARD_WIRED)
 + port_removable |= 1  i;
 +
 + hub-descriptor-u.ss.DeviceRemovable =
 + cpu_to_le16(port_removable);
 + }
 +

You've got all this code here, and you added copies of the same thing
to ehci-hcd and xhci-hcd.  That's wasteful, and it also ignores the
other HCDs.

Instead, how about sticking the new code into a separate function: 

void hub_adjust_DeviceRemovable(struct usb_device *hdev,
struct usb_hub_descriptor *desc);

Call this new function here and at the appropriate place in
hcd.c:rh_call_control().  Then no modifications would be needed in 
ehci-hcd or xhci-hcd.

Alan Stern

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/10] USB: Set usb port's DeviceRemovable according acpi information in EHCI

2012-11-28 Thread Sarah Sharp
On Wed, Nov 28, 2012 at 12:39:14PM -0500, Alan Stern wrote:
 On Sat, 17 Nov 2012, Lan Tianyu wrote:
  --- a/drivers/usb/core/hub.c
  +++ b/drivers/usb/core/hub.c
  @@ -1546,6 +1546,25 @@ static int hub_configure(struct usb_hub *hub,
  dev_err(hub-intfdev,
  couldn't create port%d device.\n, i + 1);
   
  +   if (!hub_is_superspeed(hdev)) {
  +   for (i = 1; i = hdev-maxchild; i++)
  +   if (hub-ports[i - 1]-connect_type
  +   == USB_PORT_CONNECT_TYPE_HARD_WIRED)
  +   hub-descriptor-u.hs.DeviceRemovable[i/8]
  +   |= 1  (i%8);
  +   } else {
  +   u16 port_removable =
  +   le16_to_cpu(hub-descriptor-u.ss.DeviceRemovable);
  +
  +   for (i = 1; i = hdev-maxchild; i++)
  +   if (hub-ports[i - 1]-connect_type
  +   == USB_PORT_CONNECT_TYPE_HARD_WIRED)
  +   port_removable |= 1  i;
  +
  +   hub-descriptor-u.ss.DeviceRemovable =
  +   cpu_to_le16(port_removable);
  +   }
  +
 
 You've got all this code here, and you added copies of the same thing
 to ehci-hcd and xhci-hcd.  That's wasteful, and it also ignores the
 other HCDs.
 
 Instead, how about sticking the new code into a separate function: 
 
 void hub_adjust_DeviceRemovable(struct usb_device *hdev,
   struct usb_hub_descriptor *desc);
 
 Call this new function here and at the appropriate place in
 hcd.c:rh_call_control().  Then no modifications would be needed in 
 ehci-hcd or xhci-hcd.

So you would basically let EHCI and xHCI set the DeviceRemovable bits in
their hub descriptors and then have the USB core overwrite them?  If a
userspace program like lsusb asks for the hub descriptors, would they
see the updated version, or the original version?

The shared code to overwrite the bits should probably print a warning if
the host and ACPI bits differ.

Sarah Sharp
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/10] USB: Set usb port's DeviceRemovable according acpi information in EHCI

2012-11-28 Thread Alan Stern
On Wed, 28 Nov 2012, Sarah Sharp wrote:

 On Wed, Nov 28, 2012 at 12:39:14PM -0500, Alan Stern wrote:
  On Sat, 17 Nov 2012, Lan Tianyu wrote:
   --- a/drivers/usb/core/hub.c
   +++ b/drivers/usb/core/hub.c
   @@ -1546,6 +1546,25 @@ static int hub_configure(struct usb_hub *hub,
 dev_err(hub-intfdev,
 couldn't create port%d device.\n, i + 1);

   + if (!hub_is_superspeed(hdev)) {
   + for (i = 1; i = hdev-maxchild; i++)
   + if (hub-ports[i - 1]-connect_type
   + == USB_PORT_CONNECT_TYPE_HARD_WIRED)
   + hub-descriptor-u.hs.DeviceRemovable[i/8]
   + |= 1  (i%8);
   + } else {
   + u16 port_removable =
   + le16_to_cpu(hub-descriptor-u.ss.DeviceRemovable);
   +
   + for (i = 1; i = hdev-maxchild; i++)
   + if (hub-ports[i - 1]-connect_type
   + == USB_PORT_CONNECT_TYPE_HARD_WIRED)
   + port_removable |= 1  i;
   +
   + hub-descriptor-u.ss.DeviceRemovable =
   + cpu_to_le16(port_removable);
   + }
   +
  
  You've got all this code here, and you added copies of the same thing
  to ehci-hcd and xhci-hcd.  That's wasteful, and it also ignores the
  other HCDs.
  
  Instead, how about sticking the new code into a separate function: 
  
  void hub_adjust_DeviceRemovable(struct usb_device *hdev,
  struct usb_hub_descriptor *desc);
  
  Call this new function here and at the appropriate place in
  hcd.c:rh_call_control().  Then no modifications would be needed in 
  ehci-hcd or xhci-hcd.
 
 So you would basically let EHCI and xHCI set the DeviceRemovable bits in
 their hub descriptors and then have the USB core overwrite them?

It's not an overwrite, it's an |=.  Anyway, that's what Tianyu's 
patches already do; I'm merely suggesting that he rearrange the code to 
avoid duplication.

  If a
 userspace program like lsusb asks for the hub descriptors, would they
 see the updated version, or the original version?

With either Tianyu's original series or my suggested revision, the
program would see the updated version for root hubs and the original
version for non-root hubs.

 The shared code to overwrite the bits should probably print a warning if
 the host and ACPI bits differ.

I'm not so sure about that.  For one thing, who wants warnings to be 
logged every time they run lsusb -v?

Also, this sort of thing might be more common than you might expect.  
I'd guess that if the ACPI information contains anything useful at all, 
it will be different from the [Ex]HCI information.

Tianyu's patches log such warnings for xHCI but not for EHCI.  That 
inconsistency is another reason to rework them.

Alan Stern

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/10] USB: Set usb port's DeviceRemovable according acpi information in EHCI

2012-11-28 Thread Sarah Sharp
On Wed, Nov 28, 2012 at 01:56:46PM -0500, Alan Stern wrote:
 On Wed, 28 Nov 2012, Sarah Sharp wrote:
 
  On Wed, Nov 28, 2012 at 12:39:14PM -0500, Alan Stern wrote:
   Instead, how about sticking the new code into a separate function: 
   
   void hub_adjust_DeviceRemovable(struct usb_device *hdev,
 struct usb_hub_descriptor *desc);
   
   Call this new function here and at the appropriate place in
   hcd.c:rh_call_control().  Then no modifications would be needed in 
   ehci-hcd or xhci-hcd.
  
  So you would basically let EHCI and xHCI set the DeviceRemovable bits in
  their hub descriptors and then have the USB core overwrite them?
 
 It's not an overwrite, it's an |=.  Anyway, that's what Tianyu's 
 patches already do; I'm merely suggesting that he rearrange the code to 
 avoid duplication.

Ah, ok, sure.

   If a
  userspace program like lsusb asks for the hub descriptors, would they
  see the updated version, or the original version?
 
 With either Tianyu's original series or my suggested revision, the
 program would see the updated version for root hubs and the original
 version for non-root hubs.
 
  The shared code to overwrite the bits should probably print a warning if
  the host and ACPI bits differ.
 
 I'm not so sure about that.  For one thing, who wants warnings to be 
 logged every time they run lsusb -v?

Yeah, that's probably not a great idea.

 Also, this sort of thing might be more common than you might expect.  
 I'd guess that if the ACPI information contains anything useful at all, 
 it will be different from the [Ex]HCI information.
 
 Tianyu's patches log such warnings for xHCI but not for EHCI.  That 
 inconsistency is another reason to rework them.

Tianyu did that because I asked him to for xHCI.  I didn't think about
the lsusb implications.  You're right that it will probably be annoying
to the user, so he should just drop the warning in the shared code.

Sarah Sharp
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/10] USB: Set usb port's DeviceRemovable according acpi information in EHCI

2012-11-28 Thread Alan Stern
On Wed, 28 Nov 2012, Sarah Sharp wrote:

   The shared code to overwrite the bits should probably print a warning if
   the host and ACPI bits differ.
  
  I'm not so sure about that.  For one thing, who wants warnings to be 
  logged every time they run lsusb -v?
 
 Yeah, that's probably not a great idea.
 
  Also, this sort of thing might be more common than you might expect.  
  I'd guess that if the ACPI information contains anything useful at all, 
  it will be different from the [Ex]HCI information.
  
  Tianyu's patches log such warnings for xHCI but not for EHCI.  That 
  inconsistency is another reason to rework them.
 
 Tianyu did that because I asked him to for xHCI.  I didn't think about
 the lsusb implications.  You're right that it will probably be annoying
 to the user, so he should just drop the warning in the shared code.

It could be changed to a dev_dbg.  That wouldn't bother people and it 
might be useful.

Alan Stern

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/10] USB: Set usb port's DeviceRemovable according acpi information in EHCI

2012-11-17 Thread Lan Tianyu
ACPI provide _PLD and _UPC aml methods to describe usb port
visibility and connectability. This patch is to use those information
to change ehci root hub descriptors and set usb hub port's DeviceRemovable
in the hub_configure(). When hub descriptor request is issued at first time,
usb port device isn't created and usb port is not bound with acpi. So first
hub descriptor request is not changed based on ACPI information. After usb
port device being created, set hub port's DeviceRemovable according ACPI
information and this also works for non-root hub.

Signed-off-by: Lan Tianyu tianyu@intel.com
---
 drivers/usb/core/hub.c  |   23 +++
 drivers/usb/core/usb.h  |4 
 drivers/usb/host/ehci-hub.c |   11 +++
 include/linux/usb.h |4 
 4 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index a815fd2..57893d1f 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1546,6 +1546,25 @@ static int hub_configure(struct usb_hub *hub,
dev_err(hub-intfdev,
couldn't create port%d device.\n, i + 1);
 
+   if (!hub_is_superspeed(hdev)) {
+   for (i = 1; i = hdev-maxchild; i++)
+   if (hub-ports[i - 1]-connect_type
+   == USB_PORT_CONNECT_TYPE_HARD_WIRED)
+   hub-descriptor-u.hs.DeviceRemovable[i/8]
+   |= 1  (i%8);
+   } else {
+   u16 port_removable =
+   le16_to_cpu(hub-descriptor-u.ss.DeviceRemovable);
+
+   for (i = 1; i = hdev-maxchild; i++)
+   if (hub-ports[i - 1]-connect_type
+   == USB_PORT_CONNECT_TYPE_HARD_WIRED)
+   port_removable |= 1  i;
+
+   hub-descriptor-u.ss.DeviceRemovable =
+   cpu_to_le16(port_removable);
+   }
+
hub_activate(hub, HUB_INIT);
return 0;
 
@@ -5191,8 +5210,12 @@ usb_get_hub_port_connect_type(struct usb_device *hdev, 
int port1)
 {
struct usb_hub *hub = hdev_to_hub(hdev);
 
+   if (!hub)
+   return USB_PORT_CONNECT_TYPE_UNKNOWN;
+
return hub-ports[port1 - 1]-connect_type;
 }
+EXPORT_SYMBOL_GPL(usb_get_hub_port_connect_type);
 
 #ifdef CONFIG_ACPI
 /**
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index 1c528c1..1633f6e 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -169,10 +169,6 @@ extern void usb_notify_add_device(struct usb_device *udev);
 extern void usb_notify_remove_device(struct usb_device *udev);
 extern void usb_notify_add_bus(struct usb_bus *ubus);
 extern void usb_notify_remove_bus(struct usb_bus *ubus);
-extern enum usb_port_connect_type
-   usb_get_hub_port_connect_type(struct usb_device *hdev, int port1);
-extern void usb_set_hub_port_connect_type(struct usb_device *hdev, int port1,
-   enum usb_port_connect_type type);
 
 #ifdef CONFIG_ACPI
 extern int usb_acpi_register(void);
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 4ccb97c..a9d137f 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -662,6 +662,7 @@ ehci_hub_descriptor (
struct usb_hub_descriptor   *desc
 ) {
int ports = HCS_N_PORTS (ehci-hcs_params);
+   int i;
u16 temp;
 
desc-bDescriptorType = 0x29;
@@ -676,6 +677,16 @@ ehci_hub_descriptor (
memset(desc-u.hs.DeviceRemovable[0], 0, temp);
memset(desc-u.hs.DeviceRemovable[temp], 0xff, temp);
 
+   for (i = 1; i = ports; i++) {
+   struct usb_device *hdev = ehci_to_hcd(ehci)-self.root_hub;
+   enum usb_port_connect_type connect_type
+   = usb_get_hub_port_connect_type(hdev, i);
+
+   if (connect_type == USB_PORT_CONNECT_TYPE_HARD_WIRED)
+   desc-u.hs.DeviceRemovable[i/8] |= 1  (i%8);
+   }
+
+
temp = 0x0008;  /* per-port overcurrent reporting */
if (HCS_PPC (ehci-hcs_params))
temp |= 0x0001; /* per-port power control */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 689b14b..e996bb6 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -577,6 +577,10 @@ static inline struct usb_device 
*interface_to_usbdev(struct usb_interface *intf)
return to_usb_device(intf-dev.parent);
 }
 
+extern enum usb_port_connect_type
+   usb_get_hub_port_connect_type(struct usb_device *hdev, int port1);
+extern void usb_set_hub_port_connect_type(struct usb_device *hdev, int port1,
+   enum usb_port_connect_type type);
 extern struct usb_device *usb_get_dev(struct usb_device *dev);
 extern void usb_put_dev(struct usb_device *dev);
 extern struct usb_device *usb_hub_find_child(struct