Re: [PATCH v5 5/6] ata: add ata port system PM callbacks

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

 



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

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux