scsi: configure runtime pm before calling device_add in scsi_add_host_with_dma
authorHeiner Kallweit <hkallweit1@gmail.com>
Wed, 3 Aug 2016 19:49:03 +0000 (21:49 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 26 Aug 2016 03:39:24 +0000 (23:39 -0400)
commit0d5644b7d8daa3c1d91acb4367731f568c9c9469
tree55a2cb62432c4cb7ade2dfce0c14e8605d170c01
parentafc3f83cb4a5bb3c8f18380bdeca6b65a6ff9543
scsi: configure runtime pm before calling device_add in scsi_add_host_with_dma

Runtime PM should be configured already once we call device_add. See
also the description in this mail thread
https://lists.linuxfoundation.org/pipermail/linux-pm/2009-November/023198.html
or the order of calls e.g. in usb_new_device.

The changed order also helps to avoid scenarios where runtime pm for
&shost->shost_gendev is activated whilst the parent is suspended,
resulting in error message "runtime PM trying to activate child device
hostx but parent yyy is not active".

In addition properly reverse the runtime pm calls in the error path.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hosts.c