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

leds: lp8860: Remove work queue

Now the core implements the work queue, remove it from the drivers,
and switch to using brightness_set_blocking op.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>

authored by

Andrew Lunn and committed by
Jacek Anaszewski
7c4b10a2 64998371

+7 -20
+7 -20
drivers/leds/leds-lp8860.c
··· 91 91 /** 92 92 * struct lp8860_led - 93 93 * @lock - Lock for reading/writing the device 94 - * @work - Work item used to off load the brightness register writes 95 94 * @client - Pointer to the I2C client 96 95 * @led_dev - led class device pointer 97 96 * @regmap - Devices register map 98 97 * @eeprom_regmap - EEPROM register map 99 98 * @enable_gpio - VDDIO/EN gpio to enable communication interface 100 99 * @regulator - LED supply regulator pointer 101 - * @brightness - Current brightness value requested 102 100 * @label - LED label 103 101 **/ 104 102 struct lp8860_led { 105 103 struct mutex lock; 106 - struct work_struct work; 107 104 struct i2c_client *client; 108 105 struct led_classdev led_dev; 109 106 struct regmap *regmap; 110 107 struct regmap *eeprom_regmap; 111 108 struct gpio_desc *enable_gpio; 112 109 struct regulator *regulator; 113 - enum led_brightness brightness; 114 110 const char *label; 115 111 }; 116 112 ··· 208 212 return ret; 209 213 } 210 214 211 - static void lp8860_led_brightness_work(struct work_struct *work) 215 + static int lp8860_brightness_set(struct led_classdev *led_cdev, 216 + enum led_brightness brt_val) 212 217 { 213 - struct lp8860_led *led = container_of(work, struct lp8860_led, work); 218 + struct lp8860_led *led = 219 + container_of(led_cdev, struct lp8860_led, led_dev); 220 + int disp_brightness = brt_val * 255; 214 221 int ret; 215 - int disp_brightness = led->brightness * 255; 216 222 217 223 mutex_lock(&led->lock); 218 224 ··· 239 241 } 240 242 out: 241 243 mutex_unlock(&led->lock); 242 - } 243 - 244 - static void lp8860_brightness_set(struct led_classdev *led_cdev, 245 - enum led_brightness brt_val) 246 - { 247 - struct lp8860_led *led = 248 - container_of(led_cdev, struct lp8860_led, led_dev); 249 - 250 - led->brightness = brt_val; 251 - schedule_work(&led->work); 244 + return ret; 252 245 } 253 246 254 247 static int lp8860_init(struct lp8860_led *led) ··· 395 406 led->client = client; 396 407 led->led_dev.name = led->label; 397 408 led->led_dev.max_brightness = LED_FULL; 398 - led->led_dev.brightness_set = lp8860_brightness_set; 409 + led->led_dev.brightness_set_blocking = lp8860_brightness_set; 399 410 400 411 mutex_init(&led->lock); 401 - INIT_WORK(&led->work, lp8860_led_brightness_work); 402 412 403 413 i2c_set_clientdata(client, led); 404 414 ··· 436 448 int ret; 437 449 438 450 led_classdev_unregister(&led->led_dev); 439 - cancel_work_sync(&led->work); 440 451 441 452 if (led->enable_gpio) 442 453 gpiod_direction_output(led->enable_gpio, 0);