Skip to content

Commit

Permalink
fbdev: panel-tpo-td043mtea1: Convert sprintf() to sysfs_emit()
Browse files Browse the repository at this point in the history
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 <[email protected]>
CC: [email protected]
CC: [email protected]
CC: [email protected]
Signed-off-by: Li Zhijian <[email protected]>
Signed-off-by: Helge Deller <[email protected]>
  • Loading branch information
zhijianli88 authored and hdeller committed Mar 21, 2024
1 parent c2d9532 commit 763865f
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 763865f

Please sign in to comment.