===================================================================
@@ -1017,6 +1017,7 @@ extern int blk_pre_runtime_suspend(struc
extern void blk_post_runtime_suspend(struct request_queue *q, int err);
extern void blk_pre_runtime_resume(struct request_queue *q);
extern void blk_post_runtime_resume(struct request_queue *q, int err);
+extern void blk_runtime_activate(struct request_queue *q);
#else
static inline void blk_pm_runtime_init(struct request_queue *q,
struct device *dev) {}
@@ -1027,6 +1028,7 @@ static inline int blk_pre_runtime_suspen
static inline void blk_post_runtime_suspend(struct request_queue *q, int err) {}
static inline void blk_pre_runtime_resume(struct request_queue *q) {}
static inline void blk_post_runtime_resume(struct request_queue *q, int err) {}
+static inline void blk_runtime_activate(struct request_queue *q) {}
#endif
/*
===================================================================
@@ -3377,6 +3377,25 @@ void blk_post_runtime_resume(struct requ
spin_unlock_irq(q->queue_lock);
}
EXPORT_SYMBOL(blk_post_runtime_resume);
+
+/**
+ * blk_runtime_activate - Runtime activation processing
+ * @q: the queue of the device
+ *
+ * Description:
+ * Tell the block layer that the device has changed directly to the
+ * runtime-resumed state without executing any runtime-PM callbacks,
+ * (for example, during system resume). Does the same things as
+ * blk_post_runtime_resume().
+ *
+ * This function should be called after pm_runtime_set_active() and
+ * pm_runtime_enable().
+ */
+void blk_runtime_activate(struct request_queue *q)
+{
+ blk_post_runtime_resume(q, 0);
+}
+EXPORT_SYMBOL(blk_runtime_activate);
#endif
int __init blk_dev_init(void)
===================================================================
@@ -70,17 +70,19 @@ static int scsi_dev_type_suspend(struct
static int scsi_dev_type_resume(struct device *dev,
int (*cb)(struct device *, const struct dev_pm_ops *))
{
+ struct scsi_device *sdev = to_scsi_device(dev);
const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
int err = 0;
err = cb(dev, pm);
- scsi_device_resume(to_scsi_device(dev));
+ scsi_device_resume(sdev);
dev_dbg(dev, "scsi resume: %d\n", err);
if (err == 0) {
pm_runtime_disable(dev);
pm_runtime_set_active(dev);
pm_runtime_enable(dev);
+ blk_runtime_activate(sdev->request_queue);
}
return err;