Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Bart Van Assche and committed by
Martin K. Petersen
2a366460 b5d9da58

+3 -18
+3 -16
drivers/ufs/core/ufshcd.c
··· 349 349 ufshcd_wb_toggle_buf_flush(hba, true); 350 350 } 351 351 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 - 364 352 static void ufshcd_add_cmd_upiu_trace(struct ufs_hba *hba, unsigned int tag, 365 353 enum ufs_trace_str_t str_t) 366 354 { ··· 6363 6375 ufshcd_suspend_clkscaling(hba); 6364 6376 ufshcd_clk_scaling_allow(hba, false); 6365 6377 } 6366 - ufshcd_scsi_block_requests(hba); 6367 6378 /* Wait for ongoing ufshcd_queuecommand() calls to finish. */ 6368 - blk_mq_wait_quiesce_done(&hba->host->tag_set); 6379 + blk_mq_quiesce_tagset(&hba->host->tag_set); 6369 6380 cancel_work_sync(&hba->eeh_work); 6370 6381 } 6371 6382 6372 6383 static void ufshcd_err_handling_unprepare(struct ufs_hba *hba) 6373 6384 { 6374 - ufshcd_scsi_unblock_requests(hba); 6385 + blk_mq_unquiesce_tagset(&hba->host->tag_set); 6375 6386 ufshcd_release(hba); 6376 6387 if (ufshcd_is_clkscaling_supported(hba)) 6377 6388 ufshcd_clk_scaling_suspend(hba, false); ··· 10545 10558 10546 10559 /* Hold auto suspend until async scan completes */ 10547 10560 pm_runtime_get_sync(dev); 10548 - atomic_set(&hba->scsi_block_reqs_cnt, 0); 10561 + 10549 10562 /* 10550 10563 * We are assuming that device wasn't put in sleep/power-down 10551 10564 * state exclusively during the boot stage before kernel.
-2
include/ufs/ufshcd.h
··· 925 925 * @wb_mutex: used to serialize devfreq and sysfs write booster toggling 926 926 * @clk_scaling_lock: used to serialize device commands and clock scaling 927 927 * @desc_size: descriptor sizes reported by device 928 - * @scsi_block_reqs_cnt: reference counting for scsi block requests 929 928 * @bsg_dev: struct device associated with the BSG queue 930 929 * @bsg_queue: BSG queue associated with the UFS controller 931 930 * @rpm_dev_flush_recheck_work: used to suspend from RPM (runtime power ··· 1085 1086 1086 1087 struct mutex wb_mutex; 1087 1088 struct rw_semaphore clk_scaling_lock; 1088 - atomic_t scsi_block_reqs_cnt; 1089 1089 1090 1090 struct device bsg_dev; 1091 1091 struct request_queue *bsg_queue;