i2c: cpm: Use platform_get_irq() to retrieve interrupt
Subsystems (2)
PATCH 1/1 i2c: cpm: Use platform_get_irq() to retrieve interrupt
Replace irq_of_parse_and_map() with platform_get_irq() as recommended for device-managed IRQ lookup. Properly propagate any errors returned from platform_get_irq(). irq_of_parse_and_map() requires ire_dispose_mapping(), which is missing.
--- drivers/i2c/busses/i2c-cpm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-cpm.c +3 -3
@@ -434,9 +434,9 @@ static int cpm_i2c_setup(struct cpm_i2c *cpm)init_waitqueue_head (&cpm->i2c_wait); - cpm->irq =irq_of_parse_and_map (ofdev->dev.of_node,0 ); -if (!cpm->irq) -return -EINVAL ; + cpm->irq =platform_get_irq (ofdev,0 ); +if (cpm->irq <0 ) +return cpm->irq;/* Install interrupt handler. */ ret = request_irq(cpm->irq, cpm_i2c_interrupt, 0, "cpm_i2c",
Signature · 1 line
2.54.0
Le 03/06/2026 à 02:54, Rosen Penev a écrit :
Quoted 4 lines
Replace
irq_of_parse_and_map()withplatform_get_irq()as recommended for device-managed IRQ lookup. Properly propagate any errors returned fromplatform_get_irq().irq_of_parse_and_map()requiresire_dispose_mapping(), which is missing.
irq_of_parse_and_map() and platform_get_irq() look pretty different, can you give more details on how one can replace the other ? (I don't mean this is wrong, just I don't have enough details).
Quoted 24 lines
Assisted-by opencode:big-pickleSigned-off-by Rosen Penev <[email protected]>--- drivers/i2c/busses/i2c-cpm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/i2c/busses/i2c-cpm.c +3
-3@@ -434,9 +434,9 @@ static int cpm_i2c_setup(struct cpm_i2c *cpm)init_waitqueue_head (&cpm->i2c_wait); - cpm->irq =irq_of_parse_and_map (ofdev->dev.of_node,0 ); -if (!cpm->irq) -return -EINVAL ; + cpm->irq =platform_get_irq (ofdev,0 ); +if (cpm->irq <0 ) +return cpm->irq;/* Install interrupt handler. */ ret = request_irq(cpm->irq, cpm_i2c_interrupt, 0, "cpm_i2c",
Quoted 4 lines · Christophe Leroy (CS GROUP)
Le 03/06/2026 à 02:54, Rosen Penev a écrit :
Quoted 8 lines
Quoted 4 lines
Replace
irq_of_parse_and_map()withplatform_get_irq()as recommended for device-managed IRQ lookup. Properly propagate any errors returned fromplatform_get_irq().irq_of_parse_and_map()requiresire_dispose_mapping(), which is missing.
irq_of_parse_and_map()andplatform_get_irq()look pretty different, can you give more details on how one can replace the other ? (I don't mean this is wrong, just I don't have enough details).
My understanding is the latter is higher level and doesn't require mapping. Just a request from the platform_device machinery for an irq that it already mapped.
It also supports -EPROBE_DEFER. Probably not relevant here but could be some day.
Quoted 26 lines
Quoted 25 lines
Assisted-by opencode:big-pickleSigned-off-by Rosen Penev <[email protected]>--- drivers/i2c/busses/i2c-cpm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/i2c/busses/i2c-cpm.c +3
-3@@ -434,9 +434,9 @@ static int cpm_i2c_setup(struct cpm_i2c *cpm)init_waitqueue_head (&cpm->i2c_wait); - cpm->irq =irq_of_parse_and_map (ofdev->dev.of_node,0 ); -if (!cpm->irq) -return -EINVAL ; + cpm->irq =platform_get_irq (ofdev,0 ); +if (cpm->irq <0 ) +return cpm->irq;/* Install interrupt handler. */ ret = request_irq(cpm->irq, cpm_i2c_interrupt, 0, "cpm_i2c",