[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <24e594539714c5997545414d084a60128673a50b.camel@pengutronix.de>
Date: Fri, 21 Nov 2025 16:18:49 +0100
From: Philipp Zabel <p.zabel@...gutronix.de>
To: Laurentiu Mihalcea <laurentiumihalcea111@...il.com>, Krzysztof Kozlowski
<krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, Shawn Guo
<shawnguo@...nel.org>, Fabio Estevam <festevam@...il.com>, Daniel Baluta
<daniel.baluta@....com>, Shengjiu Wang <shengjiu.wang@....com>, Frank Li
<Frank.Li@....com>
Cc: devicetree@...r.kernel.org, imx@...ts.linux.dev,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Pengutronix Kernel Team
<kernel@...gutronix.de>
Subject: Re: [PATCH v5 4/6] reset: imx8mp-audiomix: Extend the driver usage
On Fr, 2025-11-21 at 01:29 -0800, Laurentiu Mihalcea wrote:
> On 11/14/2025 8:02 AM, Philipp Zabel wrote:
> > On Fr, 2025-11-14 at 05:37 -0800, Laurentiu Mihalcea wrote:
> > > From: Laurentiu Mihalcea <laurentiu.mihalcea@....com>
> > >
> > > Switch to per-device reset map to allow reusing the driver for other NXP
> > > block control IPs.
> > >
> > > Reviewed-by: Daniel Baluta <daniel.baluta@....com>
> > > Reviewed-by: Frank Li <Frank.Li@....com>
> > > Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@....com>
> > > ---
> > > drivers/reset/reset-imx8mp-audiomix.c | 18 ++++++++++++++++--
> > > 1 file changed, 16 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/reset/reset-imx8mp-audiomix.c b/drivers/reset/reset-imx8mp-audiomix.c
> > > index 35df9bd5f71a..d3396f37d1ff 100644
> > > --- a/drivers/reset/reset-imx8mp-audiomix.c
> > > +++ b/drivers/reset/reset-imx8mp-audiomix.c
> > > @@ -24,7 +24,12 @@ struct imx8mp_reset_map {
> > > bool active_low;
> > > };
> > >
> > > -static const struct imx8mp_reset_map reset_map[] = {
> > > +struct imx8mp_reset_info {
> > > + const struct imx8mp_reset_map *map;
> > > + int num_lines;
> > > +};
> > > +
> > > +static const struct imx8mp_reset_map imx8mp_reset_map[] = {
> > > [IMX8MP_AUDIOMIX_EARC_RESET] = {
> > > .offset = IMX8MP_AUDIOMIX_EARC_RESET_OFFSET,
> > > .bit = 0,
> > > @@ -42,9 +47,15 @@ static const struct imx8mp_reset_map reset_map[] = {
> > > },
> > > };
> > >
> > > +static const struct imx8mp_reset_info imx8mp_reset_info = {
> > > + .map = imx8mp_reset_map,
> > > + .num_lines = ARRAY_SIZE(imx8mp_reset_map),
> > > +};
> > > +
> > > struct imx8mp_audiomix_reset {
> > > struct reset_controller_dev rcdev;
> > > struct regmap *regmap;
> > > + const struct imx8mp_reset_info *rinfo;
> > Since only rinfo->map is used in imx8mp_audiomix_update(), you could
> > directly store a
> >
> > const struct imx8mp_reset_map *map;
>
>
> hm, that is true, but I wonder if instead of replacing "rinfo" with "map", it would be better to
>
> keep "rinfo" and add an out-of-bounds check for the reset ID in imx8mp_audiomix_update().
>
> Something like:
>
>
> if (id >= priv->rinfo->num_lines)
>
> return -EINVAL;
>
>
> we are stuck with "struct imx8mp_reset_info" so might as well fully make use of it?
There is no need to check this again. You copy rinfo->num_lines into
rcdev.nr_resets, which is checked in of_reset_simple_xlate() before the
reset_control is even handed to the consumer.
regards
Philipp
Powered by blists - more mailing lists