Re: [PATCH v2] scsi: ufs: core: Add ufshcd_send_bsg_uic_cmd() for UFS BSG

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2024-11-13 at 19:14 +0800, Ziqi Chen wrote:

> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index e338867bc96c..c01f4b0c1b4f 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -4319,6 +4319,42 @@ static int ufshcd_uic_pwr_ctrl(struct ufs_hba
> *hba, struct uic_command *cmd)
>         return ret;
>  }
> 
> +/**
> + * ufshcd_send_bsg_uic_cmd - Send UIC commands requested via BSG
> layer and retrieve the result
> + * @hba: per adapter instance
> + * @uic_cmd: UIC command
> + *
> + * Return: 0 only if success.
> + */
> +int ufshcd_send_bsg_uic_cmd(struct ufs_hba *hba, struct uic_command
> *uic_cmd)
> +{
> +       int ret;
> +
> +       if (hba->quirks & UFSHCD_QUIRK_BROKEN_UIC_CMD)
> +               return 0;
> +
> +       ufshcd_hold(hba);
> +
> +       if (uic_cmd->argument1 == UIC_ARG_MIB(PA_PWRMODE) &&
> +           uic_cmd->command == UIC_CMD_DME_SET) {
> 

Hi Ziqi,

Should we also check if uic_cmd->command == UIC_CMD_DME_HIBER_ENTER
or UIC_CMD_DME_HIBER_EXIT?

Thanks
Peter



> +               ret = ufshcd_uic_pwr_ctrl(hba, uic_cmd);
> +               goto out;
> +       }
> +
> +       mutex_lock(&hba->uic_cmd_mutex);
> +       ufshcd_add_delay_before_dme_cmd(hba);
> +
> +       ret = __ufshcd_send_uic_cmd(hba, uic_cmd);
> +       if (!ret)
> +               ret = ufshcd_wait_for_uic_cmd(hba, uic_cmd);
> +
> +       mutex_unlock(&hba->uic_cmd_mutex);
> +
> +out:
> +       ufshcd_release(hba);
> +       return ret;
> +}
> +
>  /**
>   * ufshcd_uic_change_pwr_mode - Perform the UIC power mode chage
>   *                             using DME_SET primitives.
> --
> 2.34.1
> 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux