* [PATCH] Staging: atomisp: Use sysfs_emit() instead of sprintf() where appropriate
@ 2021-05-13 3:46 Nguyen Dinh Phi
2021-05-25 16:37 ` Sakari Ailus
0 siblings, 1 reply; 2+ messages in thread
From: Nguyen Dinh Phi @ 2021-05-13 3:46 UTC (permalink / raw)
To: mchehab, sakari.ailus, gregkh, andriy.shevchenko
Cc: linux-media, linux-staging, linux-kernel
sysfs_emit() is preferred over raw sprintf() for sysfs attributes since it
knows about the sysfs buffer specifics and has some built-in sanity checks.
Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
---
drivers/staging/media/atomisp/pci/atomisp_drvfs.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_drvfs.c b/drivers/staging/media/atomisp/pci/atomisp_drvfs.c
index f670faf978e6..dcb571f515a7 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_drvfs.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_drvfs.c
@@ -96,7 +96,7 @@ static inline int iunit_dump_dbgopt(struct atomisp_device *isp,
static ssize_t iunit_dbglvl_show(struct device_driver *drv, char *buf)
{
iunit_debug.dbglvl = dbg_level;
- return sprintf(buf, "dtrace level:%u\n", iunit_debug.dbglvl);
+ return sysfs_emit(buf, "dtrace level:%u\n", iunit_debug.dbglvl);
}
static ssize_t iunit_dbglvl_store(struct device_driver *drv, const char *buf,
@@ -115,7 +115,7 @@ static ssize_t iunit_dbglvl_store(struct device_driver *drv, const char *buf,
static ssize_t iunit_dbgfun_show(struct device_driver *drv, char *buf)
{
iunit_debug.dbgfun = atomisp_get_css_dbgfunc();
- return sprintf(buf, "dbgfun opt:%u\n", iunit_debug.dbgfun);
+ return sysfs_emit(buf, "dbgfun opt:%u\n", iunit_debug.dbgfun);
}
static ssize_t iunit_dbgfun_store(struct device_driver *drv, const char *buf,
@@ -139,7 +139,7 @@ static ssize_t iunit_dbgfun_store(struct device_driver *drv, const char *buf,
static ssize_t iunit_dbgopt_show(struct device_driver *drv, char *buf)
{
- return sprintf(buf, "option:0x%x\n", iunit_debug.dbgopt);
+ return sysfs_emit(buf, "option:0x%x\n", iunit_debug.dbgopt);
}
static ssize_t iunit_dbgopt_store(struct device_driver *drv, const char *buf,
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Staging: atomisp: Use sysfs_emit() instead of sprintf() where appropriate
2021-05-13 3:46 [PATCH] Staging: atomisp: Use sysfs_emit() instead of sprintf() where appropriate Nguyen Dinh Phi
@ 2021-05-25 16:37 ` Sakari Ailus
0 siblings, 0 replies; 2+ messages in thread
From: Sakari Ailus @ 2021-05-25 16:37 UTC (permalink / raw)
To: Nguyen Dinh Phi
Cc: mchehab, gregkh, andriy.shevchenko, linux-media, linux-staging,
linux-kernel
On Thu, May 13, 2021 at 11:46:50AM +0800, Nguyen Dinh Phi wrote:
> sysfs_emit() is preferred over raw sprintf() for sysfs attributes since it
> knows about the sysfs buffer specifics and has some built-in sanity checks.
>
> Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
--
Sakari Ailus
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-25 16:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13 3:46 [PATCH] Staging: atomisp: Use sysfs_emit() instead of sprintf() where appropriate Nguyen Dinh Phi
2021-05-25 16:37 ` Sakari Ailus
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.