* [PATCH] iio: adc: vf610_adc: Convert to use sysfs_emit_at() API
@ 2022-12-07 7:34 ye.xingchen
2022-12-09 8:28 ` Bough Chen
0 siblings, 1 reply; 2+ messages in thread
From: ye.xingchen @ 2022-12-07 7:34 UTC (permalink / raw)
To: jic23
Cc: haibo.chen, andriy.shevchenko, lars, linux-iio, linux-imx,
linux-kernel
From: ye xingchen <ye.xingchen@zte.com.cn>
Follow the advice of the Documentation/filesystems/sysfs.rst and show()
should only use sysfs_emit() or sysfs_emit_at() when formatting the
value to be returned to user space.
Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
---
drivers/iio/adc/vf610_adc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/iio/adc/vf610_adc.c b/drivers/iio/adc/vf610_adc.c
index ae31aafd2653..dbf80f5f674b 100644
--- a/drivers/iio/adc/vf610_adc.c
+++ b/drivers/iio/adc/vf610_adc.c
@@ -606,8 +606,7 @@ static ssize_t vf610_show_samp_freq_avail(struct device *dev,
int i;
for (i = 0; i < ARRAY_SIZE(info->sample_freq_avail); i++)
- len += scnprintf(buf + len, PAGE_SIZE - len,
- "%u ", info->sample_freq_avail[i]);
+ len += sysfs_emit_at(buf, len, "%u ", info->sample_freq_avail[i]);
/* replace trailing space by newline */
buf[len - 1] = '\n';
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH] iio: adc: vf610_adc: Convert to use sysfs_emit_at() API
2022-12-07 7:34 [PATCH] iio: adc: vf610_adc: Convert to use sysfs_emit_at() API ye.xingchen
@ 2022-12-09 8:28 ` Bough Chen
0 siblings, 0 replies; 2+ messages in thread
From: Bough Chen @ 2022-12-09 8:28 UTC (permalink / raw)
To: ye.xingchen@zte.com.cn, jic23@kernel.org
Cc: andriy.shevchenko@linux.intel.com, lars@metafoo.de,
linux-iio@vger.kernel.org, dl-linux-imx,
linux-kernel@vger.kernel.org
> -----Original Message-----
> From: ye.xingchen@zte.com.cn <ye.xingchen@zte.com.cn>
> Sent: 2022年12月7日 15:35
> To: jic23@kernel.org
> Cc: Bough Chen <haibo.chen@nxp.com>; andriy.shevchenko@linux.intel.com;
> lars@metafoo.de; linux-iio@vger.kernel.org; dl-linux-imx <linux-imx@nxp.com>;
> linux-kernel@vger.kernel.org
> Subject: [PATCH] iio: adc: vf610_adc: Convert to use sysfs_emit_at() API
>
> From: ye xingchen <ye.xingchen@zte.com.cn>
>
> Follow the advice of the Documentation/filesystems/sysfs.rst and show() should
> only use sysfs_emit() or sysfs_emit_at() when formatting the value to be
> returned to user space.
>
> Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
Acked-by: Haibo Chen <haibo.chen@nxp.com>
Best Regards
Haibo Chen
> ---
> drivers/iio/adc/vf610_adc.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/iio/adc/vf610_adc.c b/drivers/iio/adc/vf610_adc.c index
> ae31aafd2653..dbf80f5f674b 100644
> --- a/drivers/iio/adc/vf610_adc.c
> +++ b/drivers/iio/adc/vf610_adc.c
> @@ -606,8 +606,7 @@ static ssize_t vf610_show_samp_freq_avail(struct
> device *dev,
> int i;
>
> for (i = 0; i < ARRAY_SIZE(info->sample_freq_avail); i++)
> - len += scnprintf(buf + len, PAGE_SIZE - len,
> - "%u ", info->sample_freq_avail[i]);
> + len += sysfs_emit_at(buf, len, "%u ", info->sample_freq_avail[i]);
>
> /* replace trailing space by newline */
> buf[len - 1] = '\n';
> --
> 2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-09 8:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-07 7:34 [PATCH] iio: adc: vf610_adc: Convert to use sysfs_emit_at() API ye.xingchen
2022-12-09 8:28 ` Bough Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox