On Wed, Dec 05, 2012 at 11:55:59AM -0500, Alan Stern wrote:
> On Tue, 4 Dec 2012, Sarah Sharp wrote:
> > +static int hub_set_port_link_state(struct usb_hub *hub, int port1,
> > + unsigned int link_status)
> > +{
> > + return set_port_feature(hub->hdev,
> > + port1 | (link_status << 3),
>
> Shouldn't this be << 8?
The port link state values defined in ch11.h are already right shifted
by 5. Basically, they're designed so you can mask off bits 5-8
returned by the Get Port Status hub request and directly compare those
macros to the result. For example, the USB 3.0 spec says that a 0x1 in
bits 5-8 means the link state is U1, but USB_SS_PORT_LS_U1 is defined as
0x0020.
I was basically copying code like this in hub.c:
/* see 7.1.7.6 */
if (hub_is_superspeed(hub->hdev))
status = set_port_feature(hub->hdev,
port1 | (USB_SS_PORT_LS_U3 << 3),
USB_PORT_FEAT_LINK_STATE);
I was going to convert that code to use hub_set_port_link_state, but didn't get
around to it in this patchset.
Sarah Sharp
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html