linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: geert@linux-m68k.org (Geert Uytterhoeven)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] tty/serial: sh-sci: remove uneeded IS_ERR_OR_NULL calls
Date: Thu, 23 Mar 2017 13:44:19 +0100	[thread overview]
Message-ID: <CAMuHMdVcALm_iLiTgs7GL5S77ur+iGVhyD0yB9FxCfKFpw7uug@mail.gmail.com> (raw)
In-Reply-To: <20170323123437.uqdwhfmmsjke3f7s@pengutronix.de>

Hi Uwe,

On Thu, Mar 23, 2017 at 1:34 PM, Uwe Kleine-K?nig
<u.kleine-koenig@pengutronix.de> wrote:
> On Thu, Mar 23, 2017 at 01:03:56PM +0100, Geert Uytterhoeven wrote:
>> On Thu, Mar 23, 2017 at 12:11 PM, Uwe Kleine-K?nig
>> <u.kleine-koenig@pengutronix.de> wrote:
>> >> Make sure to enable all drivers and subsystems you need when building
>> >> your kernel. That's always true. And may indeed be hard to debug (e.g. what
>> >> kernel options do I need to make systemd work?).
>> >
>> > It's worse here. If you forget to enable a driver the device isn't bound
>> > and that's obvious to diagnose. When ignoring an optional GPIO there
>> > might be a device that claims to work but fails to do so. (e.g. you
>> > write to memory, write() returns 0, but the data never landed there.)
>> >
>> >> > write(2) and close(2) succeed most of the time, too. Still it's not a
>> >> > good idea to not check the return value. Or let the kernel return
>> >> > success unconditionally.
>> >>
>> >> Writing all bytes passed in the buffer is "optional" in another sense than
>> >> an "optional" GPIO: you must retry the write, while you can continue if
>> >> an optional GPIO is not present.
>> >
>> > And that is the point. You can continue *iff* the optional GPIO is not
>> > present. The patch in question removes the ability to determine if that
>> > GPIO is present and claims it is not present.
>>
>> If you forget to enable a driver/subsystem, you sometimes cannot determine
>> if the device is present or not neither.
>>
>> Hence it boils down to "knowing" if there is a GPIO or not.
>> So, when can there be a GPIO?
>>   1. The GPIO is described in DT.
>>      => Not an issue, as DT GPIO implies GPIOLIB,
>>   2. The GPIO is described in legacy platform data.
>>      => The platform code should make sure GPIOLIB is selected when needed.
>>
>> Issue solved?
>
> I like it better to not rely on platform code to do the right thing.

;-)

> Maybe we can make gpiod_get_optional look like this:
>
>         if (!dev->of_node && isnt_a_acpi_device(dev) && !IS_ENABLED(GPIOLIB))
>                 return NULL;
>         else
>                 return -ENOSYS;
>
> I don't know how isnt_a_acpi_device looks like, probably it involves
> CONFIG_ACPI and/or dev->acpi_node.
>
> This should be safe and still comfortable for legacy platforms, isn't it?

Yes, that should do the trick.

No feedback from me about ACPI.

Gr{oetje,eeting}s,

                        Geert

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

  reply	other threads:[~2017-03-23 12:44 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03 14:22 [PATCH 4/4] tty/serial: sh-sci: remove uneeded IS_ERR_OR_NULL calls Richard Genoud
2017-03-03 18:58 ` Geert Uytterhoeven
2017-03-03 19:12   ` Uwe Kleine-König
2017-03-03 19:21     ` Geert Uytterhoeven
2017-03-03 19:44       ` Uwe Kleine-König
2017-03-04 15:35         ` Geert Uytterhoeven
2017-03-04 17:48           ` Uwe Kleine-König
2017-03-06  8:49             ` Geert Uytterhoeven
2017-03-06  8:58               ` Uwe Kleine-König
2017-03-06  9:09                 ` Geert Uytterhoeven
2017-03-06  9:30                   ` Uwe Kleine-König
2017-03-06  9:53                     ` Geert Uytterhoeven
2017-03-06 10:02                       ` Uwe Kleine-König
2017-03-14 15:32                         ` Linus Walleij
2017-03-16 15:18                         ` Linus Walleij
2017-03-16 16:37                           ` Uwe Kleine-König
2017-03-16 16:38                           ` Geert Uytterhoeven
2017-03-20  9:56                             ` Geert Uytterhoeven
2017-03-20 10:03                               ` Geert Uytterhoeven
2017-03-20 10:31                               ` Uwe Kleine-König
2017-03-20 10:38                                 ` Geert Uytterhoeven
2017-03-20 11:07                                   ` Uwe Kleine-König
2017-03-23  9:32                                     ` Linus Walleij
2017-03-23 10:10                                       ` Uwe Kleine-König
2017-03-23 10:20                                         ` Geert Uytterhoeven
2017-03-23 11:11                                           ` Uwe Kleine-König
2017-03-23 12:03                                             ` Geert Uytterhoeven
2017-03-23 12:34                                               ` Uwe Kleine-König
2017-03-23 12:44                                                 ` Geert Uytterhoeven [this message]
2017-03-23 13:41                                                 ` Linus Walleij
2017-03-23 14:43                                                   ` Dmitry Torokhov
2017-03-23 15:44                                                     ` Dmitry Torokhov
2017-03-23 19:10                                                       ` Uwe Kleine-König
2017-03-23 19:58                                                         ` Dmitry Torokhov
2017-03-24  8:00                                                           ` Uwe Kleine-König
2017-03-24  8:29                                                             ` Geert Uytterhoeven
2017-03-24  8:39                                                               ` Uwe Kleine-König
2017-03-24  8:59                                                                 ` Geert Uytterhoeven
2017-03-24  9:15                                                                   ` Uwe Kleine-König
2017-03-24  9:44                                                                     ` Geert Uytterhoeven
2017-03-24 10:01                                                                       ` Uwe Kleine-König
2017-03-24  8:58                                                         ` Linus Walleij
2017-03-23 15:55                                             ` Dmitry Torokhov
2017-03-23 13:37                                         ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMuHMdVcALm_iLiTgs7GL5S77ur+iGVhyD0yB9FxCfKFpw7uug@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).