mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-16 13:19:56 -04:00
scsi: core: Move autosuspend timer delay to Scsi_Host
The runtime suspend timer delay is a const value in scsi_host_template which a host driver cannot modify at runtime. Move the delay to Scsi_Host to allow a driver to update it. Signed-off-by: Peter Wang <peter.wang@mediatek.com> Link: https://lore.kernel.org/r/20240109124015.31359-2-peter.wang@mediatek.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
committed by
Martin K. Petersen
parent
e0dc13e5a3
commit
4380e64a94
@@ -3728,7 +3728,7 @@ static int sd_probe(struct device *dev)
|
|||||||
blk_pm_runtime_init(sdp->request_queue, dev);
|
blk_pm_runtime_init(sdp->request_queue, dev);
|
||||||
if (sdp->rpm_autosuspend) {
|
if (sdp->rpm_autosuspend) {
|
||||||
pm_runtime_set_autosuspend_delay(dev,
|
pm_runtime_set_autosuspend_delay(dev,
|
||||||
sdp->host->hostt->rpm_autosuspend_delay);
|
sdp->host->rpm_autosuspend_delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
error = device_add_disk(dev, gd, NULL);
|
error = device_add_disk(dev, gd, NULL);
|
||||||
|
|||||||
@@ -8031,11 +8031,13 @@ static void ufshcd_set_active_icc_lvl(struct ufs_hba *hba)
|
|||||||
|
|
||||||
static inline void ufshcd_blk_pm_runtime_init(struct scsi_device *sdev)
|
static inline void ufshcd_blk_pm_runtime_init(struct scsi_device *sdev)
|
||||||
{
|
{
|
||||||
|
struct Scsi_Host *shost = sdev->host;
|
||||||
|
|
||||||
scsi_autopm_get_device(sdev);
|
scsi_autopm_get_device(sdev);
|
||||||
blk_pm_runtime_init(sdev->request_queue, &sdev->sdev_gendev);
|
blk_pm_runtime_init(sdev->request_queue, &sdev->sdev_gendev);
|
||||||
if (sdev->rpm_autosuspend)
|
if (sdev->rpm_autosuspend)
|
||||||
pm_runtime_set_autosuspend_delay(&sdev->sdev_gendev,
|
pm_runtime_set_autosuspend_delay(&sdev->sdev_gendev,
|
||||||
RPM_AUTOSUSPEND_DELAY_MS);
|
shost->rpm_autosuspend_delay);
|
||||||
scsi_autopm_put_device(sdev);
|
scsi_autopm_put_device(sdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9109,7 +9111,6 @@ static const struct scsi_host_template ufshcd_driver_template = {
|
|||||||
.track_queue_depth = 1,
|
.track_queue_depth = 1,
|
||||||
.skip_settle_delay = 1,
|
.skip_settle_delay = 1,
|
||||||
.sdev_groups = ufshcd_driver_groups,
|
.sdev_groups = ufshcd_driver_groups,
|
||||||
.rpm_autosuspend_delay = RPM_AUTOSUSPEND_DELAY_MS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg,
|
static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg,
|
||||||
@@ -10568,6 +10569,10 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
|
|||||||
host->max_cmd_len = UFS_CDB_SIZE;
|
host->max_cmd_len = UFS_CDB_SIZE;
|
||||||
host->queuecommand_may_block = !!(hba->caps & UFSHCD_CAP_CLK_GATING);
|
host->queuecommand_may_block = !!(hba->caps & UFSHCD_CAP_CLK_GATING);
|
||||||
|
|
||||||
|
/* Use default RPM delay if host not set */
|
||||||
|
if (host->rpm_autosuspend_delay == 0)
|
||||||
|
host->rpm_autosuspend_delay = RPM_AUTOSUSPEND_DELAY_MS;
|
||||||
|
|
||||||
hba->max_pwr_info.is_valid = false;
|
hba->max_pwr_info.is_valid = false;
|
||||||
|
|
||||||
/* Initialize work queues */
|
/* Initialize work queues */
|
||||||
|
|||||||
@@ -497,9 +497,6 @@ struct scsi_host_template {
|
|||||||
* scsi_netlink.h
|
* scsi_netlink.h
|
||||||
*/
|
*/
|
||||||
u64 vendor_id;
|
u64 vendor_id;
|
||||||
|
|
||||||
/* Delay for runtime autosuspend */
|
|
||||||
int rpm_autosuspend_delay;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -713,6 +710,9 @@ struct Scsi_Host {
|
|||||||
*/
|
*/
|
||||||
struct device *dma_dev;
|
struct device *dma_dev;
|
||||||
|
|
||||||
|
/* Delay for runtime autosuspend */
|
||||||
|
int rpm_autosuspend_delay;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We should ensure that this is aligned, both for better performance
|
* We should ensure that this is aligned, both for better performance
|
||||||
* and also because some compilers (m68k) don't automatically force
|
* and also because some compilers (m68k) don't automatically force
|
||||||
|
|||||||
Reference in New Issue
Block a user