[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240514140446.706847-1-quic_skakitap@quicinc.com>
Date: Tue, 14 May 2024 19:34:46 +0530
From: Satya Priya Kakitapalli <quic_skakitap@...cinc.com>
To: <johan@...nel.org>
CC: <andersson@...nel.org>, <andy.shevchenko@...il.com>, <broonie@...nel.org>,
<conor+dt@...nel.org>, <devicetree@...r.kernel.org>,
<johan+linaro@...nel.org>, <konrad.dybcio@...aro.org>,
<krzk+dt@...nel.org>, <lee@...nel.org>, <lgirdwood@...il.com>,
<linus.walleij@...aro.org>, <linux-arm-msm@...r.kernel.org>,
<linux-gpio@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<quic_skakitap@...cinc.com>, <robh@...nel.org>, <swboyd@...omium.org>
Subject: Re: [PATCH 12/13] regulator: add pm8008 pmic regulator driver
> On Thu, May 09, 2024 at 03:07:02PM +0300, Andy Shevchenko wrote:
> > Wed, May 08, 2024 at 10:37:50PM +0000, Stephen Boyd kirjoitti:
> > > Quoting Johan Hovold (2024-05-06 08:08:29)
> >
> > ...
> >
> > > > + BUILD_BUG_ON((ARRAY_SIZE(pldo_ranges) != 1) ||
> > >
> > > This should be an && not || right?
> >
> > > > + (ARRAY_SIZE(nldo_ranges) != 1));
> >
> > In any case BUILD_BUG_ON() is not encouraged for such cases, it would be much
> > better to have a static_assert() near to one of those arrays.
>
> I think the reason it is placed here is that the above line reads:
>
> rdesc->n_linear_ranges = 1;
>
> and that would need to change if anyone expands the arrays.
Correct. static_assert() cannot be used in the middle of code here, it can only be used at the declarations part which doesn't serve the purpose.
So, BUILD_BUG_ON is the only way to go here.
Powered by blists - more mailing lists