aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-wm8994.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpio/gpio-wm8994.c')
-rw-r--r--drivers/gpio/gpio-wm8994.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/gpio/gpio-wm8994.c b/drivers/gpio/gpio-wm8994.c
index aa61ad2fcaaa..1c764e779d80 100644
--- a/drivers/gpio/gpio-wm8994.c
+++ b/drivers/gpio/gpio-wm8994.c
@@ -19,6 +19,7 @@
19#include <linux/mfd/core.h> 19#include <linux/mfd/core.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/seq_file.h> 21#include <linux/seq_file.h>
22#include <linux/regmap.h>
22 23
23#include <linux/mfd/wm8994/core.h> 24#include <linux/mfd/wm8994/core.h>
24#include <linux/mfd/wm8994/pdata.h> 25#include <linux/mfd/wm8994/pdata.h>
@@ -112,10 +113,7 @@ static int wm8994_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
112 struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip); 113 struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip);
113 struct wm8994 *wm8994 = wm8994_gpio->wm8994; 114 struct wm8994 *wm8994 = wm8994_gpio->wm8994;
114 115
115 if (!wm8994->irq_base) 116 return regmap_irq_get_virq(wm8994->irq_data, offset);
116 return -EINVAL;
117
118 return wm8994->irq_base + offset;
119} 117}
120 118
121 119
@@ -254,7 +252,8 @@ static int __devinit wm8994_gpio_probe(struct platform_device *pdev)
254 struct wm8994_gpio *wm8994_gpio; 252 struct wm8994_gpio *wm8994_gpio;
255 int ret; 253 int ret;
256 254
257 wm8994_gpio = kzalloc(sizeof(*wm8994_gpio), GFP_KERNEL); 255 wm8994_gpio = devm_kzalloc(&pdev->dev, sizeof(*wm8994_gpio),
256 GFP_KERNEL);
258 if (wm8994_gpio == NULL) 257 if (wm8994_gpio == NULL)
259 return -ENOMEM; 258 return -ENOMEM;
260 259
@@ -279,20 +278,14 @@ static int __devinit wm8994_gpio_probe(struct platform_device *pdev)
279 return ret; 278 return ret;
280 279
281err: 280err:
282 kfree(wm8994_gpio);
283 return ret; 281 return ret;
284} 282}
285 283
286static int __devexit wm8994_gpio_remove(struct platform_device *pdev) 284static int __devexit wm8994_gpio_remove(struct platform_device *pdev)
287{ 285{
288 struct wm8994_gpio *wm8994_gpio = platform_get_drvdata(pdev); 286 struct wm8994_gpio *wm8994_gpio = platform_get_drvdata(pdev);
289 int ret;
290 287
291 ret = gpiochip_remove(&wm8994_gpio->gpio_chip); 288 return gpiochip_remove(&wm8994_gpio->gpio_chip);
292 if (ret == 0)
293 kfree(wm8994_gpio);
294
295 return ret;
296} 289}
297 290
298static struct platform_driver wm8994_gpio_driver = { 291static struct platform_driver wm8994_gpio_driver = {