Commit e3502ce9 authored by Tomi Valkeinen's avatar Tomi Valkeinen

OMAP: DSS2: Convert simple/strict_strto* to kstrto*

Convert simple/strict_strto* functions to kstrto* functions. Only simple
cases are converted.

simple_strto* uses are still left to places where it is used to parse
numbers from a list of numbers. These need some other solution than
kstrto*.
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 7636b3b4
...@@ -144,13 +144,15 @@ static ssize_t tpo_td043_vmirror_store(struct device *dev, ...@@ -144,13 +144,15 @@ static ssize_t tpo_td043_vmirror_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count) struct device_attribute *attr, const char *buf, size_t count)
{ {
struct tpo_td043_device *tpo_td043 = dev_get_drvdata(dev); struct tpo_td043_device *tpo_td043 = dev_get_drvdata(dev);
long val; int val;
int ret; int ret;
ret = strict_strtol(buf, 0, &val); ret = kstrtoint(buf, 0, &val);
if (ret < 0) if (ret < 0)
return ret; return ret;
val = !!val;
ret = tpo_td043_write_mirror(tpo_td043->spi, tpo_td043->hmirror, val); ret = tpo_td043_write_mirror(tpo_td043->spi, tpo_td043->hmirror, val);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -175,7 +177,7 @@ static ssize_t tpo_td043_mode_store(struct device *dev, ...@@ -175,7 +177,7 @@ static ssize_t tpo_td043_mode_store(struct device *dev,
long val; long val;
int ret; int ret;
ret = strict_strtol(buf, 0, &val); ret = kstrtol(buf, 0, &val);
if (ret != 0 || val & ~7) if (ret != 0 || val & ~7)
return -EINVAL; return -EINVAL;
......
...@@ -44,9 +44,13 @@ static ssize_t display_enabled_store(struct device *dev, ...@@ -44,9 +44,13 @@ static ssize_t display_enabled_store(struct device *dev,
const char *buf, size_t size) const char *buf, size_t size)
{ {
struct omap_dss_device *dssdev = to_dss_device(dev); struct omap_dss_device *dssdev = to_dss_device(dev);
bool enabled, r; int r, enabled;
enabled = simple_strtoul(buf, NULL, 10); r = kstrtoint(buf, 0, &enabled);
if (r)
return r;
enabled = !!enabled;
if (enabled != (dssdev->state != OMAP_DSS_DISPLAY_DISABLED)) { if (enabled != (dssdev->state != OMAP_DSS_DISPLAY_DISABLED)) {
if (enabled) { if (enabled) {
...@@ -82,7 +86,9 @@ static ssize_t display_upd_mode_store(struct device *dev, ...@@ -82,7 +86,9 @@ static ssize_t display_upd_mode_store(struct device *dev,
if (!dssdev->driver->set_update_mode) if (!dssdev->driver->set_update_mode)
return -EINVAL; return -EINVAL;
val = simple_strtoul(buf, NULL, 10); r = kstrtoint(buf, 0, &val);
if (r)
return r;
switch (val) { switch (val) {
case OMAP_DSS_UPDATE_DISABLED: case OMAP_DSS_UPDATE_DISABLED:
...@@ -114,13 +120,16 @@ static ssize_t display_tear_store(struct device *dev, ...@@ -114,13 +120,16 @@ static ssize_t display_tear_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t size) struct device_attribute *attr, const char *buf, size_t size)
{ {
struct omap_dss_device *dssdev = to_dss_device(dev); struct omap_dss_device *dssdev = to_dss_device(dev);
unsigned long te; int te, r;
int r;
if (!dssdev->driver->enable_te || !dssdev->driver->get_te) if (!dssdev->driver->enable_te || !dssdev->driver->get_te)
return -ENOENT; return -ENOENT;
te = simple_strtoul(buf, NULL, 0); r = kstrtoint(buf, 0, &te);
if (r)
return r;
te = !!te;
r = dssdev->driver->enable_te(dssdev, te); r = dssdev->driver->enable_te(dssdev, te);
if (r) if (r)
...@@ -196,13 +205,14 @@ static ssize_t display_rotate_store(struct device *dev, ...@@ -196,13 +205,14 @@ static ssize_t display_rotate_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t size) struct device_attribute *attr, const char *buf, size_t size)
{ {
struct omap_dss_device *dssdev = to_dss_device(dev); struct omap_dss_device *dssdev = to_dss_device(dev);
unsigned long rot; int rot, r;
int r;
if (!dssdev->driver->set_rotate || !dssdev->driver->get_rotate) if (!dssdev->driver->set_rotate || !dssdev->driver->get_rotate)
return -ENOENT; return -ENOENT;
rot = simple_strtoul(buf, NULL, 0); r = kstrtoint(buf, 0, &rot);
if (r)
return r;
r = dssdev->driver->set_rotate(dssdev, rot); r = dssdev->driver->set_rotate(dssdev, rot);
if (r) if (r)
...@@ -226,13 +236,16 @@ static ssize_t display_mirror_store(struct device *dev, ...@@ -226,13 +236,16 @@ static ssize_t display_mirror_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t size) struct device_attribute *attr, const char *buf, size_t size)
{ {
struct omap_dss_device *dssdev = to_dss_device(dev); struct omap_dss_device *dssdev = to_dss_device(dev);
unsigned long mirror; int mirror, r;
int r;
if (!dssdev->driver->set_mirror || !dssdev->driver->get_mirror) if (!dssdev->driver->set_mirror || !dssdev->driver->get_mirror)
return -ENOENT; return -ENOENT;
mirror = simple_strtoul(buf, NULL, 0); r = kstrtoint(buf, 0, &mirror);
if (r)
return r;
mirror = !!mirror;
r = dssdev->driver->set_mirror(dssdev, mirror); r = dssdev->driver->set_mirror(dssdev, mirror);
if (r) if (r)
...@@ -259,14 +272,15 @@ static ssize_t display_wss_store(struct device *dev, ...@@ -259,14 +272,15 @@ static ssize_t display_wss_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t size) struct device_attribute *attr, const char *buf, size_t size)
{ {
struct omap_dss_device *dssdev = to_dss_device(dev); struct omap_dss_device *dssdev = to_dss_device(dev);
unsigned long wss; u32 wss;
int r; int r;
if (!dssdev->driver->get_wss || !dssdev->driver->set_wss) if (!dssdev->driver->get_wss || !dssdev->driver->set_wss)
return -ENOENT; return -ENOENT;
if (strict_strtoul(buf, 0, &wss)) r = kstrtou32(buf, 0, &wss);
return -EINVAL; if (r)
return r;
if (wss > 0xfffff) if (wss > 0xfffff)
return -EINVAL; return -EINVAL;
......
...@@ -201,12 +201,16 @@ static ssize_t overlay_enabled_show(struct omap_overlay *ovl, char *buf) ...@@ -201,12 +201,16 @@ static ssize_t overlay_enabled_show(struct omap_overlay *ovl, char *buf)
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,
size_t size) size_t size)
{ {
int r; int r, enable;
struct omap_overlay_info info; struct omap_overlay_info info;
ovl->get_overlay_info(ovl, &info); ovl->get_overlay_info(ovl, &info);
info.enabled = simple_strtoul(buf, NULL, 10); r = kstrtoint(buf, 0, &enable);
if (r)
return r;
info.enabled = !!enable;
r = ovl->set_overlay_info(ovl, &info); r = ovl->set_overlay_info(ovl, &info);
if (r) if (r)
...@@ -231,8 +235,13 @@ static ssize_t overlay_global_alpha_store(struct omap_overlay *ovl, ...@@ -231,8 +235,13 @@ static ssize_t overlay_global_alpha_store(struct omap_overlay *ovl,
const char *buf, size_t size) const char *buf, size_t size)
{ {
int r; int r;
u8 alpha;
struct omap_overlay_info info; struct omap_overlay_info info;
r = kstrtou8(buf, 0, &alpha);
if (r)
return r;
ovl->get_overlay_info(ovl, &info); ovl->get_overlay_info(ovl, &info);
/* Video1 plane does not support global alpha /* Video1 plane does not support global alpha
...@@ -242,7 +251,7 @@ static ssize_t overlay_global_alpha_store(struct omap_overlay *ovl, ...@@ -242,7 +251,7 @@ static ssize_t overlay_global_alpha_store(struct omap_overlay *ovl,
ovl->id == OMAP_DSS_VIDEO1) ovl->id == OMAP_DSS_VIDEO1)
info.global_alpha = 255; info.global_alpha = 255;
else else
info.global_alpha = simple_strtoul(buf, NULL, 10); info.global_alpha = alpha;
r = ovl->set_overlay_info(ovl, &info); r = ovl->set_overlay_info(ovl, &info);
if (r) if (r)
...@@ -268,8 +277,13 @@ static ssize_t overlay_pre_mult_alpha_store(struct omap_overlay *ovl, ...@@ -268,8 +277,13 @@ static ssize_t overlay_pre_mult_alpha_store(struct omap_overlay *ovl,
const char *buf, size_t size) const char *buf, size_t size)
{ {
int r; int r;
u8 alpha;
struct omap_overlay_info info; struct omap_overlay_info info;
r = kstrtou8(buf, 0, &alpha);
if (r)
return r;
ovl->get_overlay_info(ovl, &info); ovl->get_overlay_info(ovl, &info);
/* only GFX and Video2 plane support pre alpha multiplied /* only GFX and Video2 plane support pre alpha multiplied
...@@ -279,7 +293,7 @@ static ssize_t overlay_pre_mult_alpha_store(struct omap_overlay *ovl, ...@@ -279,7 +293,7 @@ static ssize_t overlay_pre_mult_alpha_store(struct omap_overlay *ovl,
ovl->id == OMAP_DSS_VIDEO1) ovl->id == OMAP_DSS_VIDEO1)
info.pre_mult_alpha = 0; info.pre_mult_alpha = 0;
else else
info.pre_mult_alpha = simple_strtoul(buf, NULL, 10); info.pre_mult_alpha = alpha;
r = ovl->set_overlay_info(ovl, &info); r = ovl->set_overlay_info(ovl, &info);
if (r) if (r)
......
...@@ -50,10 +50,12 @@ static ssize_t store_rotate_type(struct device *dev, ...@@ -50,10 +50,12 @@ static ssize_t store_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);
struct omapfb2_mem_region *rg; struct omapfb2_mem_region *rg;
enum omap_dss_rotation_type rot_type; int rot_type;
int r; int r;
rot_type = simple_strtoul(buf, NULL, 0); r = kstrtoint(buf, 0, &rot_type);
if (r)
return r;
if (rot_type != OMAP_DSS_ROT_DMA && rot_type != OMAP_DSS_ROT_VRFB) if (rot_type != OMAP_DSS_ROT_DMA && rot_type != OMAP_DSS_ROT_VRFB)
return -EINVAL; return -EINVAL;
...@@ -102,14 +104,15 @@ static ssize_t store_mirror(struct device *dev, ...@@ -102,14 +104,15 @@ static ssize_t store_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);
unsigned long mirror; int mirror;
int r; int r;
struct fb_var_screeninfo new_var; struct fb_var_screeninfo new_var;
mirror = simple_strtoul(buf, NULL, 0); r = kstrtoint(buf, 0, &mirror);
if (r)
return r;
if (mirror != 0 && mirror != 1) mirror = !!mirror;
return -EINVAL;
if (!lock_fb_info(fbi)) if (!lock_fb_info(fbi))
return -ENODEV; return -ENODEV;
...@@ -445,7 +448,11 @@ static ssize_t store_size(struct device *dev, struct device_attribute *attr, ...@@ -445,7 +448,11 @@ static ssize_t store_size(struct device *dev, struct device_attribute *attr,
int r; int r;
int i; int i;
size = PAGE_ALIGN(simple_strtoul(buf, NULL, 0)); r = kstrtoul(buf, 0, &size);
if (r)
return r;
size = PAGE_ALIGN(size);
if (!lock_fb_info(fbi)) if (!lock_fb_info(fbi))
return -ENODEV; return -ENODEV;
......
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