[PATCH v2 3/6] i2c: core: Switch to fwnode APIs to get IRQ

Andy Shevchenko
2025-04-07T09:58:57Z

Switch to fwnode APIs to get IRQ. In particular this enables
a support of the separate wakeup IRQ. The rest is converted
just for the sake of consistency and fwnode reuse.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/i2c/i2c-core-base.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index edab56e5d5e5..196b29e5924b 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -33,7 +33,6 @@
#include <linux/mutex.h>
#include <linux/of_device.h>
#include <linux/of.h>
-#include <linux/of_irq.h>
#include <linux/pinctrl/consumer.h>
#include <linux/pinctrl/devinfo.h>
#include <linux/pm_domain.h>
@@ -510,9 +509,9 @@ static int i2c_device_probe(struct device *dev)
pm_runtime_get_sync(&client->adapter->dev);
irq = i2c_smbus_host_notify_to_irq(client);
} else if (is_of_node(fwnode)) {
- irq = of_irq_get_byname(dev->of_node, "irq");
+ irq = fwnode_irq_get_byname(fwnode, "irq");
if (irq == -EINVAL || irq == -ENODATA)
- irq = of_irq_get(dev->of_node, 0);
+ irq = fwnode_irq_get(fwnode, 0);
} else if (is_acpi_device_node(fwnode)) {
bool wake_capable;

@@ -547,7 +546,7 @@ static int i2c_device_probe(struct device *dev)
if (client->flags & I2C_CLIENT_WAKE) {
int wakeirq;

- wakeirq = of_irq_get_byname(dev->of_node, "wakeup");
+ wakeirq = fwnode_irq_get_byname(fwnode, "wakeup");
if (wakeirq == -EPROBE_DEFER) {
status = wakeirq;
goto put_sync_adapter;
--
2.47.2