From: Philipp Zabel <p.zabel@pengutronix.de>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de
Subject: Re: [PATCH RFC 1/3] reset: replace boolean parameters with flags parameter
Date: Wed, 26 Jun 2024 18:17:11 +0200 [thread overview]
Message-ID: <5500e3d44be69f5bc843e5b2159f6d0aead24ff9.camel@pengutronix.de> (raw)
In-Reply-To: <o3rf7gprs7mrldglqg7e4scibumdno36iuvtlr3c43sofjcb2t@w3d7jsjyddxe>
Hi Uwe,
On Sa, 2024-06-22 at 09:47 +0200, Uwe Kleine-König wrote:
> Hello Philipp,
>
> I like the idea in general. Just a detail concern down below.
Thank you, much appreciated.
> On Fri, Jun 21, 2024 at 04:45:02PM +0200, Philipp Zabel wrote:
> > @@ -999,8 +1001,9 @@ static struct reset_controller_dev *__reset_find_rcdev(const struct of_phandle_a
> >
> > struct reset_control *
> > __of_reset_control_get(struct device_node *node, const char *id, int index,
> > - bool shared, bool optional, bool acquired)
> > + enum reset_control_flags flags)
> > {
> > + bool optional = flags & RESET_CONTROL_FLAGS_BIT_OPTIONAL;
> > bool gpio_fallback = false;
> > struct reset_control *rstc;
> > struct reset_controller_dev *rcdev;
> > @@ -1065,7 +1068,7 @@ __of_reset_control_get(struct device_node *node, const char *id, int index,
> > }
> >
> > /* reset_list_mutex also protects the rcdev's reset_control list */
> > - rstc = __reset_control_get_internal(rcdev, rstc_id, shared, acquired);
> > + rstc = __reset_control_get_internal(rcdev, rstc_id, flags);
>
> If RESET_CONTROL_FLAGS_BIT_OPTIONAL was passed to
> __of_reset_control_get(), you're forwarding it to
> __reset_control_get_internal(). But the latter doesn't do anything with
> that flag. I wonder if the API would be still less prone to error if
> you'd filter out RESET_CONTROL_FLAGS_BIT_OPTIONAL before passing to
> __reset_control_get_internal() and in __reset_control_get_internal() add
> a check for unsupported flags.
Yes, I'll do that. For every enum value with the optional bit set,
there is a corresponding value without it.
> > out_unlock:
> > mutex_unlock(&reset_list_mutex);
> > @@ -1096,8 +1099,9 @@ __reset_controller_by_name(const char *name)
> >
> > static struct reset_control *
> > __reset_control_get_from_lookup(struct device *dev, const char *con_id,
> > - bool shared, bool optional, bool acquired)
> > + enum reset_control_flags flags)
> > {
> > + bool optional = flags & RESET_CONTROL_FLAGS_BIT_OPTIONAL;
> > const struct reset_control_lookup *lookup;
> > struct reset_controller_dev *rcdev;
> > const char *dev_id = dev_name(dev);
> > [...]
> > @@ -1422,7 +1423,7 @@ EXPORT_SYMBOL_GPL(of_reset_control_array_get);
> > * Returns pointer to allocated reset_control on success or error on failure
> > */
> > struct reset_control *
> > -devm_reset_control_array_get(struct device *dev, bool shared, bool optional)
> > +devm_reset_control_array_get(struct device *dev, enum reset_control_flags flags)
> > {
> > struct reset_control **ptr, *rstc;
> >
> > @@ -1431,7 +1432,7 @@ devm_reset_control_array_get(struct device *dev, bool shared, bool optional)
> > if (!ptr)
> > return ERR_PTR(-ENOMEM);
> >
> > - rstc = of_reset_control_array_get(dev->of_node, shared, optional, true);
> > + rstc = of_reset_control_array_get(dev->of_node, flags);
>
> Is it an error if the new devm_reset_control_array_get() is called
> without RESET_CONTROL_FLAGS_BIT_ACQUIRED in flags?
I'd be inclined to consider this not-an-error.
There is one user of of_reset_control_array_get_exclusive_released(),
so it should work in theory. Of course nobody is using both devres and
the acquire/release API at the same time, and there is no
devm_reset_control_array_get_exclusive_released() wrapper.
regards
Philipp
next prev parent reply other threads:[~2024-06-26 16:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-21 14:45 [PATCH RFC 0/3] reset: Requesting pre-deasserted, auto-reasserting reset controls via devres Philipp Zabel
2024-06-21 14:45 ` [PATCH RFC 1/3] reset: replace boolean parameters with flags parameter Philipp Zabel
2024-06-22 7:47 ` Uwe Kleine-König
2024-06-26 16:17 ` Philipp Zabel [this message]
2024-09-25 14:25 ` Uwe Kleine-König
2024-09-25 16:43 ` Philipp Zabel
2024-06-21 14:45 ` [PATCH RFC 2/3] reset: Add devres helpers to request pre-deasserted reset controls Philipp Zabel
2024-06-21 14:45 ` [PATCH RFC 3/3] reset: uniphier-glue: Use devm_reset_control_bulk_get_shared_deasserted() 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=5500e3d44be69f5bc843e5b2159f6d0aead24ff9.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=geert+renesas@glider.be \
--cc=hayashi.kunihiko@socionext.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=u.kleine-koenig@baylibre.com \
/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).