Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 26712
b: refs/heads/master
c: 68673af
h: refs/heads/master
v: v3
  • Loading branch information
Richard Purdie authored and Linus Torvalds committed May 15, 2006
1 parent 71eb071 commit 611efc0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a8d2e7d95229db9999682113bfac40b49978f212
refs/heads/master: 68673afd443c5eeb4cebfb9026e3675f43d79f2b
18 changes: 12 additions & 6 deletions trunk/drivers/video/backlight/backlight.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ static ssize_t backlight_show_power(struct class_device *cdev, char *buf)

static ssize_t backlight_store_power(struct class_device *cdev, const char *buf, size_t count)
{
int rc = -ENXIO, power;
int rc = -ENXIO;
char *endp;
struct backlight_device *bd = to_backlight_device(cdev);
int power = simple_strtoul(buf, &endp, 0);
size_t size = endp - buf;

power = simple_strtoul(buf, &endp, 0);
if (*endp && !isspace(*endp))
if (*endp && isspace(*endp))
size++;
if (size != count)
return -EINVAL;

down(&bd->sem);
Expand Down Expand Up @@ -65,12 +68,15 @@ static ssize_t backlight_show_brightness(struct class_device *cdev, char *buf)

static ssize_t backlight_store_brightness(struct class_device *cdev, const char *buf, size_t count)
{
int rc = -ENXIO, brightness;
int rc = -ENXIO;
char *endp;
struct backlight_device *bd = to_backlight_device(cdev);
int brightness = simple_strtoul(buf, &endp, 0);
size_t size = endp - buf;

brightness = simple_strtoul(buf, &endp, 0);
if (*endp && !isspace(*endp))
if (*endp && isspace(*endp))
size++;
if (size != count)
return -EINVAL;

down(&bd->sem);
Expand Down
32 changes: 16 additions & 16 deletions trunk/drivers/video/backlight/lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,73 +31,73 @@ static ssize_t lcd_show_power(struct class_device *cdev, char *buf)

static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_t count)
{
int rc, power;
int rc = -ENXIO;
char *endp;
struct lcd_device *ld = to_lcd_device(cdev);
int power = simple_strtoul(buf, &endp, 0);
size_t size = endp - buf;

power = simple_strtoul(buf, &endp, 0);
if (*endp && !isspace(*endp))
if (*endp && isspace(*endp))
size++;
if (size != count)
return -EINVAL;

down(&ld->sem);
if (likely(ld->props && ld->props->set_power)) {
pr_debug("lcd: set power to %d\n", power);
ld->props->set_power(ld, power);
rc = count;
} else
rc = -ENXIO;
}
up(&ld->sem);

return rc;
}

static ssize_t lcd_show_contrast(struct class_device *cdev, char *buf)
{
int rc;
int rc = -ENXIO;
struct lcd_device *ld = to_lcd_device(cdev);

down(&ld->sem);
if (likely(ld->props && ld->props->get_contrast))
rc = sprintf(buf, "%d\n", ld->props->get_contrast(ld));
else
rc = -ENXIO;
up(&ld->sem);

return rc;
}

static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, size_t count)
{
int rc, contrast;
int rc = -ENXIO;
char *endp;
struct lcd_device *ld = to_lcd_device(cdev);
int contrast = simple_strtoul(buf, &endp, 0);
size_t size = endp - buf;

contrast = simple_strtoul(buf, &endp, 0);
if (*endp && !isspace(*endp))
if (*endp && isspace(*endp))
size++;
if (size != count)
return -EINVAL;

down(&ld->sem);
if (likely(ld->props && ld->props->set_contrast)) {
pr_debug("lcd: set contrast to %d\n", contrast);
ld->props->set_contrast(ld, contrast);
rc = count;
} else
rc = -ENXIO;
}
up(&ld->sem);

return rc;
}

static ssize_t lcd_show_max_contrast(struct class_device *cdev, char *buf)
{
int rc;
int rc = -ENXIO;
struct lcd_device *ld = to_lcd_device(cdev);

down(&ld->sem);
if (likely(ld->props))
rc = sprintf(buf, "%d\n", ld->props->max_contrast);
else
rc = -ENXIO;
up(&ld->sem);

return rc;
Expand Down

0 comments on commit 611efc0

Please sign in to comment.