Re: Runtime PM: Calling Device runtime PM callbacks?

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

 



On Saturday 19 December 2009, Alan Stern wrote:
> On Sat, 19 Dec 2009, Rafael J. Wysocki wrote:
> 
> > On Tuesday 15 December 2009, Rafael J. Wysocki wrote:
> > > On Tuesday 15 December 2009, Alan Stern wrote:
> > > > On Tue, 15 Dec 2009, Rafael J. Wysocki wrote:
> > ...
> > > 
> > > > > Now, if we agree that only one callback will be called for given device
> > > > > (either bus type, or device type, or device class), the code may be simpler
> > > > > and there won't be an issue with the ordering in _idle.
> > > > 
> > > > That would be perfectly fine with me.
> > > 
> > > OK
> > 
> > Updated patch is appended, please tell me what you think.
> 
> Yes, this is the sort of thing I had in mind.  Although it might be
> nice to avoid all the repeated code.  For example, you might add a
> helper routine:
> 
> 	static int invoke_callback(struct device *dev,
> 			int (*func)(struct device *))
> 	{
> 		int retval;
> 
> 		spin_unlock_irq(&dev->power.lock);
> 		retval = func(dev);
> 		spin_lock_irq(&dev->power.lock);
> 		return retval;
> 	}

The problem with dev->power.runtime_error would reappear in
that case and I think the "unlock, do something, lock" structure looks odd. :-)

The only things repeated are unlocking, locking and
"dev->power.runtime_error = retval", which I think is not too much ...

Rafael
_______________________________________________
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