diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-28 18:54:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-28 18:54:04 -0400 |
commit | b779b332d0e1ef68f40867948ae5526a3e925163 (patch) | |
tree | d2fc8bb455d696fbdb288055ce0a4f0cfcee31fd /drivers/gpio/stmpe-gpio.c | |
parent | a0cadc2777a71b1fde62e6417284b38e52128e88 (diff) | |
parent | 0f48285755991b73c14b6eeeee464590f490ac25 (diff) |
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (73 commits)
power: Revert "power_supply: Mark twl4030_charger as broken"
mfd: Fix a memory leak when unload mc13xxx-core module
mfd: Fix resource reclaim for max8998
mfd: Remove unneeded ret value checking for max8998 register updates
mfd: Add free max8998->ono irq in max8998_irq_exit()
mfd: Fix resource reclaim in pcf50633_remove()
omap4: pandaboard: fix up mmc card detect logic
mfd: Fix ezx_pcap_probe error path
mfd: Fix off-by-one value range checking for tps6507x
mfd: Remove __devinitdata from tc6393xb_mmc_resources
mfd: Add WM831x SPI support
mfd: Factor out WM831x I2C I/O from the core driver
mfd: Remove DEBUG defines from mc13xxx-core
mfd: Fix jz4740_adc_set_enabled
mfd: Add TPS658621C device ID
mfd: Fix twl-irq function declaration warnings
regulator: max8998 BUCK1/2 voltage change with use of GPIOs
mfd: Voltages and GPIOs platform_data definitions for max8998
regulator: max8998 BUCK1/2 internal voltages and indexes defined
mfd: Support for ICs compliant with max8998
...
Diffstat (limited to 'drivers/gpio/stmpe-gpio.c')
-rw-r--r-- | drivers/gpio/stmpe-gpio.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/gpio/stmpe-gpio.c b/drivers/gpio/stmpe-gpio.c index 4e1f1b9d5e67..7c9e6a052c45 100644 --- a/drivers/gpio/stmpe-gpio.c +++ b/drivers/gpio/stmpe-gpio.c | |||
@@ -30,6 +30,7 @@ struct stmpe_gpio { | |||
30 | struct mutex irq_lock; | 30 | struct mutex irq_lock; |
31 | 31 | ||
32 | int irq_base; | 32 | int irq_base; |
33 | unsigned norequest_mask; | ||
33 | 34 | ||
34 | /* Caches of interrupt control registers for bus_lock */ | 35 | /* Caches of interrupt control registers for bus_lock */ |
35 | u8 regs[CACHE_NR_REGS][CACHE_NR_BANKS]; | 36 | u8 regs[CACHE_NR_REGS][CACHE_NR_BANKS]; |
@@ -103,6 +104,9 @@ static int stmpe_gpio_request(struct gpio_chip *chip, unsigned offset) | |||
103 | struct stmpe_gpio *stmpe_gpio = to_stmpe_gpio(chip); | 104 | struct stmpe_gpio *stmpe_gpio = to_stmpe_gpio(chip); |
104 | struct stmpe *stmpe = stmpe_gpio->stmpe; | 105 | struct stmpe *stmpe = stmpe_gpio->stmpe; |
105 | 106 | ||
107 | if (stmpe_gpio->norequest_mask & (1 << offset)) | ||
108 | return -EINVAL; | ||
109 | |||
106 | return stmpe_set_altfunc(stmpe, 1 << offset, STMPE_BLOCK_GPIO); | 110 | return stmpe_set_altfunc(stmpe, 1 << offset, STMPE_BLOCK_GPIO); |
107 | } | 111 | } |
108 | 112 | ||
@@ -287,8 +291,6 @@ static int __devinit stmpe_gpio_probe(struct platform_device *pdev) | |||
287 | int irq; | 291 | int irq; |
288 | 292 | ||
289 | pdata = stmpe->pdata->gpio; | 293 | pdata = stmpe->pdata->gpio; |
290 | if (!pdata) | ||
291 | return -ENODEV; | ||
292 | 294 | ||
293 | irq = platform_get_irq(pdev, 0); | 295 | irq = platform_get_irq(pdev, 0); |
294 | if (irq < 0) | 296 | if (irq < 0) |
@@ -302,6 +304,7 @@ static int __devinit stmpe_gpio_probe(struct platform_device *pdev) | |||
302 | 304 | ||
303 | stmpe_gpio->dev = &pdev->dev; | 305 | stmpe_gpio->dev = &pdev->dev; |
304 | stmpe_gpio->stmpe = stmpe; | 306 | stmpe_gpio->stmpe = stmpe; |
307 | stmpe_gpio->norequest_mask = pdata ? pdata->norequest_mask : 0; | ||
305 | 308 | ||
306 | stmpe_gpio->chip = template_chip; | 309 | stmpe_gpio->chip = template_chip; |
307 | stmpe_gpio->chip.ngpio = stmpe->num_gpios; | 310 | stmpe_gpio->chip.ngpio = stmpe->num_gpios; |
@@ -312,11 +315,11 @@ static int __devinit stmpe_gpio_probe(struct platform_device *pdev) | |||
312 | 315 | ||
313 | ret = stmpe_enable(stmpe, STMPE_BLOCK_GPIO); | 316 | ret = stmpe_enable(stmpe, STMPE_BLOCK_GPIO); |
314 | if (ret) | 317 | if (ret) |
315 | return ret; | 318 | goto out_free; |
316 | 319 | ||
317 | ret = stmpe_gpio_irq_init(stmpe_gpio); | 320 | ret = stmpe_gpio_irq_init(stmpe_gpio); |
318 | if (ret) | 321 | if (ret) |
319 | goto out_free; | 322 | goto out_disable; |
320 | 323 | ||
321 | ret = request_threaded_irq(irq, NULL, stmpe_gpio_irq, IRQF_ONESHOT, | 324 | ret = request_threaded_irq(irq, NULL, stmpe_gpio_irq, IRQF_ONESHOT, |
322 | "stmpe-gpio", stmpe_gpio); | 325 | "stmpe-gpio", stmpe_gpio); |
@@ -342,6 +345,8 @@ out_freeirq: | |||
342 | free_irq(irq, stmpe_gpio); | 345 | free_irq(irq, stmpe_gpio); |
343 | out_removeirq: | 346 | out_removeirq: |
344 | stmpe_gpio_irq_remove(stmpe_gpio); | 347 | stmpe_gpio_irq_remove(stmpe_gpio); |
348 | out_disable: | ||
349 | stmpe_disable(stmpe, STMPE_BLOCK_GPIO); | ||
345 | out_free: | 350 | out_free: |
346 | kfree(stmpe_gpio); | 351 | kfree(stmpe_gpio); |
347 | return ret; | 352 | return ret; |