On Tue, May 14, 2024 at 5:05 PM Satya Priya Kakitapalli
<quic_skakitap@xxxxxxxxxxx> wrote:
...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)
I didn't get this. The ARRAY_SIZE():s are defined at compile timeCorrect. 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.I think the reason it is placed here is that the above line reads:In any case BUILD_BUG_ON() is not encouraged for such cases, it would be much+ BUILD_BUG_ON((ARRAY_SIZE(pldo_ranges) != 1) ||This should be an && not || right?
+ (ARRAY_SIZE(nldo_ranges) != 1));
better to have a static_assert() near to one of those arrays.
rdesc->n_linear_ranges = 1;
and that would need to change if anyone expands the arrays.
globally. How does this prevent from using static_assert()?
So, BUILD_BUG_ON is the only way to go here.I don't think so.