lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1112131405560.1192-100000@iolanthe.rowland.org>
Date:	Tue, 13 Dec 2011 14:07:44 -0500 (EST)
From:	Alan Stern <stern@...land.harvard.edu>
To:	Lin Ming <ming.m.lin@...el.com>
cc:	Jeff Garzik <jgarzik@...ox.com>,
	James Bottomley <JBottomley@...allels.com>,
	Tejun Heo <tj@...nel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-ide@...r.kernel.org" <linux-ide@...r.kernel.org>,
	"linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
	"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
	"Rafael J. Wysocki" <rjw@...k.pl>,
	"Huang, Ying" <ying.huang@...el.com>,
	"Zhang, Rui" <rui.zhang@...el.com>
Subject: Re: [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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ