[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <500D615C.1080605@mvista.com>
Date: Mon, 23 Jul 2012 18:36:12 +0400
From: Sergei Shtylyov <sshtylyov@...sta.com>
To: Aaron Lu <aaron.lu@....com>
CC: Jeff Garzik <jgarzik@...ox.com>,
Alan Stern <stern@...land.harvard.edu>,
Lin Ming <minggr@...il.com>, linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org, linux-scsi@...r.kernel.org,
linux-ide@...r.kernel.org, Aaron Lu <aaron.lwe@...il.com>
Subject: Re: [PATCH 4/5] scsi: pm: use runtime resume callback if available
Hello.
On 07/23/2012 10:49 AM, Aaron Lu wrote:
> When runtime resume a scsi device, if the device's driver has
> implemented runtime resume callback, use that instead of the resume
> callback.
> sr driver needs this to properly do different things for system resume
> and runtime resume.
> Signed-off-by: Aaron Lu <aaron.lu@....com>
> ---
> drivers/scsi/scsi_pm.c | 14 +++++++++-----
> drivers/scsi/sr.c | 21 +++++++++++++++++++++
> 2 files changed, 30 insertions(+), 5 deletions(-)
> diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c
> index d4201de..19bba47 100644
> --- a/drivers/scsi/scsi_pm.c
> +++ b/drivers/scsi/scsi_pm.c
> @@ -34,14 +34,18 @@ static int scsi_dev_type_suspend(struct device *dev, pm_message_t msg)
> return err;
> }
>
> -static int scsi_dev_type_resume(struct device *dev)
> +static int scsi_dev_type_resume(struct device *dev, bool runtime)
> {
> struct device_driver *drv;
> int err = 0;
> + int (*resume)(struct device *);
>
> drv = dev->driver;
> - if (drv && drv->resume)
> - err = drv->resume(dev);
> + if (runtime && drv && drv->pm && drv->pm->runtime_resume)
> + resume = drv->pm->runtime_resume;
> + else
> + resume = drv ? drv->resume : NULL;
Call thru NULL pointer below will cause kernel oops. Is it your intention?
> + err = resume(dev);
WBR, Sergei
--
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