Re: [PATCH 6/6] leds: add new lp8788 led driver

From: Mark Brown
Date: Wed Jul 18 2012 - 10:52:47 EST


On Wed, Jul 18, 2012 at 02:34:02PM +0000, Kim, Milo wrote:

> +static void lp8788_brightness_set(struct led_classdev *led_cdev,
> + enum led_brightness brt_val)
> +{
> + struct lp8788_led *led =
> + container_of(led_cdev, struct lp8788_led, led_dev);
> + enum lp8788_isink_number num = led->isink_num;
> + int enable;
> +
> + switch (num) {
> + case LP8788_ISINK_1:
> + case LP8788_ISINK_2:
> + case LP8788_ISINK_3:
> + lp8788_write_byte(led->lp, lp8788_pwm_addr[num], brt_val);

The brightness_set() (and other) callbacks can be called from atomic
context so you can't interact with an I2C device here, you need to
defer to a workqueue or something (and ideally factor this out into the
framework so we don't need to keep open coding it...).

Attachment: signature.asc
Description: Digital signature