On Fri Jun 19 14:08:16 2026 +0300, Dmitry Antipov wrote:
> Prefer the convenient 'sysfs_emit()' over 'strscpy()' and
> 'strlen()' in 'associate_remote_show()' sysfs callback.
>
> Signed-off-by: Dmitry Antipov <[email protected]>
> Signed-off-by: Sean Young <[email protected]>
Patch committed.
Thanks,
Sean Young
drivers/media/rc/imon.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index 049a73b5f882..621554005f2f 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -805,19 +805,16 @@ static ssize_t associate_remote_show(struct device *d,
char *buf)
{
struct imon_context *ictx = dev_get_drvdata(d);
+ int len;
if (!ictx)
return -ENODEV;
mutex_lock(&ictx->lock);
- if (ictx->rf_isassociating)
- strscpy(buf, "associating\n", PAGE_SIZE);
- else
- strscpy(buf, "closed\n", PAGE_SIZE);
-
+ len = sysfs_emit(buf, (ictx->rf_isassociating ? "associating\n" :
"closed\n"));
dev_info(d, "Visit https://www.lirc.org/html/imon-24g.html for
instructions on how to associate your iMON 2.4G DT/LT remote\n");
mutex_unlock(&ictx->lock);
- return strlen(buf);
+ return len;
}
static ssize_t associate_remote_store(struct device *d,
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]