From: Guennadi Liakhovetski <g.liakhovetski@gmx.de> To: linux-mmc@vger.kernel.org Cc: Chris Ball <cjb@laptop.org>, Paul Mundt <lethal@linux-sh.org>, linux-sh@vger.kernel.org, Magnus Damm <magnus.damm@gmail.com> Subject: [PATCH 01/10 v3] mmc: simplify mmc_cd_gpio_request() by removing two parameters Date: Thu, 09 Feb 2012 21:57:07 +0000 [thread overview] Message-ID: <1328824636-10553-2-git-send-email-g.liakhovetski@gmx.de> (raw) In-Reply-To: <1328824636-10553-1-git-send-email-g.liakhovetski@gmx.de> 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> --- drivers/mmc/core/cd-gpio.c | 13 +++++++++---- include/linux/mmc/cd-gpio.h | 3 +-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/core/cd-gpio.c b/drivers/mmc/core/cd-gpio.c index 082202ae..29de31e 100644 --- a/drivers/mmc/core/cd-gpio.c +++ b/drivers/mmc/core/cd-gpio.c @@ -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; @@ -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; diff --git a/include/linux/mmc/cd-gpio.h b/include/linux/mmc/cd-gpio.h index a8e4697..cefaba0 100644 --- a/include/linux/mmc/cd-gpio.h +++ b/include/linux/mmc/cd-gpio.h @@ -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 -- 1.7.2.5
WARNING: multiple messages have this Message-ID (diff)
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de> To: linux-mmc@vger.kernel.org Cc: Chris Ball <cjb@laptop.org>, Paul Mundt <lethal@linux-sh.org>, linux-sh@vger.kernel.org, Magnus Damm <magnus.damm@gmail.com> Subject: [PATCH 01/10 v3] mmc: simplify mmc_cd_gpio_request() by removing two parameters Date: Thu, 9 Feb 2012 22:57:07 +0100 [thread overview] Message-ID: <1328824636-10553-2-git-send-email-g.liakhovetski@gmx.de> (raw) In-Reply-To: <1328824636-10553-1-git-send-email-g.liakhovetski@gmx.de> 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> --- drivers/mmc/core/cd-gpio.c | 13 +++++++++---- include/linux/mmc/cd-gpio.h | 3 +-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/core/cd-gpio.c b/drivers/mmc/core/cd-gpio.c index 082202ae..29de31e 100644 --- a/drivers/mmc/core/cd-gpio.c +++ b/drivers/mmc/core/cd-gpio.c @@ -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; @@ -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; diff --git a/include/linux/mmc/cd-gpio.h b/include/linux/mmc/cd-gpio.h index a8e4697..cefaba0 100644 --- a/include/linux/mmc/cd-gpio.h +++ b/include/linux/mmc/cd-gpio.h @@ -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 -- 1.7.2.5
next prev parent reply other threads:[~2012-02-09 21:57 UTC|newest] Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-02-09 21:57 [PATCH 00/10 v3] mmc: tmio/sdhi: hotplug & PM Guennadi Liakhovetski 2012-02-09 21:57 ` Guennadi Liakhovetski 2012-02-09 21:57 ` Guennadi Liakhovetski [this message] 2012-02-09 21:57 ` [PATCH 01/10 v3] mmc: simplify mmc_cd_gpio_request() by removing two parameters Guennadi Liakhovetski 2012-02-09 21:57 ` [PATCH 02/10 v3] mmc: tmio: calculate the native hotplug condition only once Guennadi Liakhovetski 2012-02-09 21:57 ` Guennadi Liakhovetski 2012-02-09 21:57 ` [PATCH 03/10 v3] mmc: tmio_mmc: support the generic MMC GPIO card hotplug helper Guennadi Liakhovetski 2012-02-09 21:57 ` Guennadi Liakhovetski 2012-02-09 21:57 ` [PATCH 04/10 v3] mmc: sh_mobile_sdhi: pass card hotplug GPIO number to TMIO MMC Guennadi Liakhovetski 2012-02-09 21:57 ` Guennadi Liakhovetski 2012-02-09 21:57 ` [PATCH 05/10 v3] ARM: mach-shmobile: convert mackerel to use the generic MMC GPIO hotplug helper Guennadi Liakhovetski 2012-02-09 21:57 ` Guennadi Liakhovetski 2012-04-16 2:08 ` Simon Horman 2012-04-16 2:08 ` Simon Horman 2012-02-09 21:57 ` [PATCH 06/10 v3] ARM: mach-shmobile: convert ag5evm " Guennadi Liakhovetski 2012-02-09 21:57 ` Guennadi Liakhovetski 2012-04-08 11:33 ` Guennadi Liakhovetski 2012-04-08 11:33 ` Guennadi Liakhovetski 2012-04-13 12:46 ` outstanding ARM patches Guennadi Liakhovetski 2012-04-13 12:46 ` Guennadi Liakhovetski 2012-04-16 16:24 ` Rafael J. Wysocki 2012-04-16 16:24 ` Rafael J. Wysocki 2012-04-16 21:08 ` Guennadi Liakhovetski 2012-04-16 21:08 ` Guennadi Liakhovetski 2012-04-16 2:16 ` [PATCH 06/10 v3] ARM: mach-shmobile: convert ag5evm to use the generic MMC GPIO hotplug helper Simon Horman 2012-04-16 2:16 ` Simon Horman 2012-02-09 21:57 ` [PATCH 07/10 v3] mmc: tmio_mmc: power status flag doesn't have to be exposed in platform data Guennadi Liakhovetski 2012-02-09 21:57 ` Guennadi Liakhovetski 2012-02-09 21:57 ` [PATCH 08/10 v3] mmc: tmio_mmc: remove unused sdio_irq_enabled flag Guennadi Liakhovetski 2012-02-09 21:57 ` Guennadi Liakhovetski 2012-02-09 21:57 ` [PATCH 09/10 v3] mmc: sh_mobile_sdhi: do not manage PM clocks manually Guennadi Liakhovetski 2012-02-09 21:57 ` Guennadi Liakhovetski 2012-02-09 21:57 ` [PATCH 10/10 v3] mmc: tmio: cosmetic: prettify the tmio_mmc_set_ios() function Guennadi Liakhovetski 2012-02-09 21:57 ` Guennadi Liakhovetski 2012-03-09 4:17 ` [PATCH 00/10 v3] mmc: tmio/sdhi: hotplug & PM Chris Ball 2012-03-09 4:17 ` Chris Ball 2012-03-16 11:55 ` Chris Ball 2012-03-16 11:55 ` Chris Ball
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1328824636-10553-2-git-send-email-g.liakhovetski@gmx.de \ --to=g.liakhovetski@gmx.de \ --cc=cjb@laptop.org \ --cc=lethal@linux-sh.org \ --cc=linux-mmc@vger.kernel.org \ --cc=linux-sh@vger.kernel.org \ --cc=magnus.damm@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.