Re: [PATCH net-next v3 1/4] crypto: caam: Avoid unused imx8m_machine_match variable

From: Horia Geanta
Date: Tue Jul 09 2024 - 06:44:30 EST


On 7/8/2024 2:29 PM, Breno Leitao wrote:
> Hello Horia,
>
> On Fri, Jul 05, 2024 at 10:11:40AM +0000, Horia Geanta wrote:
>> On 7/2/2024 9:56 PM, Breno Leitao wrote:
>
>>> diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
>>> index bd418dea586d..d4b39184dbdb 100644
>>> --- a/drivers/crypto/caam/ctrl.c
>>> +++ b/drivers/crypto/caam/ctrl.c
>>> @@ -80,6 +80,7 @@ static void build_deinstantiation_desc(u32 *desc, int handle)
>>> append_jump(desc, JUMP_CLASS_CLASS1 | JUMP_TYPE_HALT);
>>> }
>>>
>>> +#ifdef CONFIG_OF
>>> static const struct of_device_id imx8m_machine_match[] = {
>>> { .compatible = "fsl,imx8mm", },
>>> { .compatible = "fsl,imx8mn", },
>>> @@ -88,6 +89,7 @@ static const struct of_device_id imx8m_machine_match[] = {
>>> { .compatible = "fsl,imx8ulp", },
>>> { }
>>> };
>>> +#endif
>
>> Shouldn't using __maybe_unused instead of the ifdeffery be preferred
>> in this case?
>
> That is an option as well. Not sure if it makes any difference, tho.
>
In general, I prefer avoiding preprocessor conditionals.
This seems to be suggested also here:
https://www.kernel.org/doc/html/latest/process/coding-style.html#conditional-compilation

> If you prefer __maybe_unused, I am more than happy to send a follow-up
> patch to convert the #ifdef to __maybe_unused. Up to you.
>
Nah, please don't bother.

Thanks,
Horia