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

leds: pca9532: use gpiochip data pointer

This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Cc: Riku Voipio <riku.voipio@iki.fi>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: linux-leds@vger.kernel.org
Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

+4 -4
+4 -4
drivers/leds/leds-pca9532.c
··· 245 245 #ifdef CONFIG_LEDS_PCA9532_GPIO 246 246 static int pca9532_gpio_request_pin(struct gpio_chip *gc, unsigned offset) 247 247 { 248 - struct pca9532_data *data = container_of(gc, struct pca9532_data, gpio); 248 + struct pca9532_data *data = gpiochip_get_data(gc); 249 249 struct pca9532_led *led = &data->leds[offset]; 250 250 251 251 if (led->type == PCA9532_TYPE_GPIO) ··· 256 256 257 257 static void pca9532_gpio_set_value(struct gpio_chip *gc, unsigned offset, int val) 258 258 { 259 - struct pca9532_data *data = container_of(gc, struct pca9532_data, gpio); 259 + struct pca9532_data *data = gpiochip_get_data(gc); 260 260 struct pca9532_led *led = &data->leds[offset]; 261 261 262 262 if (val) ··· 269 269 270 270 static int pca9532_gpio_get_value(struct gpio_chip *gc, unsigned offset) 271 271 { 272 - struct pca9532_data *data = container_of(gc, struct pca9532_data, gpio); 272 + struct pca9532_data *data = gpiochip_get_data(gc); 273 273 unsigned char reg; 274 274 275 275 reg = i2c_smbus_read_byte_data(data->client, PCA9532_REG_INPUT(offset)); ··· 416 416 data->gpio.parent = &client->dev; 417 417 data->gpio.owner = THIS_MODULE; 418 418 419 - err = gpiochip_add(&data->gpio); 419 + err = gpiochip_add_data(&data->gpio, data); 420 420 if (err) { 421 421 /* Use data->gpio.dev as a flag for freeing gpiochip */ 422 422 data->gpio.parent = NULL;