Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds

* 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds:
leds: Remove incorrect use of preempt_count() from leds-gpio
leds: Fix potential leds-gpio oops

+10 -10
+10 -10
drivers/leds/leds-gpio.c
··· 49 49 if (led_dat->active_low) 50 50 level = !level; 51 51 52 - /* setting GPIOs with I2C/etc requires a preemptible task context */ 52 + /* Setting GPIOs with I2C/etc requires a task context, and we don't 53 + * seem to have a reliable way to know if we're already in one; so 54 + * let's just assume the worst. 55 + */ 53 56 if (led_dat->can_sleep) { 54 - if (preempt_count()) { 55 - led_dat->new_level = level; 56 - schedule_work(&led_dat->work); 57 - } else 58 - gpio_set_value_cansleep(led_dat->gpio, level); 57 + led_dat->new_level = level; 58 + schedule_work(&led_dat->work); 59 59 } else 60 60 gpio_set_value(led_dat->gpio, level); 61 61 } ··· 79 79 cur_led = &pdata->leds[i]; 80 80 led_dat = &leds_data[i]; 81 81 82 + ret = gpio_request(cur_led->gpio, cur_led->name); 83 + if (ret < 0) 84 + goto err; 85 + 82 86 led_dat->cdev.name = cur_led->name; 83 87 led_dat->cdev.default_trigger = cur_led->default_trigger; 84 88 led_dat->gpio = cur_led->gpio; ··· 90 86 led_dat->active_low = cur_led->active_low; 91 87 led_dat->cdev.brightness_set = gpio_led_set; 92 88 led_dat->cdev.brightness = LED_OFF; 93 - 94 - ret = gpio_request(led_dat->gpio, led_dat->cdev.name); 95 - if (ret < 0) 96 - goto err; 97 89 98 90 gpio_direction_output(led_dat->gpio, led_dat->active_low); 99 91