提交 fd3a5d5b 编写于 作者: T Tony Lindgren

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: NLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: NFengguang Wu <fengguang.wu@intel.com>
[tony@atomide.com: folded in fix from Fengguang to use struct assignment]
Signed-off-by: NTony Lindgren <tony@atomide.com>
上级 0b2aa8be
...@@ -436,7 +436,8 @@ static int gpio_twl4030_debounce(u32 debounce, u8 mmc_cd) ...@@ -436,7 +436,8 @@ static int gpio_twl4030_debounce(u32 debounce, u8 mmc_cd)
static int gpio_twl4030_remove(struct platform_device *pdev); static int gpio_twl4030_remove(struct platform_device *pdev);
static struct twl4030_gpio_platform_data *of_gpio_twl4030(struct device *dev) static struct twl4030_gpio_platform_data *of_gpio_twl4030(struct device *dev,
struct twl4030_gpio_platform_data *pdata)
{ {
struct twl4030_gpio_platform_data *omap_twl_info; struct twl4030_gpio_platform_data *omap_twl_info;
...@@ -444,6 +445,9 @@ static struct twl4030_gpio_platform_data *of_gpio_twl4030(struct device *dev) ...@@ -444,6 +445,9 @@ static struct twl4030_gpio_platform_data *of_gpio_twl4030(struct device *dev)
if (!omap_twl_info) if (!omap_twl_info)
return NULL; return NULL;
if (pdata)
*omap_twl_info = *pdata;
omap_twl_info->use_leds = of_property_read_bool(dev->of_node, omap_twl_info->use_leds = of_property_read_bool(dev->of_node,
"ti,use-leds"); "ti,use-leds");
...@@ -501,7 +505,7 @@ static int gpio_twl4030_probe(struct platform_device *pdev) ...@@ -501,7 +505,7 @@ static int gpio_twl4030_probe(struct platform_device *pdev)
mutex_init(&priv->mutex); mutex_init(&priv->mutex);
if (node) if (node)
pdata = of_gpio_twl4030(&pdev->dev); pdata = of_gpio_twl4030(&pdev->dev, pdata);
if (pdata == NULL) { if (pdata == NULL) {
dev_err(&pdev->dev, "Platform data is missing\n"); dev_err(&pdev->dev, "Platform data is missing\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册