Re: [PATCH v2 3/3] scsi: allow scsi devices to use direct complete

From: dbasehore .
Date: Sat Feb 27 2016 - 03:10:27 EST


A device is not able to use direct complete if its children do not
also use direct complete. Even though the SCSI layer leaves devices
runtime suspended, the way it does it still prevents its parent from
using direct complete.

On Fri, Feb 26, 2016 at 11:26 PM, Mika Westerberg
<mika.westerberg@xxxxxxxxxxxxxxx> wrote:
> On Wed, Feb 24, 2016 at 04:22:28PM -0800, Derek Basehore wrote:
>> This allows scsi devices to remain runtime suspended for system
>> suspend. Since runtime suspend is stricter than system suspend
>> callbacks, this is just returning a positive number for the prepare
>> callback.
>
> AFAICT SCSI layer already leaves devices runtime suspended during system
> suspend (see scsi_bus_suspend_common()). What's the benefit using
> direct_complete over the current implementation?
>
>> Signed-off-by: Derek Basehore <dbasehore@xxxxxxxxxxxx>
>> Reviewed-by: Eric Caruso <ejcaruso@xxxxxxxxxxxx>
>> ---
>> drivers/scsi/scsi_pm.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c
>> index b44c1bb..7af76ad 100644
>> --- a/drivers/scsi/scsi_pm.c
>> +++ b/drivers/scsi/scsi_pm.c
>> @@ -178,7 +178,7 @@ static int scsi_bus_prepare(struct device *dev)
>> /* Wait until async scanning is finished */
>> scsi_complete_async_scans();
>> }
>> - return 0;
>> + return 1;
>> }
>>
>> static int scsi_bus_suspend(struct device *dev)
>> --
>> 2.7.0.rc3.207.g0ac5344