Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1593147

Re: [PATCH 4/4] tty/serial: sh-sci: remove uneeded IS_ERR_OR_NULL calls

From Geert Uytterhoeven <geert@linux-m68k.org>
Newsgroups linux.kernel
Subject Re: [PATCH 4/4] tty/serial: sh-sci: remove uneeded IS_ERR_OR_NULL calls
Date 2017-03-06 11:10 +0100
Message-ID <thXKy-6FK-13@gated-at.bofh.it> (permalink)
References (6 earlier) <thmhX-4Cv-1@gated-at.bofh.it> <thWEO-5Iw-13@gated-at.bofh.it> <thWEP-5Iw-27@gated-at.bofh.it> <thWYa-64J-29@gated-at.bofh.it> <thXhz-6bZ-77@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Uwe,

On Mon, Mar 6, 2017 at 10:30 AM, Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
> On Mon, Mar 06, 2017 at 10:09:50AM +0100, Geert Uytterhoeven wrote:
>> On Mon, Mar 6, 2017 at 9:58 AM, Uwe Kleine-König
>> <u.kleine-koenig@pengutronix.de> wrote:
>> > On Mon, Mar 06, 2017 at 09:49:39AM +0100, Geert Uytterhoeven wrote:
>> >> > Given that mctrl-gpio can be useful on legacy platforms, a device could
>> >> > silently run without cts-gpio even there.
>> >>
>> >> On platforms were CONFIG_GPIOLIB=n, this is not true, so the issue is moot.
>> >>
>> >> All serial drivers using (optional) mctrl-gpio have this in Kconfig:
>> >>
>> >>     select SERIAL_MCTRL_GPIO if GPIOLIB
>> >>
>> >> So they will use mctrl-gpio when GPIOLIB is enabled.
>> >> If GPIOPLIB is disabled, no flow control GPIOs are expected, and the
>> >> driver should not break that case.
>> >
>> > So it all boils down to the question: Is GPIOLIB=n enough to assume no
>> > gpio is needed?
>> >
>> > I'd say it is not.
>>
>> How does the platform register these GPIOs when GPIOPLIB is not enabled by
>> the platform, and gpiod_add_lookup_table() is thus not available?
>
> Obviously the platformcode cannot. In this case you could argue that
> platformcode shouldn't register the device if a gpio is necessary. But
> this reasoning doesn't work for (DT=y || ACPI=y) && GPIOLIB=n.
>
> I wouldn't want to code this in each driver (something like:
>
>         if (IS_ENABLED(GPIOLIB) || device_is_instantiated_by_dt(dev) || device_is_instantiated_by_acpi(dev))
>                 gpios = mctrl_gpio_init(...);
>         else
>                 gpios = NULL;
>
> ). Putting this into GPIOLIB is the right approach, and so this is
> another argument for HALFGPIOLIB. This would fix mctrl_gpio_init en
> passant.

Do we have platforms where DT=y || ACPI=y, but GPIOLIB=n?
Ah, x86 ;-)

Anyway, for sh-sci.c, platforms either have DT and GPIOLIB, or they do not
need mctrl-gpio.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 4/4] tty/serial: sh-sci: remove uneeded IS_ERR_OR_NULL calls Richard Genoud <richard.genoud@gmail.com> - 2017-03-03 15:40 +0100
  Re: [PATCH 4/4] tty/serial: sh-sci: remove uneeded IS_ERR_OR_NULL calls Geert Uytterhoeven <geert@linux-m68k.org> - 2017-03-03 20:00 +0100
    Re: [PATCH 4/4] tty/serial: sh-sci: remove uneeded IS_ERR_OR_NULL  calls Uwe Kleine-König          <u.kleine-koenig@pengutronix.de> - 2017-03-03 20:20 +0100
      Re: [PATCH 4/4] tty/serial: sh-sci: remove uneeded IS_ERR_OR_NULL calls Geert Uytterhoeven <geert@linux-m68k.org> - 2017-03-03 20:40 +0100
        Re: [PATCH 4/4] tty/serial: sh-sci: remove uneeded IS_ERR_OR_NULL  calls Uwe Kleine-König          <u.kleine-koenig@pengutronix.de> - 2017-03-03 20:50 +0100
          Re: [PATCH 4/4] tty/serial: sh-sci: remove uneeded IS_ERR_OR_NULL calls Geert Uytterhoeven <geert@linux-m68k.org> - 2017-03-04 16:40 +0100
            Re: [PATCH 4/4] tty/serial: sh-sci: remove uneeded IS_ERR_OR_NULL  calls Uwe Kleine-König          <u.kleine-koenig@pengutronix.de> - 2017-03-04 19:10 +0100
              Re: [PATCH 4/4] tty/serial: sh-sci: remove uneeded IS_ERR_OR_NULL calls Geert Uytterhoeven <geert@linux-m68k.org> - 2017-03-06 10:00 +0100
                Re: [PATCH 4/4] tty/serial: sh-sci: remove uneeded IS_ERR_OR_NULL  calls Uwe Kleine-König          <u.kleine-koenig@pengutronix.de> - 2017-03-06 10:00 +0100
                Re: [PATCH 4/4] tty/serial: sh-sci: remove uneeded IS_ERR_OR_NULL calls Geert Uytterhoeven <geert@linux-m68k.org> - 2017-03-06 10:20 +0100
                Re: [PATCH 4/4] tty/serial: sh-sci: remove uneeded IS_ERR_OR_NULL  calls Uwe Kleine-König          <u.kleine-koenig@pengutronix.de> - 2017-03-06 10:40 +0100
                Re: [PATCH 4/4] tty/serial: sh-sci: remove uneeded IS_ERR_OR_NULL  calls Uwe Kleine-König          <u.kleine-koenig@pengutronix.de> - 2017-03-06 11:10 +0100
                Re: [PATCH 4/4] tty/serial: sh-sci: remove uneeded IS_ERR_OR_NULL calls Geert Uytterhoeven <geert@linux-m68k.org> - 2017-03-06 11:10 +0100

csiph-web