aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2013-11-18 18:22:50 -0500
committerTony Lindgren <tony@atomide.com>2013-11-18 18:33:16 -0500
commitfd3a5d5b8386c9a29116e048b5e4ee86545ba012 (patch)
tree55f4d1afff917165589c7102e11643e3eb24aed2
parent0b2aa8bed3e13892fcac77e4f50ec6e80125469d (diff)
gpio: twl4030: Fix passing of pdata in the device tree case
We still have some legacy code needing the callback functions that won't work properly without platform data. To use platform data for twl4030-gpio, we need to not trash the possible data. Cc: linux-gpio@vger.kernel.org Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> [tony@atomide.com: folded in fix from Fengguang to use struct assignment] Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r--drivers/gpio/gpio-twl4030.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c
index 5738d5a7d849..b97d6a6577b9 100644
--- a/drivers/gpio/gpio-twl4030.c
+++ b/drivers/gpio/gpio-twl4030.c
@@ -436,7 +436,8 @@ static int gpio_twl4030_debounce(u32 debounce, u8 mmc_cd)
436 436
437static int gpio_twl4030_remove(struct platform_device *pdev); 437static int gpio_twl4030_remove(struct platform_device *pdev);
438 438
439static struct twl4030_gpio_platform_data *of_gpio_twl4030(struct device *dev) 439static struct twl4030_gpio_platform_data *of_gpio_twl4030(struct device *dev,
440 struct twl4030_gpio_platform_data *pdata)
440{ 441{
441 struct twl4030_gpio_platform_data *omap_twl_info; 442 struct twl4030_gpio_platform_data *omap_twl_info;
442 443
@@ -444,6 +445,9 @@ static struct twl4030_gpio_platform_data *of_gpio_twl4030(struct device *dev)
444 if (!omap_twl_info) 445 if (!omap_twl_info)
445 return NULL; 446 return NULL;
446 447
448 if (pdata)
449 *omap_twl_info = *pdata;
450
447 omap_twl_info->use_leds = of_property_read_bool(dev->of_node, 451 omap_twl_info->use_leds = of_property_read_bool(dev->of_node,
448 "ti,use-leds"); 452 "ti,use-leds");
449 453
@@ -501,7 +505,7 @@ no_irqs:
501 mutex_init(&priv->mutex); 505 mutex_init(&priv->mutex);
502 506
503 if (node) 507 if (node)
504 pdata = of_gpio_twl4030(&pdev->dev); 508 pdata = of_gpio_twl4030(&pdev->dev, pdata);
505 509
506 if (pdata == NULL) { 510 if (pdata == NULL) {
507 dev_err(&pdev->dev, "Platform data is missing\n"); 511 dev_err(&pdev->dev, "Platform data is missing\n");