mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 02:53:36 +02:00
Merge patch series "Clean up the UFS driver UIC code"
Bart Van Assche <bvanassche@acm.org> says: Hi Martin, This patch series includes four patches that modify the UFS driver UIC code without modifying the behavior of that code. Please consider this patch series for the next merge window. Thanks, Bart. Link: https://lore.kernel.org/r/20240912223019.3510966-1-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
commit
b1ab5e28c8
|
|
@ -2551,13 +2551,11 @@ ufshcd_wait_for_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)
|
|||
* __ufshcd_send_uic_cmd - Send UIC commands and retrieve the result
|
||||
* @hba: per adapter instance
|
||||
* @uic_cmd: UIC command
|
||||
* @completion: initialize the completion only if this is set to true
|
||||
*
|
||||
* Return: 0 only if success.
|
||||
*/
|
||||
static int
|
||||
__ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd,
|
||||
bool completion)
|
||||
__ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)
|
||||
{
|
||||
lockdep_assert_held(&hba->uic_cmd_mutex);
|
||||
|
||||
|
|
@ -2567,8 +2565,7 @@ __ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd,
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
if (completion)
|
||||
init_completion(&uic_cmd->done);
|
||||
init_completion(&uic_cmd->done);
|
||||
|
||||
uic_cmd->cmd_active = 1;
|
||||
ufshcd_dispatch_uic_cmd(hba, uic_cmd);
|
||||
|
|
@ -2594,7 +2591,7 @@ int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)
|
|||
mutex_lock(&hba->uic_cmd_mutex);
|
||||
ufshcd_add_delay_before_dme_cmd(hba);
|
||||
|
||||
ret = __ufshcd_send_uic_cmd(hba, uic_cmd, true);
|
||||
ret = __ufshcd_send_uic_cmd(hba, uic_cmd);
|
||||
if (!ret)
|
||||
ret = ufshcd_wait_for_uic_cmd(hba, uic_cmd);
|
||||
|
||||
|
|
@ -4289,7 +4286,7 @@ static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, struct uic_command *cmd)
|
|||
reenable_intr = true;
|
||||
}
|
||||
spin_unlock_irqrestore(hba->host->host_lock, flags);
|
||||
ret = __ufshcd_send_uic_cmd(hba, cmd, false);
|
||||
ret = __ufshcd_send_uic_cmd(hba, cmd);
|
||||
if (ret) {
|
||||
dev_err(hba->dev,
|
||||
"pwr ctrl cmd 0x%x with mode 0x%x uic error %d\n",
|
||||
|
|
@ -5477,32 +5474,37 @@ static bool ufshcd_is_auto_hibern8_error(struct ufs_hba *hba,
|
|||
static irqreturn_t ufshcd_uic_cmd_compl(struct ufs_hba *hba, u32 intr_status)
|
||||
{
|
||||
irqreturn_t retval = IRQ_NONE;
|
||||
struct uic_command *cmd;
|
||||
|
||||
spin_lock(hba->host->host_lock);
|
||||
cmd = hba->active_uic_cmd;
|
||||
if (WARN_ON_ONCE(!cmd))
|
||||
goto unlock;
|
||||
|
||||
if (ufshcd_is_auto_hibern8_error(hba, intr_status))
|
||||
hba->errors |= (UFSHCD_UIC_HIBERN8_MASK & intr_status);
|
||||
|
||||
if ((intr_status & UIC_COMMAND_COMPL) && hba->active_uic_cmd) {
|
||||
hba->active_uic_cmd->argument2 |=
|
||||
ufshcd_get_uic_cmd_result(hba);
|
||||
hba->active_uic_cmd->argument3 =
|
||||
ufshcd_get_dme_attr_val(hba);
|
||||
if (intr_status & UIC_COMMAND_COMPL) {
|
||||
cmd->argument2 |= ufshcd_get_uic_cmd_result(hba);
|
||||
cmd->argument3 = ufshcd_get_dme_attr_val(hba);
|
||||
if (!hba->uic_async_done)
|
||||
hba->active_uic_cmd->cmd_active = 0;
|
||||
complete(&hba->active_uic_cmd->done);
|
||||
cmd->cmd_active = 0;
|
||||
complete(&cmd->done);
|
||||
retval = IRQ_HANDLED;
|
||||
}
|
||||
|
||||
if ((intr_status & UFSHCD_UIC_PWR_MASK) && hba->uic_async_done) {
|
||||
hba->active_uic_cmd->cmd_active = 0;
|
||||
if (intr_status & UFSHCD_UIC_PWR_MASK && hba->uic_async_done) {
|
||||
cmd->cmd_active = 0;
|
||||
complete(hba->uic_async_done);
|
||||
retval = IRQ_HANDLED;
|
||||
}
|
||||
|
||||
if (retval == IRQ_HANDLED)
|
||||
ufshcd_add_uic_command_trace(hba, hba->active_uic_cmd,
|
||||
UFS_CMD_COMP);
|
||||
ufshcd_add_uic_command_trace(hba, cmd, UFS_CMD_COMP);
|
||||
|
||||
unlock:
|
||||
spin_unlock(hba->host->host_lock);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -877,9 +877,10 @@ enum ufshcd_mcq_opr {
|
|||
* @tmf_tag_set: TMF tag set.
|
||||
* @tmf_queue: Used to allocate TMF tags.
|
||||
* @tmf_rqs: array with pointers to TMF requests while these are in progress.
|
||||
* @active_uic_cmd: handle of active UIC command
|
||||
* @uic_cmd_mutex: mutex for UIC command
|
||||
* @uic_async_done: completion used during UIC processing
|
||||
* @active_uic_cmd: pointer to active UIC command.
|
||||
* @uic_cmd_mutex: mutex used for serializing UIC command processing.
|
||||
* @uic_async_done: completion used to wait for power mode or hibernation state
|
||||
* changes.
|
||||
* @ufshcd_state: UFSHCD state
|
||||
* @eh_flags: Error handling flags
|
||||
* @intr_mask: Interrupt Mask Bits
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user