summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2016-09-04 21:50:47 +0100
committerRussell King <rmk+kernel@armlinux.org.uk>2016-09-22 09:38:55 +0100
commit59ecfefad53ce39f880a9c8b503fe99235f4b94d (patch)
tree59720c3508b904949e8e0e3e5e3e3c7e84749bbe
parent3be7988674ab33565700a37b210f502563d932e6 (diff)
pcmcia: soc_common: use devm_gpio_request_one()
Use devm_gpio_request_one() to request the GPIOs so we can avoid manual clean up these gpio resources. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r--drivers/pcmcia/soc_common.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c
index d5ca760c4eb2..24ac27f9a119 100644
--- a/drivers/pcmcia/soc_common.c
+++ b/drivers/pcmcia/soc_common.c
@@ -111,12 +111,9 @@ static void __soc_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt,
{
unsigned int i;
- for (i = 0; i < nr; i++) {
+ for (i = 0; i < nr; i++)
if (skt->stat[i].irq)
free_irq(skt->stat[i].irq, skt);
- if (gpio_is_valid(skt->stat[i].gpio))
- gpio_free(skt->stat[i].gpio);
- }
if (skt->ops->hw_shutdown)
skt->ops->hw_shutdown(skt);
@@ -145,8 +142,9 @@ static int soc_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
if (gpio_is_valid(skt->stat[i].gpio)) {
int irq;
- ret = gpio_request_one(skt->stat[i].gpio, GPIOF_IN,
- skt->stat[i].name);
+ ret = devm_gpio_request_one(skt->socket.dev.parent,
+ skt->stat[i].gpio, GPIOF_IN,
+ skt->stat[i].name);
if (ret) {
__soc_pcmcia_hw_shutdown(skt, i);
return ret;
@@ -166,8 +164,6 @@ static int soc_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
IRQF_TRIGGER_NONE,
skt->stat[i].name, skt);
if (ret) {
- if (gpio_is_valid(skt->stat[i].gpio))
- gpio_free(skt->stat[i].gpio);
__soc_pcmcia_hw_shutdown(skt, i);
return ret;
}