Skip to content

Commit

Permalink
mmc: simplify mmc_cd_gpio_request() by removing two parameters
Browse files Browse the repository at this point in the history
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: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Chris Ball <cjb@laptop.org>
  • Loading branch information
Guennadi Liakhovetski authored and Chris Ball committed Mar 27, 2012
1 parent 296e0b0 commit c9b0546
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
13 changes: 9 additions & 4 deletions drivers/mmc/core/cd-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@ static irqreturn_t mmc_cd_gpio_irqt(int irq, void *dev_id)
return IRQ_HANDLED;
}

int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio,
unsigned int irq, unsigned long flags)
int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio)
{
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;

if (irq < 0)
return irq;

cd = kmalloc(sizeof(*cd) + len, GFP_KERNEL);
if (!cd)
return -ENOMEM;

Expand All @@ -45,7 +49,8 @@ int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio,
goto egpioreq;

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)
goto eirqreq;

Expand Down
3 changes: 1 addition & 2 deletions include/linux/mmc/cd-gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
#define MMC_CD_GPIO_H

struct mmc_host;
int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio,
unsigned int irq, unsigned long flags);
int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio);
void mmc_cd_gpio_free(struct mmc_host *host);

#endif

0 comments on commit c9b0546

Please sign in to comment.