[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdb7gFAr=-WbeMv98t6wcM+T2yJ+BqhLxiSY=Oq=9fnLYQ@mail.gmail.com>
Date: Thu, 7 Feb 2013 20:03:05 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Dongjin Kim <tobetter@...il.com>
Cc: Thomas Abraham <thomas.ab@...sung.com>,
Seungwon Jeon <tgih.jun@...sung.com>,
Jaehoon Chung <jh80.chung@...sung.com>,
Chris Ball <cjb@...top.org>, linux-mmc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mmc: dw_mmc: No bus setup if default pinctrl is used
On Thu, Feb 7, 2013 at 7:17 PM, Dongjin Kim <tobetter@...il.com> wrote:
> Legacy gpio based bus setup is failed when the bus pins are listed with the
> property 'pinctrl-0' and 'pinctrl-names', instead of 'gpios'. The default
> pinctrls are handled by device core before probe, no need to configure the
> pins again in a device driver.
Aha.
> {
> int idx, gpio, ret;
> + int nr_pins = NUM_PINS(bus_width);
>
> if (!slot_np)
> return -EINVAL;
>
> +#if defined(CONFIG_PINCTRL)
> + /* Default pinctrl is used */
> + if (!IS_ERR(host->dev->pins->default_state))
> + nr_pins = 0;
> +#endif
Use:
if (IS_ENABLED(CONFIG_PINCTRL))
nr_pins = 0;
Without ifdefs. Grep kernel for examples.
Read <linux/kconfig.h> for explanations.
Put a comment above this to explain exactly why
you do this.
> +
> /* cmd + clock + bus-width pins */
> - for (idx = 0; idx < NUM_PINS(bus_width); idx++) {
> + for (idx = 0; idx < nr_pins; idx++) {
> gpio = of_get_gpio(slot_np, idx);
> if (!gpio_is_valid(gpio)) {
> dev_err(host->dev, "invalid gpio: %d\n", gpio);
This looks kludgy, is it so that the driver falls back to GPIO
if it cannot use pinctrl? Can't it just depend on CONFIG_PINCTRL
in Kconfig or do you absolutely have to support both cases?
I was under the impression that the Exynos requires pinctrl.
Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists