Re: runtime PM: common hooks for static and runtime PM

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

 



On Fri, 5 Feb 2010, Mark Brown wrote:

> > As you have found out, that approach doesn't work.  You need to figure
> > out some way of your own to avoid double disabling.  The PM core can't
> > do it for you, because there may be devices that enter _different_
> > power states for runtime suspend and system suspend.  For the sake of 
> > such devices the core _has_ to do double suspends.
> 
> Right, but my point is that one reason for wanting to call into the
> runtime PM API during vanilla suspend is that the indirection buys you
> the reference counting.

It's not reference counting; it's just a state variable.  (There _is_ a
reference counter involved, but you don't want to use it.)

> I wonder if it's worth the PM core providing an off the shelf suspend
> and resume via runtime PM implementation so drivers only need to assign
> function pointers?  As Kevin says this is going to be *very* common for
> embedded drivers.

What's so hard about doing this?

	int my_suspend(struct device *dev)
	{
		if (dev->power.runtime_status == RPM_SUSPENDED)
			return 0;
		return my_runtime_suspend(dev);
	}

Or if you prefer, stick the "if" statement at the beginning of your 
suspend method and then set both function pointers to the same method.

Alan Stern

_______________________________________________
linux-pm mailing list
linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/linux-pm

[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux