fixup null q->dev checking in both block and scsi layer
Subsystems (3)
PATCH v2 1/1 fixup null q->dev checking in both block and scsi layer
Some devices may skip blk_pm_runtime_init() and have null pointer in its request_queue->dev. For example, SCSI devices of UFS Well-Known LUNs.
Currently the null pointer is checked by the user of blk_set_runtime_active(), i.e., scsi_dev_type_resume(). It is better to check it by blk_set_runtime_active() itself instead of by its users.
v1 => v2:
- Change if style in blk_set_runtime_active() (Jens)
Stanley Chu (2):
block: bypass blk_set_runtime_active for uninitialized q->dev
scsi: core: remove dummy q->dev check
block/blk-pm.c | 12 +++++++----- drivers/scsi/scsi_pm.c | 3 +-- 2 files changed, 8 insertions(+), 7 deletions(-)
Signature · 1 line
2.18.0
PATCH v2 1/2 block: bypass blk_set_runtime_active for uninitialized q->dev
Some devices may skip blk_pm_runtime_init() and have null pointer in its request_queue->dev. For example, SCSI devices of UFS Well-Known LUNs.
Currently the null pointer is checked by the user of blk_set_runtime_active(), i.e., scsi_dev_type_resume(). It is better to check it by blk_set_runtime_active() itself instead of by its users.
--- block/blk-pm.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
block/blk-pm.c +7 -5
@@ -207,10 +207,12 @@ EXPORT_SYMBOL(blk_post_runtime_resume);*/ void blk_set_runtime_active (struct request_queue *q) { -spin_lock_irq (&q->queue_lock); - q->rpm_status =RPM_ACTIVE ; -pm_runtime_mark_last_busy (q->dev); -pm_request_autosuspend (q->dev); -spin_unlock_irq (&q->queue_lock); +if (q->dev) { +spin_lock_irq (&q->queue_lock); + q->rpm_status =RPM_ACTIVE ; +pm_runtime_mark_last_busy (q->dev); +pm_request_autosuspend (q->dev); +spin_unlock_irq (&q->queue_lock); + } }EXPORT_SYMBOL (blk_set_runtime_active);
Signature · 1 line
2.18.0
PATCH v2 2/2 scsi: core: remove dummy q->dev check
In reply to Stanley ChuCurrently blk_set_runtime_active() is checking if q->dev is null by itself, thus remove the same checking in its user: scsi_dev_type_resume().
--- drivers/scsi/scsi_pm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/scsi_pm.c +1 -2
@@ -94,8 +94,7 @@ static int scsi_dev_type_resume(struct device *dev,if (!err &&scsi_is_sdev_device (dev)) {struct scsi_device *sdev =to_scsi_device (dev); -if (sdev->request_queue->dev) -blk_set_runtime_active (sdev->request_queue); +blk_set_runtime_active (sdev->request_queue); } }
Signature · 1 line
2.18.0
Quoted 8 lines · Stanley Chu
Some devices may skip
blk_pm_runtime_init()and have null pointer in itsrequest_queue->dev. For example, SCSI devices of UFS Well-Known LUNs.Currently the null pointer is checked by the user of
blk_set_runtime_active(), i.e.,scsi_dev_type_resume(). It is better to check it byblk_set_runtime_active()itself instead of by its users.
Applied, thanks.
Signature · 1 line
Jens Axboe