On 2012年11月12日 10:41, Alan Stern wrote: > On Mon, 12 Nov 2012, Lan Tianyu wrote: > >>>> I think port and device are bound. Power off port also means to power >>>> off device. So prevent device from power off also means to prevent port >>>> from power off. They just like a power domain. Because power is on the >>>> port and so I thought we just needed to have pm qos flag on the port. >>> >>> Consider what happens when the device is unplugged. The restriction >>> against powering off the device won't be needed any more, but the PM >>> QOS flag will still be set for the port. >> You are saying outside port. For outside port, currently our plan is to >> set NO_POWER_OFF flag defaultly. So it doesn't matter after device >> unplugged. > > What if the user changes the NO_POWER_OFF flag? It's only a default, > so it can be changed. > > Once we have the PM QOS flag, do we need the NO_POWER_OFF flag any > more? Sorry, I didn't express clear. I mean the NO_POWER_OFF flag in the PM qos flags. > >> Moreover, we can change the port's pm qos flag when device is >> disconnected. > > But what if the user wants that port to remain powered on even after > the device is disconnected? It seems to me the user might have good > reasons to want to change the power-off behavior for a particular > device, _or_ to change the power-off behavior for a particular port > regardless of what device is plugged into it. Yeah. You are right. User can keep their choice. In the pm core, there is already a pm qos flags request which represent user choice. I add the new request to represent driver's choice. Only when both two request are not set pm qos NO_POWER_OFF flag, the effective flag maintains 0. If user set the flag but driver says the device can power off. The result is that the effective flag is set so the device will not be power off. As long as user set the flag, the device or port will not power off. >From my opinion, we can clear the flag of the new request I added when a device is disconnected. So when user also keep the flag unset and device is disconnected, then the port can be power off. > > Alan Stern > -- Best regards Tianyu Lan -- 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