Re: [PATCH 2/4] usb: introduce usb force power off mechanism

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2013/3/28 2:45, Alan Stern wrote:
+int usb_hub_port_power_reset(struct usb_device *hdev, int port1)
+{
+	struct usb_hub *hub = usb_hub_to_struct_hub(hdev);
+	struct usb_interface *intf = to_usb_interface(hub->intfdev);
+	int ret;
+
+	usb_autopm_get_interface(intf);

What happens if hdev is NULL?
Yes, This will be a problem. The repower cmd to root
hub should be ignored.


+	hub_port_logical_disconnect(hub, port1);
+	ret = usb_hub_set_port_power(hdev, port1, false);

How long do you think the power should remain turned off?  This code
will leave it off for only a few milliseconds at most.  That may not
even be long enough for the voltage to drop all the way to 0.

The delay probably should be at least 100 ms.  Maybe more, I don't
know.
I think this depends on the device. I don't find the answer on spec.
I find the cool down delay of over-current for port is 100ms
and one for hub is 500ms. Could we reference these delay?
500ms would be safe.

+	ret |= usb_hub_set_port_power(hdev, port1, true);

Don't use |=.  Skip the second call if the first one fails.

OK.
+	usb_autopm_put_interface(intf);
+
+	return ret;
+}

If you placed this function later on in the source file, you wouldn't
need the forward declaration of hub_port_logical_disconnect().
Yes, I will do this.

Alan Stern


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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux