On Mon, 8 Apr 2013, Lan Tianyu wrote: > Hi Alan: > I think current code can't achieve that power off port(whose > child device was already suspended but it was not powered off due to > NO_POWER_OFF flag setting.) via clearing NO_POWER_OFF flag. Because > at that moment, its usage count can't be 0. At last, it should be > 1 or large. port's pm_runtime_idle will not be called. > > Further thinking, now we call pm_runtime_put_sync() in the > usb_port_suspend() when persist enable, do_remote_wakeup disable and > PM Qos NO_POWER_OFF flag cleared. But PM Qos NO_POWER_OFF flag will > also will be checked in the usb_port_runtime_suspend(). This seems > redundant. > > From my opinion, the PM Qos check in the usb_port_suspend() > should be removed and port usage count will reach 0 when persist enable > and remote_wakeup disable. Whether power off or not totally depends on > the PM Qos flag in the usb_port_runtime_suspend(). For NO_POWER_OFF flag > setting case during usb device being suspend, the port's usage count > will be 0 but its runtime status is still active due to flag being set > and usb_port_runtime_suspend() returns -EAGAIN. At this time, clearing > the flag and the port can be powered off. Does this make sense? Yes, that's the right thing to do. Alan Stern -- 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