2022-08-31 12:31:27

by Xuezhi Zhang

[permalink] [raw]
Subject: [PATCH] comedi: sysfs: convert sysfs snprintf to sysfs_emit

From: zhangxuezhi1 <[email protected]>

Fix up all sysfs show entries to use sysfs_emit

Signed-off-by: zhangxuezhi1 <[email protected]>
---
drivers/comedi/comedi_fops.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/comedi/comedi_fops.c b/drivers/comedi/comedi_fops.c
index 55a0cae04b8d..e2114bcf815a 100644
--- a/drivers/comedi/comedi_fops.c
+++ b/drivers/comedi/comedi_fops.c
@@ -396,7 +396,7 @@ static ssize_t max_read_buffer_kb_show(struct device *csdev,
mutex_unlock(&dev->mutex);

comedi_dev_put(dev);
- return snprintf(buf, PAGE_SIZE, "%u\n", size);
+ return sysfs_emit(buf, "%u\n", size);
}

static ssize_t max_read_buffer_kb_store(struct device *csdev,
@@ -452,7 +452,7 @@ static ssize_t read_buffer_kb_show(struct device *csdev,
mutex_unlock(&dev->mutex);

comedi_dev_put(dev);
- return snprintf(buf, PAGE_SIZE, "%u\n", size);
+ return sysfs_emit(buf, "%u\n", size);
}

static ssize_t read_buffer_kb_store(struct device *csdev,
@@ -509,7 +509,7 @@ static ssize_t max_write_buffer_kb_show(struct device *csdev,
mutex_unlock(&dev->mutex);

comedi_dev_put(dev);
- return snprintf(buf, PAGE_SIZE, "%u\n", size);
+ return sysfs_emit(buf, "%u\n", size);
}

static ssize_t max_write_buffer_kb_store(struct device *csdev,
@@ -565,7 +565,7 @@ static ssize_t write_buffer_kb_show(struct device *csdev,
mutex_unlock(&dev->mutex);

comedi_dev_put(dev);
- return snprintf(buf, PAGE_SIZE, "%u\n", size);
+ return sysfs_emit(buf, "%u\n", size);
}

static ssize_t write_buffer_kb_store(struct device *csdev,
--
2.25.1


2022-08-31 13:17:01

by Xuezhi Zhang

[permalink] [raw]
Subject: Re: [PATCH] comedi: sysfs: convert sysfs snprintf to sysfs_emit

On Wed, 31 Aug 2022 13:33:18 +0100
Ian Abbott <[email protected]> wrote:

> On 31/08/2022 13:14, Xuezhi Zhang wrote:
> > From: zhangxuezhi1 <[email protected]>
> >
> > Fix up all sysfs show entries to use sysfs_emit
> >
> > Signed-off-by: zhangxuezhi1 <[email protected]>
>
> The patch looks fine apart from the Signed-off-by line. Please use a
> proper name for the Signed-off-by line. Generally, a romanized
> version of the forename(s) (given name(s)) followed by the surname
> (family name) is preferred, for example: Xuezhi Zhang.
>
> Could you please post a "PATCH v2" with a proper Signed-off-by line?
> Thanks.
Hi,
OK, I see.

Thanks.

> > ---
> > drivers/comedi/comedi_fops.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/comedi/comedi_fops.c
> > b/drivers/comedi/comedi_fops.c index 55a0cae04b8d..e2114bcf815a
> > 100644 --- a/drivers/comedi/comedi_fops.c
> > +++ b/drivers/comedi/comedi_fops.c
> > @@ -396,7 +396,7 @@ static ssize_t max_read_buffer_kb_show(struct
> > device *csdev, mutex_unlock(&dev->mutex);
> >
> > comedi_dev_put(dev);
> > - return snprintf(buf, PAGE_SIZE, "%u\n", size);
> > + return sysfs_emit(buf, "%u\n", size);
> > }
> >
> > static ssize_t max_read_buffer_kb_store(struct device *csdev,
> > @@ -452,7 +452,7 @@ static ssize_t read_buffer_kb_show(struct
> > device *csdev, mutex_unlock(&dev->mutex);
> >
> > comedi_dev_put(dev);
> > - return snprintf(buf, PAGE_SIZE, "%u\n", size);
> > + return sysfs_emit(buf, "%u\n", size);
> > }
> >
> > static ssize_t read_buffer_kb_store(struct device *csdev,
> > @@ -509,7 +509,7 @@ static ssize_t max_write_buffer_kb_show(struct
> > device *csdev, mutex_unlock(&dev->mutex);
> >
> > comedi_dev_put(dev);
> > - return snprintf(buf, PAGE_SIZE, "%u\n", size);
> > + return sysfs_emit(buf, "%u\n", size);
> > }
> >
> > static ssize_t max_write_buffer_kb_store(struct device *csdev,
> > @@ -565,7 +565,7 @@ static ssize_t write_buffer_kb_show(struct
> > device *csdev, mutex_unlock(&dev->mutex);
> >
> > comedi_dev_put(dev);
> > - return snprintf(buf, PAGE_SIZE, "%u\n", size);
> > + return sysfs_emit(buf, "%u\n", size);
> > }
> >
> > static ssize_t write_buffer_kb_store(struct device *csdev,
>

2022-08-31 13:18:10

by Ian Abbott

[permalink] [raw]
Subject: Re: [PATCH] comedi: sysfs: convert sysfs snprintf to sysfs_emit

On 31/08/2022 13:14, Xuezhi Zhang wrote:
> From: zhangxuezhi1 <[email protected]>
>
> Fix up all sysfs show entries to use sysfs_emit
>
> Signed-off-by: zhangxuezhi1 <[email protected]>

The patch looks fine apart from the Signed-off-by line. Please use a
proper name for the Signed-off-by line. Generally, a romanized version
of the forename(s) (given name(s)) followed by the surname (family name)
is preferred, for example: Xuezhi Zhang.

Could you please post a "PATCH v2" with a proper Signed-off-by line?
Thanks.

> ---
> drivers/comedi/comedi_fops.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/comedi/comedi_fops.c b/drivers/comedi/comedi_fops.c
> index 55a0cae04b8d..e2114bcf815a 100644
> --- a/drivers/comedi/comedi_fops.c
> +++ b/drivers/comedi/comedi_fops.c
> @@ -396,7 +396,7 @@ static ssize_t max_read_buffer_kb_show(struct device *csdev,
> mutex_unlock(&dev->mutex);
>
> comedi_dev_put(dev);
> - return snprintf(buf, PAGE_SIZE, "%u\n", size);
> + return sysfs_emit(buf, "%u\n", size);
> }
>
> static ssize_t max_read_buffer_kb_store(struct device *csdev,
> @@ -452,7 +452,7 @@ static ssize_t read_buffer_kb_show(struct device *csdev,
> mutex_unlock(&dev->mutex);
>
> comedi_dev_put(dev);
> - return snprintf(buf, PAGE_SIZE, "%u\n", size);
> + return sysfs_emit(buf, "%u\n", size);
> }
>
> static ssize_t read_buffer_kb_store(struct device *csdev,
> @@ -509,7 +509,7 @@ static ssize_t max_write_buffer_kb_show(struct device *csdev,
> mutex_unlock(&dev->mutex);
>
> comedi_dev_put(dev);
> - return snprintf(buf, PAGE_SIZE, "%u\n", size);
> + return sysfs_emit(buf, "%u\n", size);
> }
>
> static ssize_t max_write_buffer_kb_store(struct device *csdev,
> @@ -565,7 +565,7 @@ static ssize_t write_buffer_kb_show(struct device *csdev,
> mutex_unlock(&dev->mutex);
>
> comedi_dev_put(dev);
> - return snprintf(buf, PAGE_SIZE, "%u\n", size);
> + return sysfs_emit(buf, "%u\n", size);
> }
>
> static ssize_t write_buffer_kb_store(struct device *csdev,

--
-=( Ian Abbott <[email protected]> || MEV Ltd. is a company )=-
-=( registered in England & Wales. Regd. number: 02862268. )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || http://www.mev.co.uk )=-