Skip to content

Commit 2a36646

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: ufs: core: Simplify ufshcd_err_handling_prepare()
Use blk_mq_quiesce_tagset() instead of ufshcd_scsi_block_requests() and blk_mq_wait_quiesce_done(). Since this patch removes the last callers of ufshcd_scsi_block_requests() and ufshcd_scsi_unblock_requests(), remove these functions. Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20241022193130.2733293-6-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent b5d9da5 commit 2a36646

2 files changed

Lines changed: 3 additions & 18 deletions

File tree

drivers/ufs/core/ufshcd.c

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -349,18 +349,6 @@ static void ufshcd_configure_wb(struct ufs_hba *hba)
349349
ufshcd_wb_toggle_buf_flush(hba, true);
350350
}
351351

352-
static void ufshcd_scsi_unblock_requests(struct ufs_hba *hba)
353-
{
354-
if (atomic_dec_and_test(&hba->scsi_block_reqs_cnt))
355-
scsi_unblock_requests(hba->host);
356-
}
357-
358-
static void ufshcd_scsi_block_requests(struct ufs_hba *hba)
359-
{
360-
if (atomic_inc_return(&hba->scsi_block_reqs_cnt) == 1)
361-
scsi_block_requests(hba->host);
362-
}
363-
364352
static void ufshcd_add_cmd_upiu_trace(struct ufs_hba *hba, unsigned int tag,
365353
enum ufs_trace_str_t str_t)
366354
{
@@ -6375,15 +6363,14 @@ static void ufshcd_err_handling_prepare(struct ufs_hba *hba)
63756363
ufshcd_suspend_clkscaling(hba);
63766364
ufshcd_clk_scaling_allow(hba, false);
63776365
}
6378-
ufshcd_scsi_block_requests(hba);
63796366
/* Wait for ongoing ufshcd_queuecommand() calls to finish. */
6380-
blk_mq_wait_quiesce_done(&hba->host->tag_set);
6367+
blk_mq_quiesce_tagset(&hba->host->tag_set);
63816368
cancel_work_sync(&hba->eeh_work);
63826369
}
63836370

63846371
static void ufshcd_err_handling_unprepare(struct ufs_hba *hba)
63856372
{
6386-
ufshcd_scsi_unblock_requests(hba);
6373+
blk_mq_unquiesce_tagset(&hba->host->tag_set);
63876374
ufshcd_release(hba);
63886375
if (ufshcd_is_clkscaling_supported(hba))
63896376
ufshcd_clk_scaling_suspend(hba, false);
@@ -10558,7 +10545,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
1055810545

1055910546
/* Hold auto suspend until async scan completes */
1056010547
pm_runtime_get_sync(dev);
10561-
atomic_set(&hba->scsi_block_reqs_cnt, 0);
10548+
1056210549
/*
1056310550
* We are assuming that device wasn't put in sleep/power-down
1056410551
* state exclusively during the boot stage before kernel.

include/ufs/ufshcd.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,6 @@ enum ufshcd_mcq_opr {
925925
* @wb_mutex: used to serialize devfreq and sysfs write booster toggling
926926
* @clk_scaling_lock: used to serialize device commands and clock scaling
927927
* @desc_size: descriptor sizes reported by device
928-
* @scsi_block_reqs_cnt: reference counting for scsi block requests
929928
* @bsg_dev: struct device associated with the BSG queue
930929
* @bsg_queue: BSG queue associated with the UFS controller
931930
* @rpm_dev_flush_recheck_work: used to suspend from RPM (runtime power
@@ -1086,7 +1085,6 @@ struct ufs_hba {
10861085

10871086
struct mutex wb_mutex;
10881087
struct rw_semaphore clk_scaling_lock;
1089-
atomic_t scsi_block_reqs_cnt;
10901088

10911089
struct device bsg_dev;
10921090
struct request_queue *bsg_queue;

0 commit comments

Comments
 (0)