Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 232021
b: refs/heads/master
c: cc587ec
h: refs/heads/master
i:
  232019: 149806b
v: v3
  • Loading branch information
Janusz Krzysztofik authored and Linus Torvalds committed Jan 21, 2011
1 parent 84d4bf9 commit 0f609ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 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: c1fc8675c9e3dede8e7cd91cebb2025e2e6db2dc
refs/heads/master: cc587ece12791d001095488bf060fac52f657ea9
15 changes: 8 additions & 7 deletions trunk/drivers/leds/ledtrig-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,24 +99,25 @@ static ssize_t gpio_trig_inverted_show(struct device *dev,
struct led_classdev *led = dev_get_drvdata(dev);
struct gpio_trig_data *gpio_data = led->trigger_data;

return sprintf(buf, "%s\n", gpio_data->inverted ? "yes" : "no");
return sprintf(buf, "%u\n", gpio_data->inverted);
}

static ssize_t gpio_trig_inverted_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t n)
{
struct led_classdev *led = dev_get_drvdata(dev);
struct gpio_trig_data *gpio_data = led->trigger_data;
unsigned inverted;
unsigned long inverted;
int ret;

ret = sscanf(buf, "%u", &inverted);
if (ret < 1) {
dev_err(dev, "invalid value\n");
ret = strict_strtoul(buf, 10, &inverted);
if (ret < 0)
return ret;

if (inverted > 1)
return -EINVAL;
}

gpio_data->inverted = !!inverted;
gpio_data->inverted = inverted;

/* After inverting, we need to update the LED. */
schedule_work(&gpio_data->work);
Expand Down

0 comments on commit 0f609ab

Please sign in to comment.