RE: [PATCH v2 2/2] Adds new device resume mode in PM core, async plus non-blocking

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

 



Hi, will do, thanks for the feedback. I used the goto to make the code addition smaller, but I obviously sacrificed code clarity.

________________________________________
From: Greg Kroah-Hartman [gregkh@xxxxxxxxxxxxxxxxxxx]
Sent: Friday, May 17, 2013 12:11 PM
To: Brandt, Todd E
Cc: linux-ide@xxxxxxxxxxxxxxx; linux-scsi@xxxxxxxxxxxxxxx; linux-pm@xxxxxxxxxxxxxxx; Jeff Garzik; Jens Axboe; Wysocki, Rafael J; Arjan van de Ven
Subject: Re: [PATCH v2 2/2] Adds new device resume mode in PM core, async plus non-blocking

On Fri, May 17, 2013 at 07:05:33PM +0000, Brandt, Todd E wrote:
> Updates the drivers/base/power subsystem to allow any devices which
> have registred as asynchronous and who have not registered "complete"
> callbacks to be non-blocking. i.e system resume can finish and return
> control to the user while these devices continue resuming.
>
> Changelog:
> v2:
>         - Updated patch submission. Incorporates comments from Tejun Heo.
>           Fixed comment format, removed camelcase. No functional changes.
>
> Signed-off-by: Todd Brandt <todd.e.brandt@xxxxxxxxx>
> ---
>  drivers/base/power/main.c |   20 ++++++++++++++++----
>  1 file changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
> index 2b7f77d..1b16379 100644
> --- a/drivers/base/power/main.c
> +++ b/drivers/base/power/main.c
> @@ -713,7 +713,6 @@ void dpm_resume(pm_message_t state)
>               put_device(dev);
>       }
>       mutex_unlock(&dpm_list_mtx);
> -     async_synchronize_full();
>       dpm_show_time(starttime, state, NULL);
>  }
>
> @@ -726,11 +725,14 @@ static void device_complete(struct device *dev, pm_message_t state)
>  {
>       void (*callback)(struct device *) = NULL;
>       char *info = NULL;
> +     bool hascb = false;

"hascb"?  Please spell out what this is.

>
>       if (dev->power.syscore)
>               return;
>
> -     device_lock(dev);
> + docomplete:
> +     if (hascb)
> +             device_lock(dev);
>
>       if (dev->pm_domain) {
>               info = "completing power domain ";
> @@ -751,13 +753,21 @@ static void device_complete(struct device *dev, pm_message_t state)
>               callback = dev->driver->pm->complete;
>       }
>
> +     /*
> +      * if a callback exists, lock the device and call it
> +      * otherwise don't even lock/unlock the device
> +      */
>       if (callback) {
> +             if (!hascb) {
> +                     hascb = true;
> +                     goto docomplete;

You want to jump backwards?  This isn't the scheduler, please, you can
do better here.

thanks,

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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux