lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 16 Mar 2017 17:38:45 +0100
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Linus Walleij <linus.walleij@...aro.org>
Cc:     Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>,
        Richard Genoud <richard.genoud@...il.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        Nicolas Ferre <nicolas.ferre@...rochip.com>,
        Boris Brezillon <boris.brezillon@...e-electrons.com>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "linux-serial@...r.kernel.org" <linux-serial@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Janusz Uzycki <j.uzycki@...roma.com.pl>,
        "linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>
Subject: Re: [PATCH 4/4] tty/serial: sh-sci: remove uneeded IS_ERR_OR_NULL calls

Hi Linus,

On Thu, Mar 16, 2017 at 4:18 PM, Linus Walleij <linus.walleij@...aro.org> wrote:
> On Mon, Mar 6, 2017 at 11:02 AM, Uwe Kleine-König
> <u.kleine-koenig@...gutronix.de> wrote:
>> On Mon, Mar 06, 2017 at 10:53:27AM +0100, Geert Uytterhoeven wrote:
>>> On Mon, Mar 6, 2017 at 10:30 AM, Uwe Kleine-König
>>> > 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 ;-)
>>
>> Yeah, and I think rm -r arch/x86 won't be acceptable :-) I assume you
>> can also configure some arm or powerpc systems without GPIOLIB.
>>
>>> Anyway, for sh-sci.c, platforms either have DT and GPIOLIB, or they do not
>>> need mctrl-gpio.
>>
>> So we're in agreement now that HALFGPIOLIB is the way to go?
>> Linus, what do you think?
>
> OK modem lines over GPIO.
>
> So the problem is that GPIOLIB is needed (obviously) for mctrl_gpio_init() to
> work properly, and then there are some stubs in
> drivers/tty/serial/serial_mctrl_gpio.h
> for !GPIOLIB.
>
> And this whole discussion is all about that !GPIOLIB case really,
> whether DT, ACPI, SFI or board files machine data is used doesn't
> really matter.
>
> We're talking about:
>
>> git grep mctrl_gpio_init
> drivers/tty/serial/atmel_serial.c:      atmel_port->gpios =
> mctrl_gpio_init(&atmel_port->uart, 0);
> drivers/tty/serial/clps711x.c:  s->gpios =
> mctrl_gpio_init_noauto(&pdev->dev, 0);
> drivers/tty/serial/etraxfs-uart.c:      up->gpios =
> mctrl_gpio_init_noauto(&pdev->dev, 0);
> drivers/tty/serial/imx.c:       sport->gpios = mctrl_gpio_init(&sport->port, 0);
> drivers/tty/serial/mxs-auart.c: s->gpios = mctrl_gpio_init_noauto(dev, 0);
> drivers/tty/serial/sh-sci.c:    sciport->gpios =
> mctrl_gpio_init(&sciport->port, 0);
>
> Atmel, ARM, ETRAX, ARM, ARM, Super-H, all have GPIOLIB.
> Right now no x86, correct?

It's not that black-and-white. Some of SuperH have GPIOLIB, other parts don't.

> They actually all even do things like this in Kconfig:
>
> config SERIAL_ATMEL
> (...)
>         select SERIAL_MCTRL_GPIO if GPIOLIB
>
> What stops us from removing all the stubs in
> drivers/tty/serial/serial_mctrl_gpio.h
> and just make SERIAL_MCTRL_GPIO depends on GPIOLIB?

Removing the stubs implies adding #ifdefs to the drivers that need
to handle the !SERIAL_MCTRL_GPIO case.

E.g. I don't want to break the sh-sci serial driver on SuperH platforms that
(a) don't select GPIOLIB, and
(b) don't use mtrl_gpio.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ