[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VdsMNn29TFDYXerZQfhCm6uiGHid8ZX7HOCygXNkmJDVA@mail.gmail.com>
Date: Tue, 22 May 2018 01:55:51 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Evan Green <evgreen@...omium.org>
Cc: Ulf Hansson <ulf.hansson@...aro.org>,
Adrian Hunter <adrian.hunter@...el.com>,
linux-mmc@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Douglas Anderson <dianders@...omium.org>
Subject: Re: [PATCH] mmc: Allow non-sleeping GPIO cd
On Tue, May 22, 2018 at 1:35 AM, Evan Green <evgreen@...omium.org> wrote:
Some style concerns.
> int mmc_gpio_get_cd(struct mmc_host *host)
> {
> + int can_sleep;
> struct mmc_gpio *ctx = host->slot.handler_priv;
I would rather name it
int cansleep;
and put after ctx definition.
>
> if (!ctx || !ctx->cd_gpio)
> return -ENOSYS;
>
> - if (ctx->override_cd_active_level)
> - return !gpiod_get_raw_value_cansleep(ctx->cd_gpio) ^
> - !!(host->caps2 & MMC_CAP2_CD_ACTIVE_HIGH);
> + can_sleep = gpiod_cansleep(ctx->cd_gpio);
> + if (ctx->override_cd_active_level) {
> + int value = can_sleep ?
> + gpiod_get_raw_value_cansleep(ctx->cd_gpio) :
> + gpiod_get_raw_value(ctx->cd_gpio);
> + return !value ^ !!(host->caps2 & MMC_CAP2_CD_ACTIVE_HIGH);
> + }
>
> - return gpiod_get_value_cansleep(ctx->cd_gpio);
> + return can_sleep ? gpiod_get_value_cansleep(ctx->cd_gpio) :
> + gpiod_get_value(ctx->cd_gpio);
Perhaps same style as you use above woule be better, i.e.
retrun cansleep ?
true_path:
false_path;
> }
> EXPORT_SYMBOL(mmc_gpio_get_cd);
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists