Re: [PATCH 2/2] crypto - img-hash: Drop of_match_ptr for ID table

From: Krzysztof Kozlowski
Date: Fri Mar 17 2023 - 04:13:30 EST


On 17/03/2023 04:04, Herbert Xu wrote:
> On Fri, Mar 10, 2023 at 11:30:27PM +0100, Krzysztof Kozlowski wrote:
>>
>> diff --git a/drivers/crypto/img-hash.c b/drivers/crypto/img-hash.c
>> index fe93d19e3044..4e9a6660d791 100644
>> --- a/drivers/crypto/img-hash.c
>> +++ b/drivers/crypto/img-hash.c
>> @@ -1106,7 +1106,7 @@ static struct platform_driver img_hash_driver = {
>> .driver = {
>> .name = "img-hash-accelerator",
>> .pm = &img_hash_pm_ops,
>> - .of_match_table = of_match_ptr(img_hash_match),
>> + .of_match_table = img_hash_match,
>
> I think we should keep this because this driver doesn't explicitly
> depend on OF. Sure of_match_table is unconditionally defined but
> I'd call that a bug instead of a feature :)

The missing dependency on OF is not a problem. The OF code is prepare
and will work fine if the driver is built with !OF. The point is that
with !OF after dropping of_match_ptr(), the driver could match via ACPI
(PRP0001). If we make it depending on OF, the driver won't be able to
use it, unless kernel is built with OF which is unlikely for ACPI systems.

>
> However, I would take this if you resend it with a Kconfig update
> to add an explicit dependency on OF.
>
> Thanks,

Best regards,
Krzysztof