[linux-pm] [PATCH] Runtime PM: Adding explicit check to make sure dev->parent supports runtime PM before accessing its PM fields.

Alan Stern stern at rowland.harvard.edu
Fri Dec 4 18:43:20 PST 2009


On Sat, 5 Dec 2009, Mahalingam, Nithish wrote:

> > The most troublesome case arises when you have a parent which is 
> > disabled for runtime PM and later on becomes enabled.  This may not 
> > happen very often -- it may not happen at all.  I would expect that if 
> > a device changes from disabled to enabled, it probably does so before 
> > acquiring any children.  But we can't be certain of this.
> 
> OK, get what you are saying. I was thinking of a particular use case and 
> before I talk about that let me prototype and see if I hit this 
> particular case.

All right.  If it does turn out that devices _never_ change from 
disabled to enabled while they have children (we could add a check for 
this!) then you are right -- it's not necessary to update 
parent->power.child_count if the parent is disabled.

But the only way to be sure it will never happen is to forbid it
explicitly in the documentation.

Alan Stern



More information about the linux-pm mailing list