Re: [PATCH 2/2] i2c: smbus: Use device_ functions instead of of_

From: Andy Shevchenko
Date: Thu Dec 16 2021 - 10:01:23 EST


On Thu, Dec 16, 2021 at 3:14 PM Akhil R <akhilrajeev@xxxxxxxxxx> wrote:
>
> Change of_ functions to device_ for firmware agnostic usage.

of_*()
device_*()

> This allows to have smbus_alert interrupt without any changes
> in the controller drivers using ACPI table.

...

> - irq = of_property_match_string(adapter->dev.of_node, "interrupt-names",
> - "smbus_alert");
> + irq = device_property_match_string(adapter->dev.parent, "interrupt-names",
> + "smbus_alert");

Hmm... Adapter device node is not the same as the node for its parent.
Do you have some code that propagates of_node from parent to child?

I.o.w. I would expect to see

irq = device_property_match_string(&adapter->dev, "interrupt-names",

here.

> if (irq == -EINVAL || irq == -ENODATA)
> return 0;
> else if (irq < 0)

TBH the entire code smells. "Interesting" way of getting an optional
named interrupt.

--
With Best Regards,
Andy Shevchenko