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

ARM: 6373/1: tc35892-gpio: add setup/remove callbacks

For board-specific initialization.

Cc: Samuel Ortiz <sameo@linux.intel.com>
Cc: linux-kernel@vger.kernel.org
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Rabin Vincent and committed by
Russell King
f0a7a98d f066439c

+12
+8
drivers/gpio/tc35892-gpio.c
··· 322 322 goto out_freeirq; 323 323 } 324 324 325 + if (pdata->setup) 326 + pdata->setup(tc35892, tc35892_gpio->chip.base); 327 + 325 328 platform_set_drvdata(pdev, tc35892_gpio); 326 329 327 330 return 0; ··· 341 338 static int __devexit tc35892_gpio_remove(struct platform_device *pdev) 342 339 { 343 340 struct tc35892_gpio *tc35892_gpio = platform_get_drvdata(pdev); 341 + struct tc35892 *tc35892 = tc35892_gpio->tc35892; 342 + struct tc35892_gpio_platform_data *pdata = tc35892->pdata->gpio; 344 343 int irq = platform_get_irq(pdev, 0); 345 344 int ret; 345 + 346 + if (pdata->remove) 347 + pdata->remove(tc35892, tc35892_gpio->chip.base); 346 348 347 349 ret = gpiochip_remove(&tc35892_gpio->chip); 348 350 if (ret < 0) {
+4
include/linux/mfd/tc35892.h
··· 111 111 * struct tc35892_gpio_platform_data - TC35892 GPIO platform data 112 112 * @gpio_base: first gpio number assigned to TC35892. A maximum of 113 113 * %TC35892_NR_GPIOS GPIOs will be allocated. 114 + * @setup: callback for board-specific initialization 115 + * @remove: callback for board-specific teardown 114 116 */ 115 117 struct tc35892_gpio_platform_data { 116 118 int gpio_base; 119 + void (*setup)(struct tc35892 *tc35892, unsigned gpio_base); 120 + void (*remove)(struct tc35892 *tc35892, unsigned gpio_base); 117 121 }; 118 122 119 123 /**