@@ -1365,20 +1365,16 @@ static ssize_t omapfb_store_bklight_level(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t size)
{
+ unsigned int level;
struct omapfb_device *fbdev = dev_get_drvdata(dev);
- int r;
- if (fbdev->panel->set_bklight_level) {
- unsigned int level;
+ if (!fbdev->panel->set_bklight_level)
+ return -ENODEV;
- if (sscanf(buf, "%10d", &level) == 1) {
- r = fbdev->panel->set_bklight_level(fbdev->panel,
- level);
- } else
- r = -EINVAL;
- } else
- r = -ENODEV;
- return r ? r : size;
+ if (kstrtouint(buf, 10, &level) < 0)
+ return -EINVAL;
+
+ return fbdev->panel->set_bklight_level(fbdev->panel, level) ?: size;
}
static ssize_t omapfb_show_bklight_max(struct device *dev,