diff options
-rw-r--r-- | block/blk-core.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index a0af4043dda2..3636be469fa2 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -3405,6 +3405,9 @@ int blk_pre_runtime_suspend(struct request_queue *q) | |||
3405 | { | 3405 | { |
3406 | int ret = 0; | 3406 | int ret = 0; |
3407 | 3407 | ||
3408 | if (!q->dev) | ||
3409 | return ret; | ||
3410 | |||
3408 | spin_lock_irq(q->queue_lock); | 3411 | spin_lock_irq(q->queue_lock); |
3409 | if (q->nr_pending) { | 3412 | if (q->nr_pending) { |
3410 | ret = -EBUSY; | 3413 | ret = -EBUSY; |
@@ -3432,6 +3435,9 @@ EXPORT_SYMBOL(blk_pre_runtime_suspend); | |||
3432 | */ | 3435 | */ |
3433 | void blk_post_runtime_suspend(struct request_queue *q, int err) | 3436 | void blk_post_runtime_suspend(struct request_queue *q, int err) |
3434 | { | 3437 | { |
3438 | if (!q->dev) | ||
3439 | return; | ||
3440 | |||
3435 | spin_lock_irq(q->queue_lock); | 3441 | spin_lock_irq(q->queue_lock); |
3436 | if (!err) { | 3442 | if (!err) { |
3437 | q->rpm_status = RPM_SUSPENDED; | 3443 | q->rpm_status = RPM_SUSPENDED; |
@@ -3456,6 +3462,9 @@ EXPORT_SYMBOL(blk_post_runtime_suspend); | |||
3456 | */ | 3462 | */ |
3457 | void blk_pre_runtime_resume(struct request_queue *q) | 3463 | void blk_pre_runtime_resume(struct request_queue *q) |
3458 | { | 3464 | { |
3465 | if (!q->dev) | ||
3466 | return; | ||
3467 | |||
3459 | spin_lock_irq(q->queue_lock); | 3468 | spin_lock_irq(q->queue_lock); |
3460 | q->rpm_status = RPM_RESUMING; | 3469 | q->rpm_status = RPM_RESUMING; |
3461 | spin_unlock_irq(q->queue_lock); | 3470 | spin_unlock_irq(q->queue_lock); |
@@ -3478,6 +3487,9 @@ EXPORT_SYMBOL(blk_pre_runtime_resume); | |||
3478 | */ | 3487 | */ |
3479 | void blk_post_runtime_resume(struct request_queue *q, int err) | 3488 | void blk_post_runtime_resume(struct request_queue *q, int err) |
3480 | { | 3489 | { |
3490 | if (!q->dev) | ||
3491 | return; | ||
3492 | |||
3481 | spin_lock_irq(q->queue_lock); | 3493 | spin_lock_irq(q->queue_lock); |
3482 | if (!err) { | 3494 | if (!err) { |
3483 | q->rpm_status = RPM_ACTIVE; | 3495 | q->rpm_status = RPM_ACTIVE; |