> -----Original Message-----
> From: Borislav Petkov [mailto:[email protected]]
> Sent: Wednesday, December 12, 2012 6:52 PM


> > It looks like azx_runtime_suspend() is new in 3.7 and it returns
> > -EAGAIN to indicate that it actually can't be suspended (if my
> > understanding the code is correct).  However, it shouldn't do that,
> > because that causes the runtime PM core to repeat the attempts.  It
> > rather should implement a .runtime_idle() callback returning an error code
> instead.


Hi Boris and Rafael,

I remember I didn't observed repetitive attempts to suspend if the 
azx_runtime_suspend() returns -EAGAIN.

Because the HD-A driver does not implement the runtime idle callback, 
pci_pm_runtime_idle() will call pm_runtime_suspend(dev),
and then __pm_runtime_suspend(dev, 0) will be called. 
Finally the code will go to 'fail' of rpm_suspend: 
...
fail:
        __update_runtime_status(dev, RPM_ACTIVE);
        dev->power.deferred_resume = false;
        wake_up_all(&dev->power.wait_queue);

        if (retval == -EAGAIN || retval == -EBUSY) {
                dev->power.runtime_error = 0;
                ...
                if ((rpmflags & RPM_AUTO) &&
                    pm_runtime_autosuspend_expiration(dev) != 0)      ... but 
since the rpmflags is 0, the code will not go to 'repeat' but to 'out'.
                        goto repeat;
        } else {
                pm_runtime_cancel_pending(dev);
        }
        goto out;

Please correct me if I misunderstand something.

Thanks
Mengdong

Reply via email to