Commit c9b0546a authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Chris Ball

mmc: simplify mmc_cd_gpio_request() by removing two parameters

Calculate the IRQ number, using gpio_to_irq() and use fixed flags: trigger
on both edges. This makes two out of four arguments of the
mmc_cd_gpio_request() function redundant.
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent 296e0b03
...@@ -28,13 +28,17 @@ static irqreturn_t mmc_cd_gpio_irqt(int irq, void *dev_id) ...@@ -28,13 +28,17 @@ static irqreturn_t mmc_cd_gpio_irqt(int irq, void *dev_id)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio, int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio)
unsigned int irq, unsigned long flags)
{ {
size_t len = strlen(dev_name(host->parent)) + 4; size_t len = strlen(dev_name(host->parent)) + 4;
struct mmc_cd_gpio *cd = kmalloc(sizeof(*cd) + len, GFP_KERNEL); struct mmc_cd_gpio *cd;
int irq = gpio_to_irq(gpio);
int ret; int ret;
if (irq < 0)
return irq;
cd = kmalloc(sizeof(*cd) + len, GFP_KERNEL);
if (!cd) if (!cd)
return -ENOMEM; return -ENOMEM;
...@@ -45,7 +49,8 @@ int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio, ...@@ -45,7 +49,8 @@ int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio,
goto egpioreq; goto egpioreq;
ret = request_threaded_irq(irq, NULL, mmc_cd_gpio_irqt, ret = request_threaded_irq(irq, NULL, mmc_cd_gpio_irqt,
flags, cd->label, host); IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
cd->label, host);
if (ret < 0) if (ret < 0)
goto eirqreq; goto eirqreq;
......
...@@ -12,8 +12,7 @@ ...@@ -12,8 +12,7 @@
#define MMC_CD_GPIO_H #define MMC_CD_GPIO_H
struct mmc_host; struct mmc_host;
int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio, int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio);
unsigned int irq, unsigned long flags);
void mmc_cd_gpio_free(struct mmc_host *host); void mmc_cd_gpio_free(struct mmc_host *host);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment