* [PATCH] mmc: slot-gpio: call gpiod_to_irq() only when MMC_CAP_NEEDS_POLL is unset
@ 2017-11-08 6:34 Masahiro Yamada
2017-11-27 9:57 ` Ulf Hansson
0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2017-11-08 6:34 UTC (permalink / raw)
To: linux-mmc
Cc: Masahiro Yamada, Adrian Hunter, linux-kernel, Andy Shevchenko,
Shawn Lin, Ulf Hansson
It is not efficient to call gpiod_to_irq() regardless the flag, then
ignore the returned irq if MMC_CAP_NEEDS_POLL.
Move gpiod_to_irq() after the MMC_CAP_NEEDS_POLL check.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
drivers/mmc/core/slot-gpio.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
index 863f1db..f7c6e05 100644
--- a/drivers/mmc/core/slot-gpio.c
+++ b/drivers/mmc/core/slot-gpio.c
@@ -121,20 +121,18 @@ EXPORT_SYMBOL(mmc_gpio_request_ro);
void mmc_gpiod_request_cd_irq(struct mmc_host *host)
{
struct mmc_gpio *ctx = host->slot.handler_priv;
- int ret, irq;
+ int irq = -EINVAL;
+ int ret;
if (host->slot.cd_irq >= 0 || !ctx || !ctx->cd_gpio)
return;
- irq = gpiod_to_irq(ctx->cd_gpio);
-
/*
- * Even if gpiod_to_irq() returns a valid IRQ number, the platform might
- * still prefer to poll, e.g., because that IRQ number is already used
- * by another unit and cannot be shared.
+ * Do not use IRQ if the platform prefers to poll, e.g., because that
+ * IRQ number is already used by another unit and cannot be shared.
*/
- if (irq >= 0 && host->caps & MMC_CAP_NEEDS_POLL)
- irq = -EINVAL;
+ if (!(host->caps & MMC_CAP_NEEDS_POLL))
+ irq = gpiod_to_irq(ctx->cd_gpio);
if (irq >= 0) {
if (!ctx->cd_gpio_isr)
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mmc: slot-gpio: call gpiod_to_irq() only when MMC_CAP_NEEDS_POLL is unset
2017-11-08 6:34 [PATCH] mmc: slot-gpio: call gpiod_to_irq() only when MMC_CAP_NEEDS_POLL is unset Masahiro Yamada
@ 2017-11-27 9:57 ` Ulf Hansson
0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2017-11-27 9:57 UTC (permalink / raw)
To: Masahiro Yamada
Cc: linux-mmc, Adrian Hunter, linux-kernel, Andy Shevchenko, Shawn Lin
On 8 November 2017 at 07:34, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> It is not efficient to call gpiod_to_irq() regardless the flag, then
> ignore the returned irq if MMC_CAP_NEEDS_POLL.
>
> Move gpiod_to_irq() after the MMC_CAP_NEEDS_POLL check.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Thanks, applied for next!
Kind regards
Uffe
> ---
>
> drivers/mmc/core/slot-gpio.c | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
> index 863f1db..f7c6e05 100644
> --- a/drivers/mmc/core/slot-gpio.c
> +++ b/drivers/mmc/core/slot-gpio.c
> @@ -121,20 +121,18 @@ EXPORT_SYMBOL(mmc_gpio_request_ro);
> void mmc_gpiod_request_cd_irq(struct mmc_host *host)
> {
> struct mmc_gpio *ctx = host->slot.handler_priv;
> - int ret, irq;
> + int irq = -EINVAL;
> + int ret;
>
> if (host->slot.cd_irq >= 0 || !ctx || !ctx->cd_gpio)
> return;
>
> - irq = gpiod_to_irq(ctx->cd_gpio);
> -
> /*
> - * Even if gpiod_to_irq() returns a valid IRQ number, the platform might
> - * still prefer to poll, e.g., because that IRQ number is already used
> - * by another unit and cannot be shared.
> + * Do not use IRQ if the platform prefers to poll, e.g., because that
> + * IRQ number is already used by another unit and cannot be shared.
> */
> - if (irq >= 0 && host->caps & MMC_CAP_NEEDS_POLL)
> - irq = -EINVAL;
> + if (!(host->caps & MMC_CAP_NEEDS_POLL))
> + irq = gpiod_to_irq(ctx->cd_gpio);
>
> if (irq >= 0) {
> if (!ctx->cd_gpio_isr)
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-27 9:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-08 6:34 [PATCH] mmc: slot-gpio: call gpiod_to_irq() only when MMC_CAP_NEEDS_POLL is unset Masahiro Yamada
2017-11-27 9:57 ` Ulf Hansson
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.