From: Bart Van Assche Date: Wed, 1 Apr 2026 20:24:59 +0000 (-0700) Subject: scsi: ufs: core: Add a comment block above ufshcd_mcq_compl_all_cqes_lock() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1373df88d53594a32534fd8960c51d1d09be8ecb;p=thirdparty%2Flinux.git scsi: ufs: core: Add a comment block above ufshcd_mcq_compl_all_cqes_lock() Document the aspects of ufshcd_mcq_compl_all_cqes_lock() that are nontrivial in a comment block above this function. Signed-off-by: Bart Van Assche Reviewed-by: Peter Wang Link: https://patch.msgid.link/20260401202506.1445324-2-bvanassche@acm.org Signed-off-by: Martin K. Petersen --- diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c index 1b3062577945..c1b1d67a1ddc 100644 --- a/drivers/ufs/core/ufs-mcq.c +++ b/drivers/ufs/core/ufs-mcq.c @@ -322,6 +322,14 @@ static void ufshcd_mcq_process_cqe(struct ufs_hba *hba, } } +/* + * This function is called from the UFS error handler with the UFS host + * controller disabled (HCE = 0). Reading host controller registers, e.g. the + * CQ tail pointer (CQTPy), may not be safe with the host controller disabled. + * Hence, iterate over all completion queue entries. This won't result in + * double completions because ufshcd_mcq_process_cqe() clears a CQE after it + * has been processed. + */ void ufshcd_mcq_compl_all_cqes_lock(struct ufs_hba *hba, struct ufs_hw_queue *hwq) {