[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6089990e71830e699a9106eaff91e344e1d24c39.camel@wdc.com>
Date: Mon, 4 Jun 2018 08:46:03 +0000
From: Bart Van Assche <Bart.VanAssche@....com>
To: "jejb@...ux.vnet.ibm.com" <jejb@...ux.vnet.ibm.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"martin.petersen@...cle.com" <martin.petersen@...cle.com>,
"evgreen@...omium.org" <evgreen@...omium.org>,
"vinholikatti@...il.com" <vinholikatti@...il.com>,
Stanislav Nijnikov <Stanislav.Nijnikov@....com>
CC: "gwendal@...omium.org" <gwendal@...omium.org>
Subject: Re: [PATCH 6/7] scsi: ufs: Enable writing config descriptor
On Tue, 2018-05-29 at 11:17 -0700, Evan Green wrote:
> This change enables writing to fields of the config descriptor
> via sysfs. It can be used to provision an unprovisioned UFS
> device, or reprovision an unlocked device.
>
> Signed-off-by: Evan Green <evgreen@...omium.org>
> ---
> drivers/scsi/ufs/ufs-sysfs.c | 64 +++++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 61 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c
> index 623c56074572..54e9f3bca9db 100644
> --- a/drivers/scsi/ufs/ufs-sysfs.c
> +++ b/drivers/scsi/ufs/ufs-sysfs.c
> @@ -252,6 +252,31 @@ static ssize_t ufs_sysfs_read_desc_param(struct ufs_hba *hba,
> return ret;
> }
>
> +static ssize_t ufs_sysfs_write_desc_param(struct ufs_hba *hba,
> + enum desc_idn desc_id,
> + u8 desc_index,
> + u8 param_offset,
> + const char *buf,
> + ssize_t buf_size,
> + u8 width)
> +{
> + int ret;
> + unsigned long long value;
> +
> + if (kstrtoull(buf, 0, &value))
> + return -EINVAL;
> +
> + /* Convert to big endian, and send only the appropriate width. */
> + value = cpu_to_be64(value);
> + ret = ufshcd_rw_desc_param(hba, UPIU_QUERY_OPCODE_WRITE_DESC, desc_id,
> + desc_index, param_offset,
> + (u8 *)&value + 8 - width, width);
Instead of using the above construct, please provide separate versions of
ufs_sysfs_write_desc_param() and ufshcd_rw_desc_param() for each supported
value of "width" (8, 16, 32 and/or 64) and also use the __be8 / __be16 /
__be32 / __be64 annotations for big endian numbers such that it becomes
possible to verify endianness correctness with sparse.
Thanks,
Bart.
Powered by blists - more mailing lists