On Wed, Jan 4, 2017 at 6:03 PM, Alexandre Bailon <abai...@baylibre.com> wrote:
> Sometime, a transfer may not be queued due to a race between runtime pm
> and cppi41_dma_issue_pending().
> Sometime, cppi41_runtime_resume() may be interrupted right before to
> update device PM state to RESUMED.
> When it happens, if a new dma transfer is issued, because the device is not
> in active state, the descriptor will be added to the pendding list.
> But because the descriptors in the pendding list are only queued to cppi41
> on runtime resume, the descriptor will not be queued.
> On runtime suspend, the list is not empty, which is causing a warning.
> Queue the descriptor if the device is active or resuming.

> -       if (likely(pm_runtime_active(cdd->ddev.dev)))
> +       active = pm_runtime_active(cdd->ddev.dev);
> +       if (!active) {
> +               /*
> +                * Runtime resume may be interrupted before runtime_status
> +                * has been updated. Test if device has resumed.
> +                */
> +               if (error == -EINPROGRESS) {
> +                       spin_lock_irqsave(&cdd->lock, flags);

> +                       if (list_empty(&cdd->pending))
> +                               active = true;

active = !!list_empty();

> +                       spin_unlock_irqrestore(&cdd->lock, flags);
> +               }
> +       }
> +
> +       if (likely(active))
>                 push_desc_queue(c);
>         else
>                 pending_desc(c);

-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to