Commit cc83ff24 authored by Qing Wang's avatar Qing Wang Committed by Sam Ravnborg

video: omapfb: replace snprintf in show functions with sysfs_emit

coccicheck complains about the use of snprintf() in sysfs show functions.

Fix the coccicheck warning:
WARNING: use scnprintf or sprintf.

Use sysfs_emit instead of scnprintf or sprintf makes more sense.
Signed-off-by: default avatarQing Wang <wangqing@vivo.com>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1634095693-4428-1-git-send-email-wangqing@vivo.com
parent 4701a0dd
...@@ -19,14 +19,14 @@ ...@@ -19,14 +19,14 @@
static ssize_t display_name_show(struct omap_dss_device *dssdev, char *buf) static ssize_t display_name_show(struct omap_dss_device *dssdev, char *buf)
{ {
return snprintf(buf, PAGE_SIZE, "%s\n", return sysfs_emit(buf, "%s\n",
dssdev->name ? dssdev->name ?
dssdev->name : ""); dssdev->name : "");
} }
static ssize_t display_enabled_show(struct omap_dss_device *dssdev, char *buf) static ssize_t display_enabled_show(struct omap_dss_device *dssdev, char *buf)
{ {
return snprintf(buf, PAGE_SIZE, "%d\n", return sysfs_emit(buf, "%d\n",
omapdss_device_is_enabled(dssdev)); omapdss_device_is_enabled(dssdev));
} }
...@@ -59,7 +59,7 @@ static ssize_t display_enabled_store(struct omap_dss_device *dssdev, ...@@ -59,7 +59,7 @@ static ssize_t display_enabled_store(struct omap_dss_device *dssdev,
static ssize_t display_tear_show(struct omap_dss_device *dssdev, char *buf) static ssize_t display_tear_show(struct omap_dss_device *dssdev, char *buf)
{ {
return snprintf(buf, PAGE_SIZE, "%d\n", return sysfs_emit(buf, "%d\n",
dssdev->driver->get_te ? dssdev->driver->get_te ?
dssdev->driver->get_te(dssdev) : 0); dssdev->driver->get_te(dssdev) : 0);
} }
...@@ -93,7 +93,7 @@ static ssize_t display_timings_show(struct omap_dss_device *dssdev, char *buf) ...@@ -93,7 +93,7 @@ static ssize_t display_timings_show(struct omap_dss_device *dssdev, char *buf)
dssdev->driver->get_timings(dssdev, &t); dssdev->driver->get_timings(dssdev, &t);
return snprintf(buf, PAGE_SIZE, "%u,%u/%u/%u/%u,%u/%u/%u/%u\n", return sysfs_emit(buf, "%u,%u/%u/%u/%u,%u/%u/%u/%u\n",
t.pixelclock, t.pixelclock,
t.x_res, t.hfp, t.hbp, t.hsw, t.x_res, t.hfp, t.hbp, t.hsw,
t.y_res, t.vfp, t.vbp, t.vsw); t.y_res, t.vfp, t.vbp, t.vsw);
...@@ -143,7 +143,7 @@ static ssize_t display_rotate_show(struct omap_dss_device *dssdev, char *buf) ...@@ -143,7 +143,7 @@ static ssize_t display_rotate_show(struct omap_dss_device *dssdev, char *buf)
if (!dssdev->driver->get_rotate) if (!dssdev->driver->get_rotate)
return -ENOENT; return -ENOENT;
rotate = dssdev->driver->get_rotate(dssdev); rotate = dssdev->driver->get_rotate(dssdev);
return snprintf(buf, PAGE_SIZE, "%u\n", rotate); return sysfs_emit(buf, "%u\n", rotate);
} }
static ssize_t display_rotate_store(struct omap_dss_device *dssdev, static ssize_t display_rotate_store(struct omap_dss_device *dssdev,
...@@ -171,7 +171,7 @@ static ssize_t display_mirror_show(struct omap_dss_device *dssdev, char *buf) ...@@ -171,7 +171,7 @@ static ssize_t display_mirror_show(struct omap_dss_device *dssdev, char *buf)
if (!dssdev->driver->get_mirror) if (!dssdev->driver->get_mirror)
return -ENOENT; return -ENOENT;
mirror = dssdev->driver->get_mirror(dssdev); mirror = dssdev->driver->get_mirror(dssdev);
return snprintf(buf, PAGE_SIZE, "%u\n", mirror); return sysfs_emit(buf, "%u\n", mirror);
} }
static ssize_t display_mirror_store(struct omap_dss_device *dssdev, static ssize_t display_mirror_store(struct omap_dss_device *dssdev,
...@@ -203,7 +203,7 @@ static ssize_t display_wss_show(struct omap_dss_device *dssdev, char *buf) ...@@ -203,7 +203,7 @@ static ssize_t display_wss_show(struct omap_dss_device *dssdev, char *buf)
wss = dssdev->driver->get_wss(dssdev); wss = dssdev->driver->get_wss(dssdev);
return snprintf(buf, PAGE_SIZE, "0x%05x\n", wss); return sysfs_emit(buf, "0x%05x\n", wss);
} }
static ssize_t display_wss_store(struct omap_dss_device *dssdev, static ssize_t display_wss_store(struct omap_dss_device *dssdev,
......
...@@ -22,14 +22,14 @@ ...@@ -22,14 +22,14 @@
static ssize_t manager_name_show(struct omap_overlay_manager *mgr, char *buf) static ssize_t manager_name_show(struct omap_overlay_manager *mgr, char *buf)
{ {
return snprintf(buf, PAGE_SIZE, "%s\n", mgr->name); return sysfs_emit(buf, "%s\n", mgr->name);
} }
static ssize_t manager_display_show(struct omap_overlay_manager *mgr, char *buf) static ssize_t manager_display_show(struct omap_overlay_manager *mgr, char *buf)
{ {
struct omap_dss_device *dssdev = mgr->get_device(mgr); struct omap_dss_device *dssdev = mgr->get_device(mgr);
return snprintf(buf, PAGE_SIZE, "%s\n", dssdev ? return sysfs_emit(buf, "%s\n", dssdev ?
dssdev->name : "<none>"); dssdev->name : "<none>");
} }
...@@ -120,7 +120,7 @@ static ssize_t manager_default_color_show(struct omap_overlay_manager *mgr, ...@@ -120,7 +120,7 @@ static ssize_t manager_default_color_show(struct omap_overlay_manager *mgr,
mgr->get_manager_info(mgr, &info); mgr->get_manager_info(mgr, &info);
return snprintf(buf, PAGE_SIZE, "%#x\n", info.default_color); return sysfs_emit(buf, "%#x\n", info.default_color);
} }
static ssize_t manager_default_color_store(struct omap_overlay_manager *mgr, static ssize_t manager_default_color_store(struct omap_overlay_manager *mgr,
...@@ -165,7 +165,7 @@ static ssize_t manager_trans_key_type_show(struct omap_overlay_manager *mgr, ...@@ -165,7 +165,7 @@ static ssize_t manager_trans_key_type_show(struct omap_overlay_manager *mgr,
key_type = info.trans_key_type; key_type = info.trans_key_type;
BUG_ON(key_type >= ARRAY_SIZE(trans_key_type_str)); BUG_ON(key_type >= ARRAY_SIZE(trans_key_type_str));
return snprintf(buf, PAGE_SIZE, "%s\n", trans_key_type_str[key_type]); return sysfs_emit(buf, "%s\n", trans_key_type_str[key_type]);
} }
static ssize_t manager_trans_key_type_store(struct omap_overlay_manager *mgr, static ssize_t manager_trans_key_type_store(struct omap_overlay_manager *mgr,
...@@ -200,7 +200,7 @@ static ssize_t manager_trans_key_value_show(struct omap_overlay_manager *mgr, ...@@ -200,7 +200,7 @@ static ssize_t manager_trans_key_value_show(struct omap_overlay_manager *mgr,
mgr->get_manager_info(mgr, &info); mgr->get_manager_info(mgr, &info);
return snprintf(buf, PAGE_SIZE, "%#x\n", info.trans_key); return sysfs_emit(buf, "%#x\n", info.trans_key);
} }
static ssize_t manager_trans_key_value_store(struct omap_overlay_manager *mgr, static ssize_t manager_trans_key_value_store(struct omap_overlay_manager *mgr,
...@@ -236,7 +236,7 @@ static ssize_t manager_trans_key_enabled_show(struct omap_overlay_manager *mgr, ...@@ -236,7 +236,7 @@ static ssize_t manager_trans_key_enabled_show(struct omap_overlay_manager *mgr,
mgr->get_manager_info(mgr, &info); mgr->get_manager_info(mgr, &info);
return snprintf(buf, PAGE_SIZE, "%d\n", info.trans_enabled); return sysfs_emit(buf, "%d\n", info.trans_enabled);
} }
static ssize_t manager_trans_key_enabled_store(struct omap_overlay_manager *mgr, static ssize_t manager_trans_key_enabled_store(struct omap_overlay_manager *mgr,
...@@ -275,7 +275,7 @@ static ssize_t manager_alpha_blending_enabled_show( ...@@ -275,7 +275,7 @@ static ssize_t manager_alpha_blending_enabled_show(
mgr->get_manager_info(mgr, &info); mgr->get_manager_info(mgr, &info);
return snprintf(buf, PAGE_SIZE, "%d\n", return sysfs_emit(buf, "%d\n",
info.partial_alpha_enabled); info.partial_alpha_enabled);
} }
...@@ -316,7 +316,7 @@ static ssize_t manager_cpr_enable_show(struct omap_overlay_manager *mgr, ...@@ -316,7 +316,7 @@ static ssize_t manager_cpr_enable_show(struct omap_overlay_manager *mgr,
mgr->get_manager_info(mgr, &info); mgr->get_manager_info(mgr, &info);
return snprintf(buf, PAGE_SIZE, "%d\n", info.cpr_enable); return sysfs_emit(buf, "%d\n", info.cpr_enable);
} }
static ssize_t manager_cpr_enable_store(struct omap_overlay_manager *mgr, static ssize_t manager_cpr_enable_store(struct omap_overlay_manager *mgr,
...@@ -358,7 +358,7 @@ static ssize_t manager_cpr_coef_show(struct omap_overlay_manager *mgr, ...@@ -358,7 +358,7 @@ static ssize_t manager_cpr_coef_show(struct omap_overlay_manager *mgr,
mgr->get_manager_info(mgr, &info); mgr->get_manager_info(mgr, &info);
return snprintf(buf, PAGE_SIZE, return sysfs_emit(buf,
"%d %d %d %d %d %d %d %d %d\n", "%d %d %d %d %d %d %d %d %d\n",
info.cpr_coefs.rr, info.cpr_coefs.rr,
info.cpr_coefs.rg, info.cpr_coefs.rg,
......
...@@ -22,12 +22,12 @@ ...@@ -22,12 +22,12 @@
static ssize_t overlay_name_show(struct omap_overlay *ovl, char *buf) static ssize_t overlay_name_show(struct omap_overlay *ovl, char *buf)
{ {
return snprintf(buf, PAGE_SIZE, "%s\n", ovl->name); return sysfs_emit(buf, "%s\n", ovl->name);
} }
static ssize_t overlay_manager_show(struct omap_overlay *ovl, char *buf) static ssize_t overlay_manager_show(struct omap_overlay *ovl, char *buf)
{ {
return snprintf(buf, PAGE_SIZE, "%s\n", return sysfs_emit(buf, "%s\n",
ovl->manager ? ovl->manager->name : "<none>"); ovl->manager ? ovl->manager->name : "<none>");
} }
...@@ -108,7 +108,7 @@ static ssize_t overlay_input_size_show(struct omap_overlay *ovl, char *buf) ...@@ -108,7 +108,7 @@ static ssize_t overlay_input_size_show(struct omap_overlay *ovl, char *buf)
ovl->get_overlay_info(ovl, &info); ovl->get_overlay_info(ovl, &info);
return snprintf(buf, PAGE_SIZE, "%d,%d\n", return sysfs_emit(buf, "%d,%d\n",
info.width, info.height); info.width, info.height);
} }
...@@ -118,7 +118,7 @@ static ssize_t overlay_screen_width_show(struct omap_overlay *ovl, char *buf) ...@@ -118,7 +118,7 @@ static ssize_t overlay_screen_width_show(struct omap_overlay *ovl, char *buf)
ovl->get_overlay_info(ovl, &info); ovl->get_overlay_info(ovl, &info);
return snprintf(buf, PAGE_SIZE, "%d\n", info.screen_width); return sysfs_emit(buf, "%d\n", info.screen_width);
} }
static ssize_t overlay_position_show(struct omap_overlay *ovl, char *buf) static ssize_t overlay_position_show(struct omap_overlay *ovl, char *buf)
...@@ -127,7 +127,7 @@ static ssize_t overlay_position_show(struct omap_overlay *ovl, char *buf) ...@@ -127,7 +127,7 @@ static ssize_t overlay_position_show(struct omap_overlay *ovl, char *buf)
ovl->get_overlay_info(ovl, &info); ovl->get_overlay_info(ovl, &info);
return snprintf(buf, PAGE_SIZE, "%d,%d\n", return sysfs_emit(buf, "%d,%d\n",
info.pos_x, info.pos_y); info.pos_x, info.pos_y);
} }
...@@ -166,7 +166,7 @@ static ssize_t overlay_output_size_show(struct omap_overlay *ovl, char *buf) ...@@ -166,7 +166,7 @@ static ssize_t overlay_output_size_show(struct omap_overlay *ovl, char *buf)
ovl->get_overlay_info(ovl, &info); ovl->get_overlay_info(ovl, &info);
return snprintf(buf, PAGE_SIZE, "%d,%d\n", return sysfs_emit(buf, "%d,%d\n",
info.out_width, info.out_height); info.out_width, info.out_height);
} }
...@@ -201,7 +201,7 @@ static ssize_t overlay_output_size_store(struct omap_overlay *ovl, ...@@ -201,7 +201,7 @@ static ssize_t overlay_output_size_store(struct omap_overlay *ovl,
static ssize_t overlay_enabled_show(struct omap_overlay *ovl, char *buf) static ssize_t overlay_enabled_show(struct omap_overlay *ovl, char *buf)
{ {
return snprintf(buf, PAGE_SIZE, "%d\n", ovl->is_enabled(ovl)); return sysfs_emit(buf, "%d\n", ovl->is_enabled(ovl));
} }
static ssize_t overlay_enabled_store(struct omap_overlay *ovl, const char *buf, static ssize_t overlay_enabled_store(struct omap_overlay *ovl, const char *buf,
...@@ -231,7 +231,7 @@ static ssize_t overlay_global_alpha_show(struct omap_overlay *ovl, char *buf) ...@@ -231,7 +231,7 @@ static ssize_t overlay_global_alpha_show(struct omap_overlay *ovl, char *buf)
ovl->get_overlay_info(ovl, &info); ovl->get_overlay_info(ovl, &info);
return snprintf(buf, PAGE_SIZE, "%d\n", return sysfs_emit(buf, "%d\n",
info.global_alpha); info.global_alpha);
} }
...@@ -273,7 +273,7 @@ static ssize_t overlay_pre_mult_alpha_show(struct omap_overlay *ovl, ...@@ -273,7 +273,7 @@ static ssize_t overlay_pre_mult_alpha_show(struct omap_overlay *ovl,
ovl->get_overlay_info(ovl, &info); ovl->get_overlay_info(ovl, &info);
return snprintf(buf, PAGE_SIZE, "%d\n", return sysfs_emit(buf, "%d\n",
info.pre_mult_alpha); info.pre_mult_alpha);
} }
...@@ -314,7 +314,7 @@ static ssize_t overlay_zorder_show(struct omap_overlay *ovl, char *buf) ...@@ -314,7 +314,7 @@ static ssize_t overlay_zorder_show(struct omap_overlay *ovl, char *buf)
ovl->get_overlay_info(ovl, &info); ovl->get_overlay_info(ovl, &info);
return snprintf(buf, PAGE_SIZE, "%d\n", info.zorder); return sysfs_emit(buf, "%d\n", info.zorder);
} }
static ssize_t overlay_zorder_store(struct omap_overlay *ovl, static ssize_t overlay_zorder_store(struct omap_overlay *ovl,
......
...@@ -29,7 +29,7 @@ static ssize_t show_rotate_type(struct device *dev, ...@@ -29,7 +29,7 @@ static ssize_t show_rotate_type(struct device *dev,
struct fb_info *fbi = dev_get_drvdata(dev); struct fb_info *fbi = dev_get_drvdata(dev);
struct omapfb_info *ofbi = FB2OFB(fbi); struct omapfb_info *ofbi = FB2OFB(fbi);
return snprintf(buf, PAGE_SIZE, "%d\n", ofbi->rotation_type); return sysfs_emit(buf, "%d\n", ofbi->rotation_type);
} }
static ssize_t store_rotate_type(struct device *dev, static ssize_t store_rotate_type(struct device *dev,
...@@ -83,7 +83,7 @@ static ssize_t show_mirror(struct device *dev, ...@@ -83,7 +83,7 @@ static ssize_t show_mirror(struct device *dev,
struct fb_info *fbi = dev_get_drvdata(dev); struct fb_info *fbi = dev_get_drvdata(dev);
struct omapfb_info *ofbi = FB2OFB(fbi); struct omapfb_info *ofbi = FB2OFB(fbi);
return snprintf(buf, PAGE_SIZE, "%d\n", ofbi->mirror); return sysfs_emit(buf, "%d\n", ofbi->mirror);
} }
static ssize_t store_mirror(struct device *dev, static ssize_t store_mirror(struct device *dev,
...@@ -415,7 +415,7 @@ static ssize_t show_size(struct device *dev, ...@@ -415,7 +415,7 @@ static ssize_t show_size(struct device *dev,
struct fb_info *fbi = dev_get_drvdata(dev); struct fb_info *fbi = dev_get_drvdata(dev);
struct omapfb_info *ofbi = FB2OFB(fbi); struct omapfb_info *ofbi = FB2OFB(fbi);
return snprintf(buf, PAGE_SIZE, "%lu\n", ofbi->region->size); return sysfs_emit(buf, "%lu\n", ofbi->region->size);
} }
static ssize_t store_size(struct device *dev, struct device_attribute *attr, static ssize_t store_size(struct device *dev, struct device_attribute *attr,
...@@ -492,7 +492,7 @@ static ssize_t show_phys(struct device *dev, ...@@ -492,7 +492,7 @@ static ssize_t show_phys(struct device *dev,
struct fb_info *fbi = dev_get_drvdata(dev); struct fb_info *fbi = dev_get_drvdata(dev);
struct omapfb_info *ofbi = FB2OFB(fbi); struct omapfb_info *ofbi = FB2OFB(fbi);
return snprintf(buf, PAGE_SIZE, "%0x\n", ofbi->region->paddr); return sysfs_emit(buf, "%0x\n", ofbi->region->paddr);
} }
static ssize_t show_virt(struct device *dev, static ssize_t show_virt(struct device *dev,
...@@ -501,7 +501,7 @@ static ssize_t show_virt(struct device *dev, ...@@ -501,7 +501,7 @@ static ssize_t show_virt(struct device *dev,
struct fb_info *fbi = dev_get_drvdata(dev); struct fb_info *fbi = dev_get_drvdata(dev);
struct omapfb_info *ofbi = FB2OFB(fbi); struct omapfb_info *ofbi = FB2OFB(fbi);
return snprintf(buf, PAGE_SIZE, "%p\n", ofbi->region->vaddr); return sysfs_emit(buf, "%p\n", ofbi->region->vaddr);
} }
static ssize_t show_upd_mode(struct device *dev, static ssize_t show_upd_mode(struct device *dev,
...@@ -516,7 +516,7 @@ static ssize_t show_upd_mode(struct device *dev, ...@@ -516,7 +516,7 @@ static ssize_t show_upd_mode(struct device *dev,
if (r) if (r)
return r; return r;
return snprintf(buf, PAGE_SIZE, "%u\n", (unsigned)mode); return sysfs_emit(buf, "%u\n", (unsigned int)mode);
} }
static ssize_t store_upd_mode(struct device *dev, struct device_attribute *attr, static ssize_t store_upd_mode(struct device *dev, struct device_attribute *attr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment