Re: [PATCH 2/3] USB/ACPI: Add usb port's acpi power control in the xhci PORT_POWER feature request process.
From: Sarah Sharp <hidden>
Date: 2012-06-13 21:35:20
From: Sarah Sharp <hidden>
Date: 2012-06-13 21:35:20
On Wed, Jun 13, 2012 at 05:10:43PM -0400, Alan Stern wrote:
On Wed, 13 Jun 2012, Greg KH wrote:quoted
quoted
--- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c@@ -728,6 +728,11 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, temp = xhci_readl(xhci, port_array[wIndex]); xhci_dbg(xhci, "set port power, actual port %d status = 0x%x\n", wIndex, temp); + + if (usb_acpi_power_manageable(hcd->self.root_hub, + wIndex + 1))Why +1? If you have to do this everywhere, then do it only in the function, so you can be 0 based properly.This is an awkward matter. The USB spec numbers hub ports starting from 1, and so do several of the functions in usbcore, in order to match the spec. But of course, all our internal arrays are indexed starting from 0. The cleanest solution here might be to keep wIndex as an origin-0 value and create an origin-1 temporary variable (like hub.c does with "port1").
Oh, is that why it's named port1? I could never understand why. :) Sarah Sharp