diff options
author | Paul Mackerras <paulus@samba.org> | 2008-04-14 21:11:02 +1000 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-04-14 21:11:02 +1000 |
commit | ac7c5353b189e10cf5dd27399f64f7b013abffc6 (patch) | |
tree | 8222d92b774c256d6ec4399c716d76b3f05ddc4b /drivers/leds/leds-gpio.c | |
parent | a8f75ea70c58546205fb7673be41455b9da5d9a7 (diff) | |
parent | 120dd64cacd4fb796bca0acba3665553f1d9ecaa (diff) | |
download | talos-op-linux-ac7c5353b189e10cf5dd27399f64f7b013abffc6.tar.gz talos-op-linux-ac7c5353b189e10cf5dd27399f64f7b013abffc6.zip |
Merge branch 'linux-2.6'
Diffstat (limited to 'drivers/leds/leds-gpio.c')
-rw-r--r-- | drivers/leds/leds-gpio.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index 6c0a9c4761ee..4c0b05852cb6 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c @@ -49,13 +49,13 @@ static void gpio_led_set(struct led_classdev *led_cdev, if (led_dat->active_low) level = !level; - /* setting GPIOs with I2C/etc requires a preemptible task context */ + /* Setting GPIOs with I2C/etc requires a task context, and we don't + * seem to have a reliable way to know if we're already in one; so + * let's just assume the worst. + */ if (led_dat->can_sleep) { - if (preempt_count()) { - led_dat->new_level = level; - schedule_work(&led_dat->work); - } else - gpio_set_value_cansleep(led_dat->gpio, level); + led_dat->new_level = level; + schedule_work(&led_dat->work); } else gpio_set_value(led_dat->gpio, level); } @@ -79,6 +79,10 @@ static int gpio_led_probe(struct platform_device *pdev) cur_led = &pdata->leds[i]; led_dat = &leds_data[i]; + ret = gpio_request(cur_led->gpio, cur_led->name); + if (ret < 0) + goto err; + led_dat->cdev.name = cur_led->name; led_dat->cdev.default_trigger = cur_led->default_trigger; led_dat->gpio = cur_led->gpio; @@ -87,10 +91,6 @@ static int gpio_led_probe(struct platform_device *pdev) led_dat->cdev.brightness_set = gpio_led_set; led_dat->cdev.brightness = LED_OFF; - ret = gpio_request(led_dat->gpio, led_dat->cdev.name); - if (ret < 0) - goto err; - gpio_direction_output(led_dat->gpio, led_dat->active_low); INIT_WORK(&led_dat->work, gpio_led_work); |