lkml.org 
[lkml]   [2011]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 5/6] ata: add ata port system PM callbacks
On Wed, 14 Dec 2011, Lin Ming wrote:

> > This suggests that the PM core is not the right place to solve the
> > problem. One possible solution is for the subsystem or device driver
> > to call pm_runtime_get_sync(dev->parent) at the start of the
> > system-resume procedure and pm_runtime_put_sync(dev->parent) at the
> > end.
>
> How about below?
> (Not tested yet)
>
> diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c
> index a633076..5cf9a19 100644
> --- a/drivers/scsi/scsi_pm.c
> +++ b/drivers/scsi/scsi_pm.c
> @@ -71,9 +71,17 @@ static int scsi_bus_suspend_common(struct device *dev, pm_message_t msg)
> static int scsi_bus_resume_common(struct device *dev)
> {
> int err = 0;
> + bool put = false;
>
> - if (scsi_is_sdev_device(dev))
> + if (scsi_is_sdev_device(dev)) {
> + if (dev->parent && pm_runtime_suspended(dev->parent)) {
> + pm_runtime_get_sync(dev->parent);
> + put = true;
> + }

You don't need to test anything. Always call pm_runtime_get_sync().

> err = scsi_dev_type_resume(dev);
> + if (put)
> + pm_runtime_put_sync(dev->parent);

Same here.

> + }
>
> if (err == 0) {
> pm_runtime_disable(dev);

Alan Stern



\
 
 \ /
  Last update: 2011-12-13 20:11    [W:0.051 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site