devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Clément Léger" <clement.leger@bootlin.com>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Rob Herring <robh+dt@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Allan Nielsen <allan.nielsen@microchip.com>,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 2/2] reset: add support for fwnode
Date: Wed, 23 Mar 2022 17:21:21 +0100	[thread overview]
Message-ID: <20220323172121.220a26e9@fixe.home> (raw)
In-Reply-To: <ba95a3fec9c726e2cd61665ac5d7f89d16232d60.camel@pengutronix.de>

Le Wed, 23 Mar 2022 16:29:41 +0100,
Philipp Zabel <p.zabel@pengutronix.de> a écrit :

> On Mi, 2022-03-23 at 10:50 +0100, Clément Léger wrote:
> [...]
> > diff --git a/drivers/reset/core.c b/drivers/reset/core.c
> > index 61e688882643..f014da03b7c1 100644
> > --- a/drivers/reset/core.c
> > +++ b/drivers/reset/core.c
> > @@ -4,6 +4,7 @@
> >   *
> >   * Copyright 2013 Philipp Zabel, Pengutronix
> >   */
> > +#include <linux/acpi.h>
> >  #include <linux/atomic.h>
> >  #include <linux/device.h>
> >  #include <linux/err.h>
> > @@ -70,26 +71,49 @@ static const char *rcdev_name(struct
> > reset_controller_dev *rcdev)
> >         if (rcdev->of_node)
> >                 return rcdev->of_node->full_name;  
> 
> Could the above be removed, since reset_controller_register() set
> rcdev->fwnode to of_fwnode_handle(rcdev->of_node) earlier?

Yes, this should work in all cases, the only difference is that
fwnode_get_name() returns the basename of the of_node full_name field.
This is potentially a change from what was displayed before. If you are
ok with that, I'll drop these lines.

[...]

> > +       }
> > +
> > +       if (rcdev->of_xlate) {
> > +               rcdev->fwnode_xlate = fwnode_of_reset_xlate;  
> 
> It should be documented that .fwnode_xlate/.fwnode_reset_n_cells are
> ignored if .of_xlate is set.

Acked.

[...]

> >         if (id) {
> > -               index = of_property_match_string(node,
> > -                                                "reset-names", id);
> > +               index = fwnode_property_match_string(fwnode, "reset-names", id);
> >                 if (index == -EILSEQ)
> >                         return ERR_PTR(index);  
> 
> I don't think this is good enough any more. At least -ENOMEM is added
> as a possible error return code by this change.

Yes indeed, errors are clearly not correctly handled anymore. At least
-EILSEQ won't be triggered.
> 
> [...]
> > @@ -945,6 +989,9 @@ struct reset_control *__reset_control_get(struct device *dev, const char *id,
> >         if (dev->of_node)
> >                 return __of_reset_control_get(dev->of_node, id, index, shared,
> >                                               optional, acquired);  
> 
> Could the above be removed, given that __of_reset_control_get() just
> wraps __fwnode_reset_control_get(), which is called right below:

Oh yes, sorry for that. It can clearly be removed.

[...]

> >   * @of_node: corresponding device tree node as phandle target
> > + * @fwnode: corresponding firmware node as reference target
> >   * @of_reset_n_cells: number of cells in reset line specifiers
> >   * @of_xlate: translation function to translate from specifier as found in the
> >   *            device tree to id as given to the reset control ops, defaults
> > - *            to :c:func:`of_reset_simple_xlate`.
> > + *            to :c:func:`fwnode_of_reset_xlate`.
> > + * @fwnode_reset_n_cells: number of cells in reset line reference specifiers
> > + * @fwnode_xlate: translation function to translate from reference specifier as
> > + *                found in the firmware node description to id as given to the
> > + *                reset control ops, defaults to
> > + *                :c:func:`fwnode_reset_simple_xlate`.  
> 
> This should mention that .fwnode_xlate is ignored/overwritten when
> .of_xlate is set.

Acked.

> 
> 
> regards
> Philipp

Regards,

-- 
Clément Léger,
Embedded Linux and Kernel engineer at Bootlin
https://bootlin.com

  reply	other threads:[~2022-03-23 16:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23  9:50 [PATCH 0/2] add fwnode support to reset subsystem Clément Léger
2022-03-23  9:50 ` [PATCH 1/2] of: add function to convert fwnode_reference_args to of_phandle_args Clément Léger
2022-03-23  9:50 ` [PATCH 2/2] reset: add support for fwnode Clément Léger
2022-03-23 15:29   ` Philipp Zabel
2022-03-23 16:21     ` Clément Léger [this message]
2022-03-24  9:19       ` Clément Léger
2022-03-24  9:39         ` Philipp Zabel
2022-03-24  9:44       ` Philipp Zabel
2022-03-23 15:07 ` [PATCH 0/2] add fwnode support to reset subsystem Philipp Zabel
2022-03-23 16:05   ` Clément Léger
2022-03-24 10:08     ` Philipp Zabel
2022-03-24 10:16       ` Clément Léger

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=20220323172121.220a26e9@fixe.home \
    --to=clement.leger@bootlin.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=allan.nielsen@microchip.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=thomas.petazzoni@bootlin.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).