public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: Why do we need reset_control_get_optional() ?
Date: Mon, 08 Aug 2016 23:39:38 +0200	[thread overview]
Message-ID: <8414390.v8zIvdprGF@wuerfel> (raw)
In-Reply-To: <1470674376.2497.49.camel@pengutronix.de>

On Monday, August 8, 2016 6:39:36 PM CEST Philipp Zabel wrote:
> > Now I'm also confused about what we really need
> > reset_control_get_optional() for, and which error codes the callers
> > are supposed to check.
> > 
> > This is the matrix I think you mean for _get_optional:
> > 
> [...]
> > CONFIG_RESET_CONTROLLER=n, dt entry present: -EOPNOTSUPP
> > CONFIG_RESET_CONTROLLER=n, dt entry missing: -ENOENT
> 
> ^^ I didn't consider this distiction.
> 
> > Is this what you had in mind? If so, what is the value of the
> > added runtime warning for reset_control_get? Any caller of that
> > function would already check for errors, the only difference
> > I see is that callers of _optional can ignore -ENOENT.
> 
> My initial motivation was to make it as hard as possible to misconfigure
> the kernel, which is why I initially didn't want stubs for the
> non-optional variant. Of course that would cause build failures and/or
> reduced compile test coverage, so we added the stubs and the warning to
> make it obvious when a misconfigured kernel is running: on a kernel with
> RESET_CONTROLLER=n drivers that use reset_control_get are expected to
> build, but they are not expected to work. I suppose the same is the case
> for _optional, if the dt entry is present, so maybe we should drop
> reset_control_get_optional and add always a warning in case of
> -EOPNOTSUPP.
> I don't want all drivers to have to differentiate between -EOPNOTSUPP
> and -ENOENT error codes, only current reset_control_get_optional users
> have to do that.

In almost all cases, I think drivers that require the reset line
wouldn't even check the failure code but just pass it down to
the caller (usually platform_device_probe()), so the really don't
need to care.

Some drivers might want to handle -EPROBE_DEFER (by not warning
about it before returning from probe), and -ENOENT can be handled
in a similar way (by continuing instead of failing).

	Arnd

  reply	other threads:[~2016-08-08 21:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-23 11:22 Why do we need reset_control_get_optional() ? Masahiro Yamada
2016-07-28  9:43 ` Philipp Zabel
2016-07-28 10:09   ` Arnd Bergmann
2016-07-28 10:52     ` Masahiro Yamada
2016-07-28 11:00       ` Philipp Zabel
2016-08-05 15:50         ` Arnd Bergmann
2016-08-08 16:39           ` Philipp Zabel
2016-08-08 21:39             ` Arnd Bergmann [this message]
2016-08-16 14:36             ` Masahiro Yamada
2016-08-24  6:58               ` Masahiro Yamada
2016-08-24 12:30                 ` Philipp Zabel
2016-07-28 10:56     ` Philipp Zabel
2016-07-28 10:29   ` Masahiro Yamada
2016-07-29 13:08     ` Philipp Zabel
2016-07-30 20:13       ` Arnd Bergmann
2016-08-05  8:55         ` Philipp Zabel
2016-08-05 15:35           ` Arnd Bergmann
2016-08-08 17:29             ` Philipp Zabel
2016-08-16  9:41             ` Masahiro Yamada
2016-08-24 13:29               ` Philipp Zabel

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=8414390.v8zIvdprGF@wuerfel \
    --to=arnd@arndb.de \
    --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