RE: [PATCH V1 2/2] scsi: ufs: qcom: Enable QUnipro Internal Clock Gating

From: Avri Altman
Date: Thu Jul 03 2025 - 02:44:42 EST


> +/**
> + * ufshcd_dme_rmw - get modify set a dme attribute
> + * @hba - per adapter instance
> + * @mask - mask to apply on read value
> + * @val - actual value to write
> + * @attr - dme attribute
> + */
> +static inline int ufshcd_dme_rmw(struct ufs_hba *hba, u32 mask,
> + u32 val, u32 attr) {
> + u32 cfg = 0;
> + int err = 0;
> +
> + err = ufshcd_dme_get(hba, UIC_ARG_MIB(attr), &cfg);
> + if (err)
> + goto out;
> +
> + cfg &= ~mask;
> + cfg |= (val & mask);
> +
> + err = ufshcd_dme_set(hba, UIC_ARG_MIB(attr), cfg);
> +
> +out:
> + return err;
> +}
Might be useful to share this with other vendors as well. Maybe in ufshcd-priv.h ?

Thanks,
Avri