From: Rosen Penev <rosenp@gmail.com>
To: linux-i2c@vger.kernel.org
Cc: Andi Shyti <andi.shyti@kernel.org>,
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH 2/3] i2c: ibm_iic: get the irq early in probe
Date: Fri, 21 Aug 2026 16:02:15 -0700 [thread overview]
Message-ID: <20260821230217.319418-3-rosenp@gmail.com> (raw)
In-Reply-To: <20260821230217.319418-1-rosenp@gmail.com>
platform_get_irq() can return -EPROBE_DEFER, unlike
irq_of_map_and_parse(), which helps reduce work done during probe.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/i2c/busses/i2c-ibm_iic.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index 043cb64a2544..2730c8410167 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -649,20 +649,11 @@ static inline u8 iic_clckdiv(unsigned int opb)
}
static int iic_request_irq(struct platform_device *ofdev,
- struct ibm_iic_private *dev)
+ struct ibm_iic_private *dev, int irq)
{
- struct device_node *np = ofdev->dev.of_node;
- int irq;
-
if (iic_force_poll)
return 0;
- irq = irq_of_parse_and_map(np, 0);
- if (!irq) {
- dev_err(&ofdev->dev, "irq_of_parse_and_map failed\n");
- return 0;
- }
-
/* Disable interrupts until we finish initialization, assumes
* level-sensitive IRQ setup...
*/
@@ -686,12 +677,19 @@ static int iic_probe(struct platform_device *ofdev)
struct i2c_adapter *adap;
void __iomem *vaddr;
const u32 *freq;
+ int irq;
int ret;
vaddr = devm_platform_ioremap_resource(ofdev, 0);
if (IS_ERR(vaddr))
return PTR_ERR(vaddr);
+ irq = platform_get_irq(ofdev, 0);
+ if (irq == -EPROBE_DEFER)
+ return irq;
+ if (irq < 0)
+ dev_warn(&ofdev->dev, "using polling mode\n");
+
dev = kzalloc_obj(*dev);
if (!dev)
return -ENOMEM;
@@ -702,9 +700,8 @@ static int iic_probe(struct platform_device *ofdev)
init_waitqueue_head(&dev->wq);
- dev->irq = iic_request_irq(ofdev, dev);
- if (!dev->irq)
- dev_warn(&ofdev->dev, "using polling mode\n");
+ if (irq > 0)
+ dev->irq = iic_request_irq(ofdev, dev, irq);
/* Board specific settings */
if (iic_force_fast || of_get_property(np, "fast-mode", NULL))
--
2.55.0
next prev parent reply other threads:[~2026-08-21 23:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 23:02 [PATCH 0/3] i2c: ibm_iic: use devm and get irq in probe Rosen Penev
2026-08-21 23:02 ` [PATCH 1/3] i2c: ibm_iic: ioremap with platform pointer Rosen Penev
2026-08-22 13:05 ` Markus Elfring
2026-08-21 23:02 ` Rosen Penev [this message]
2026-08-21 23:02 ` [PATCH 3/3] i2c: ibm_iic: use devm for main allocation Rosen Penev
2026-08-22 13:12 ` Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260821230217.319418-3-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=andi.shyti@kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox