Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 1fb671c

Browse files
ptr324Treehugger Robot
authored andcommitted
FROMLIST: scsi: core: move auto suspend timer to Scsi_Host
Runtime suspend timer is a const value in scsi_host_template, which host cannot modify this value. Move it to Scsi_Host for host flexible use. Bug: 322942047 Link: https://lore.kernel.org/all/20240109124015.31359-2-peter.wang@mediatek.com/ Change-Id: I446db0b5244e29cf73de3d858f94b5092fa2e7c7 Signed-off-by: Peter Wang <peter.wang@mediatek.com>
1 parent 04d771f commit 1fb671c

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

drivers/scsi/sd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3725,7 +3725,7 @@ static int sd_probe(struct device *dev)
37253725
blk_pm_runtime_init(sdp->request_queue, dev);
37263726
if (sdp->rpm_autosuspend) {
37273727
pm_runtime_set_autosuspend_delay(dev,
3728-
sdp->host->hostt->rpm_autosuspend_delay);
3728+
sdp->host->rpm_autosuspend_delay);
37293729
}
37303730

37313731
error = device_add_disk(dev, gd, NULL);

drivers/ufs/core/ufshcd.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7909,11 +7909,13 @@ static void ufshcd_set_active_icc_lvl(struct ufs_hba *hba)
79097909

79107910
static inline void ufshcd_blk_pm_runtime_init(struct scsi_device *sdev)
79117911
{
7912+
struct Scsi_Host *shost = sdev->host;
7913+
79127914
scsi_autopm_get_device(sdev);
79137915
blk_pm_runtime_init(sdev->request_queue, &sdev->sdev_gendev);
79147916
if (sdev->rpm_autosuspend)
79157917
pm_runtime_set_autosuspend_delay(&sdev->sdev_gendev,
7916-
RPM_AUTOSUSPEND_DELAY_MS);
7918+
shost->rpm_autosuspend_delay);
79177919
scsi_autopm_put_device(sdev);
79187920
}
79197921

@@ -8911,7 +8913,6 @@ static const struct scsi_host_template ufshcd_driver_template = {
89118913
.track_queue_depth = 1,
89128914
.skip_settle_delay = 1,
89138915
.sdev_groups = ufshcd_driver_groups,
8914-
.rpm_autosuspend_delay = RPM_AUTOSUSPEND_DELAY_MS,
89158916
};
89168917

89178918
static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg,
@@ -10351,6 +10352,10 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
1035110352
host->max_cmd_len = UFS_CDB_SIZE;
1035210353
host->queuecommand_may_block = !!(hba->caps & UFSHCD_CAP_CLK_GATING);
1035310354

10355+
/* Use default RPM delay if host not set */
10356+
if (host->rpm_autosuspend_delay == 0)
10357+
host->rpm_autosuspend_delay = RPM_AUTOSUSPEND_DELAY_MS;
10358+
1035410359
hba->max_pwr_info.is_valid = false;
1035510360

1035610361
/* Initialize work queues */

include/scsi/scsi_host.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,9 +494,6 @@ struct scsi_host_template {
494494
* scsi_netlink.h
495495
*/
496496
u64 vendor_id;
497-
498-
/* Delay for runtime autosuspend */
499-
int rpm_autosuspend_delay;
500497
};
501498

502499
/*
@@ -710,6 +707,9 @@ struct Scsi_Host {
710707
*/
711708
struct device *dma_dev;
712709

710+
/* Delay for runtime autosuspend */
711+
int rpm_autosuspend_delay;
712+
713713
/*
714714
* We should ensure that this is aligned, both for better performance
715715
* and also because some compilers (m68k) don't automatically force

0 commit comments

Comments
 (0)