summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Zhijian <lizhijian@fujitsu.com>2024-03-19 12:23:33 +0300
committerHelge Deller <deller@gmx.de>2024-03-21 21:37:20 +0300
commit763865fed8641920791580901a7dd1f100aa9452 (patch)
treef7df75ff4642f938bf171f189214a16120e57c59
parentc2d953276b8b27459baed1277a4fdd5dd9bd4126 (diff)
downloadlinux-763865fed8641920791580901a7dd1f100aa9452.tar.xz
fbdev: panel-tpo-td043mtea1: Convert sprintf() to sysfs_emit()
Per filesystems/sysfs.rst, show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. coccinelle complains that there are still a couple of functions that use snprintf(). Convert them to sysfs_emit(). CC: Helge Deller <deller@gmx.de> CC: linux-omap@vger.kernel.org CC: linux-fbdev@vger.kernel.org CC: dri-devel@lists.freedesktop.org Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> Signed-off-by: Helge Deller <deller@gmx.de>
-rw-r--r--drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c
index 477789cff8e0..d487941853e6 100644
--- a/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c
+++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c
@@ -225,17 +225,12 @@ static ssize_t tpo_td043_gamma_show(struct device *dev,
{
struct panel_drv_data *ddata = dev_get_drvdata(dev);
ssize_t len = 0;
- int ret;
int i;
- for (i = 0; i < ARRAY_SIZE(ddata->gamma); i++) {
- ret = snprintf(buf + len, PAGE_SIZE - len, "%u ",
- ddata->gamma[i]);
- if (ret < 0)
- return ret;
- len += ret;
- }
- buf[len - 1] = '\n';
+ for (i = 0; i < ARRAY_SIZE(ddata->gamma); i++)
+ len += sysfs_emit_at(buf, len, "%u ", ddata->gamma[i]);
+ if (len)
+ buf[len - 1] = '\n';
return len;
}