* [PATCH v2] iio: light: vcnl4000: use sysfs_emit() for near_level
@ 2026-08-30 18:53 Donggeun Yoo
2026-08-31 9:12 ` Joshua Crofts
0 siblings, 1 reply; 3+ messages in thread
From: Donggeun Yoo @ 2026-08-30 18:53 UTC (permalink / raw)
To: Jonathan Cameron
Cc: David Lechner, Nuno Sá, Andy Shevchenko, Joshua Crofts,
linux-iio, linux-kernel, Donggeun Yoo
Use sysfs_emit() instead of sprintf() for writing to the sysfs
output buffer. sysfs_emit() is aware of the buffer's PAGE_SIZE
limit and is the preferred helper for sysfs callbacks.
Signed-off-by: Donggeun Yoo <donggeunyoo.kernel@gmail.com>
---
v1 -> v2: Add #include <linux/sysfs.h> for sysfs_emit() instead of
relying on transitive includes. (Suggested by Joshua Crofts)
v1: https://lore.kernel.org/linux-iio/20260830054237.2147950-1-donggeunyoo.kernel@gmail.com/
drivers/iio/light/vcnl4000.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
index 336468d59ea7..911f8d1c74d4 100644
--- a/drivers/iio/light/vcnl4000.c
+++ b/drivers/iio/light/vcnl4000.c
@@ -26,6 +26,7 @@
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h>
+#include <linux/sysfs.h>
#include <linux/units.h>
#include <linux/iio/buffer.h>
@@ -1504,7 +1505,7 @@ static ssize_t vcnl4000_read_near_level(struct iio_dev *indio_dev,
{
struct vcnl4000_data *data = iio_priv(indio_dev);
- return sprintf(buf, "%u\n", data->near_level);
+ return sysfs_emit(buf, "%u\n", data->near_level);
}
static irqreturn_t vcnl4010_irq_thread(int irq, void *p)
base-commit: 350d1fb9204b13c5f95e511e98b8bcb47574d425
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] iio: light: vcnl4000: use sysfs_emit() for near_level
2026-08-30 18:53 [PATCH v2] iio: light: vcnl4000: use sysfs_emit() for near_level Donggeun Yoo
@ 2026-08-31 9:12 ` Joshua Crofts
2026-09-01 16:02 ` Jonathan Cameron
0 siblings, 1 reply; 3+ messages in thread
From: Joshua Crofts @ 2026-08-31 9:12 UTC (permalink / raw)
To: Donggeun Yoo
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
linux-iio, linux-kernel
On Mon, 31 Aug 2026 03:53:45 +0900
Donggeun Yoo <donggeunyoo.kernel@gmail.com> wrote:
> Use sysfs_emit() instead of sprintf() for writing to the sysfs
> output buffer. sysfs_emit() is aware of the buffer's PAGE_SIZE
> limit and is the preferred helper for sysfs callbacks.
>
> Signed-off-by: Donggeun Yoo <donggeunyoo.kernel@gmail.com>
> ---
Seems fine.
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
--
Kind regards,
Joshua Crofts
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] iio: light: vcnl4000: use sysfs_emit() for near_level
2026-08-31 9:12 ` Joshua Crofts
@ 2026-09-01 16:02 ` Jonathan Cameron
0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2026-09-01 16:02 UTC (permalink / raw)
To: Joshua Crofts
Cc: Donggeun Yoo, David Lechner, Nuno Sá, Andy Shevchenko,
linux-iio, linux-kernel
On Mon, 31 Aug 2026 11:12:43 +0200
Joshua Crofts <joshua.crofts1@gmail.com> wrote:
> On Mon, 31 Aug 2026 03:53:45 +0900
> Donggeun Yoo <donggeunyoo.kernel@gmail.com> wrote:
>
> > Use sysfs_emit() instead of sprintf() for writing to the sysfs
> > output buffer. sysfs_emit() is aware of the buffer's PAGE_SIZE
> > limit and is the preferred helper for sysfs callbacks.
> >
> > Signed-off-by: Donggeun Yoo <donggeunyoo.kernel@gmail.com>
> > ---
>
> Seems fine.
>
> Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
>
Applied. Forgot to say the other day (or update patchwork).
J
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-01 16:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-30 18:53 [PATCH v2] iio: light: vcnl4000: use sysfs_emit() for near_level Donggeun Yoo
2026-08-31 9:12 ` Joshua Crofts
2026-09-01 16:02 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox