summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2026-06-19 14:08:16 +0300
committerSean Young <sean@mess.org>2026-09-01 09:52:12 +0100
commit274af88c8acaa4bb538791047bd17fa5136ba78f (patch)
treec10fe15f9c529dd983b439681a1569bb68a464c4 /drivers
parentaf452b9e01331b5338a1e5141624f17607239207 (diff)
downloadlinux-next-274af88c8acaa4bb538791047bd17fa5136ba78f.tar.gz
linux-next-274af88c8acaa4bb538791047bd17fa5136ba78f.zip
media: imon: use sysfs_emit() in associate_remote_show()
Prefer the convenient 'sysfs_emit()' over 'strscpy()' and 'strlen()' in 'associate_remote_show()' sysfs callback. Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Signed-off-by: Sean Young <sean@mess.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/rc/imon.c9
1 files 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,