[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZeBo4N204gLO0eUd@smile.fi.intel.com>
Date: Thu, 29 Feb 2024 13:22:08 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Théo Lebrun <theo.lebrun@...tlin.com>
Cc: Gregory CLEMENT <gregory.clement@...tlin.com>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>, Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Linus Walleij <linus.walleij@...aro.org>,
Rafał Miłecki <rafal@...ecki.pl>,
Philipp Zabel <p.zabel@...gutronix.de>,
Vladimir Kondratiev <vladimir.kondratiev@...ileye.com>,
linux-mips@...r.kernel.org, linux-clk@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Tawfik Bayouk <tawfik.bayouk@...ileye.com>,
linux-gpio@...r.kernel.org
Subject: Re: [PATCH v8 04/10] reset: eyeq5: add platform driver
On Wed, Feb 28, 2024 at 06:04:47PM +0100, Théo Lebrun wrote:
> On Tue Feb 27, 2024 at 6:27 PM CET, Andy Shevchenko wrote:
> > On Tue, Feb 27, 2024 at 03:55:25PM +0100, Théo Lebrun wrote:
..
> > > + u32 offset = id & GENMASK(7, 0);
> > > + u32 domain = id >> 8;
> >
> > Perhaps
> >
> > u32 offset = (id & GENMASK(7, 0)) >> 0;
> > u32 domain = (id & GENMASK(31, 8)) >> 8;
> >
> > for better understanding the split?
>
> Do the additional zero-bit-shift and GENMASK() help understanding? My
> brain needs time to parse them to then notice they do nothing and
> simplify the code in my head, back to the original version.
In my opinion yes, as you exactly showing the split.
But. The better is to use FIELD_GET().
> I personally like the simplest version (the original one). But otherwise
> FIELD_GET() with two globally-defined masks could be a solution as
> well.
Oh, yes, that's what just came to my mind without even looking here.
> I still prefer the original version better. Less symbols, less
> complexity.
[...]
> > > + priv->rcdev.of_node = np;
> >
> > It's better to use device_set_node().
>
> I don't see how device_set_node() can help? It works on struct device
> pointers. Here priv->rcdev is a reset_controller_dev struct. There are
> no users of device_set_node() in drivers/reset/.
No users doesn't mean it's good. The API is relatively "new" and takes
care of two things:
1) it uses agnostic interface;
2) it doesn't require any firmware node direct dereference.
The 2) is most important here as allows us to refactor (firmware node) code
in the future.
> > > + priv->rcdev.of_reset_n_cells = 2;
> > > + priv->rcdev.of_xlate = eq5r_of_xlate;
However, ideally these should be also translated to use fwnode as IIO did,
for example.
..
> > > + priv->rcdev.nr_resets += __builtin_popcount(eq5r_valid_masks[i]);
> >
> > Please, use corresponding hweightXX() API.
>
> Noted. I did not find this keyword even though I searched quite a bit
> for it. "popcount" sounds more logical to me. :-)
Hmm... But it's fundamental, it's called Hamming weight.
https://en.wikipedia.org/wiki/Hamming_weight
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists