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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html