Commit 8a686f26 authored by Bart Van Assche's avatar Bart Van Assche Committed by Martin K. Petersen

scsi: ufs: Use DECLARE_COMPLETION_ONSTACK() where appropriate

From Documentation/scheduler/completion.rst: "When a completion is declared
as a local variable within a function, then the initialization should
always use DECLARE_COMPLETION_ONSTACK() explicitly, not just to make
lockdep happy, but also to make it clear that limited scope had been
considered and is intentional."

Link: https://lore.kernel.org/r/20210722033439.26550-6-bvanassche@acm.org
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Stanley Chu <stanley.chu@mediatek.com>
Cc: Can Guo <cang@codeaurora.org>
Cc: Asutosh Das <asutoshd@codeaurora.org>
Cc: Avri Altman <avri.altman@wdc.com>
Reviewed-by: default avatarAvri Altman <avri.altman@wdc.com>
Reviewed-by: default avatarBean Huo <beanhuo@micron.com>
Reviewed-by: default avatarDaejun Park <daejun7.park@samsung.com>
Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 568dd995
...@@ -2956,11 +2956,11 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba, ...@@ -2956,11 +2956,11 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
enum dev_cmd_type cmd_type, int timeout) enum dev_cmd_type cmd_type, int timeout)
{ {
struct request_queue *q = hba->cmd_queue; struct request_queue *q = hba->cmd_queue;
DECLARE_COMPLETION_ONSTACK(wait);
struct request *req; struct request *req;
struct ufshcd_lrb *lrbp; struct ufshcd_lrb *lrbp;
int err; int err;
int tag; int tag;
struct completion wait;
down_read(&hba->clk_scaling_lock); down_read(&hba->clk_scaling_lock);
...@@ -2985,7 +2985,6 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba, ...@@ -2985,7 +2985,6 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
goto out; goto out;
} }
init_completion(&wait);
lrbp = &hba->lrb[tag]; lrbp = &hba->lrb[tag];
WARN_ON(lrbp->cmd); WARN_ON(lrbp->cmd);
err = ufshcd_compose_dev_cmd(hba, lrbp, cmd_type, tag); err = ufshcd_compose_dev_cmd(hba, lrbp, cmd_type, tag);
...@@ -3992,14 +3991,13 @@ EXPORT_SYMBOL_GPL(ufshcd_dme_get_attr); ...@@ -3992,14 +3991,13 @@ EXPORT_SYMBOL_GPL(ufshcd_dme_get_attr);
*/ */
static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, struct uic_command *cmd) static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, struct uic_command *cmd)
{ {
struct completion uic_async_done; DECLARE_COMPLETION_ONSTACK(uic_async_done);
unsigned long flags; unsigned long flags;
u8 status; u8 status;
int ret; int ret;
bool reenable_intr = false; bool reenable_intr = false;
mutex_lock(&hba->uic_cmd_mutex); mutex_lock(&hba->uic_cmd_mutex);
init_completion(&uic_async_done);
ufshcd_add_delay_before_dme_cmd(hba); ufshcd_add_delay_before_dme_cmd(hba);
spin_lock_irqsave(hba->host->host_lock, flags); spin_lock_irqsave(hba->host->host_lock, flags);
...@@ -6700,11 +6698,11 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba, ...@@ -6700,11 +6698,11 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba,
enum query_opcode desc_op) enum query_opcode desc_op)
{ {
struct request_queue *q = hba->cmd_queue; struct request_queue *q = hba->cmd_queue;
DECLARE_COMPLETION_ONSTACK(wait);
struct request *req; struct request *req;
struct ufshcd_lrb *lrbp; struct ufshcd_lrb *lrbp;
int err = 0; int err = 0;
int tag; int tag;
struct completion wait;
u8 upiu_flags; u8 upiu_flags;
down_read(&hba->clk_scaling_lock); down_read(&hba->clk_scaling_lock);
...@@ -6722,7 +6720,6 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba, ...@@ -6722,7 +6720,6 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba,
goto out; goto out;
} }
init_completion(&wait);
lrbp = &hba->lrb[tag]; lrbp = &hba->lrb[tag];
WARN_ON(lrbp->cmd); WARN_ON(lrbp->cmd);
lrbp->cmd = NULL; lrbp->cmd = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment