[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210513034650.252993-1-phind.uet@gmail.com>
Date: Thu, 13 May 2021 11:46:50 +0800
From: Nguyen Dinh Phi <phind.uet@...il.com>
To: mchehab@...nel.org, sakari.ailus@...ux.intel.com,
gregkh@...uxfoundation.org, andriy.shevchenko@...ux.intel.com
Cc: linux-media@...r.kernel.org, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: [PATCH] Staging: atomisp: Use sysfs_emit() instead of sprintf() where appropriate
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@...il.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
Powered by blists - more mailing lists