diff mbox series

[RFC,2/2] i2c: rcar: support named interrupts

Message ID 20240826150840.25497-6-wsa+renesas@sang-engineering.com (mailing list archive)
State RFC
Delegated to: Geert Uytterhoeven
Headers show
Series i2c: rcar: add SMBAlert support | expand

Commit Message

Wolfram Sang Aug. 26, 2024, 3:08 p.m. UTC
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-rcar.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Wolfram Sang Aug. 26, 2024, 3:09 p.m. UTC | #1
On Mon, Aug 26, 2024 at 05:08:43PM +0200, Wolfram Sang wrote:
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  drivers/i2c/busses/i2c-rcar.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> index 1104aafe4433..1a232bc88bed 100644
> --- a/drivers/i2c/busses/i2c-rcar.c
> +++ b/drivers/i2c/busses/i2c-rcar.c
> @@ -1192,10 +1192,13 @@ static int rcar_i2c_probe(struct platform_device *pdev)
>  			goto out_pm_put;
>  	}
>  
> -	ret = platform_get_irq(pdev, 0);
> -	if (ret < 0)
> -		goto out_pm_put;
> -	priv->irq = ret;
> +	priv->irq = platform_get_irq_byname_optional(pdev, "main");
> +	if (priv->irq < 0) {
> +		priv->irq = platform_get_irq(pdev, 0);
> +		if (priv->irq < 0)
> +			goto out_pm_put;

'ret' should be set here, of course! Will fix when resending this
series.

> +	}
> +
>  	ret = devm_request_irq(dev, priv->irq, irqhandler, irqflags, dev_name(dev), priv);
>  	if (ret < 0) {
>  		dev_err(dev, "cannot get irq %d\n", priv->irq);
> -- 
> 2.43.0
>
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 1104aafe4433..1a232bc88bed 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -1192,10 +1192,13 @@  static int rcar_i2c_probe(struct platform_device *pdev)
 			goto out_pm_put;
 	}
 
-	ret = platform_get_irq(pdev, 0);
-	if (ret < 0)
-		goto out_pm_put;
-	priv->irq = ret;
+	priv->irq = platform_get_irq_byname_optional(pdev, "main");
+	if (priv->irq < 0) {
+		priv->irq = platform_get_irq(pdev, 0);
+		if (priv->irq < 0)
+			goto out_pm_put;
+	}
+
 	ret = devm_request_irq(dev, priv->irq, irqhandler, irqflags, dev_name(dev), priv);
 	if (ret < 0) {
 		dev_err(dev, "cannot get irq %d\n", priv->irq);