Skip to contentSkip to conversation

driver core: platform: Introduce platform_get_irq_optional()

PATCH In review Thierry Reding 7 participants 14 messages Aug 28, 2019 – Oct 9, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 driver core: platform: Introduce platform_get_irq_optional()

From: Thierry Reding <[email protected]>

In some cases the interrupt line of a device is optional. Introduce a new platform_get_irq_optional() that works much like platform_get_irq() but does not output an error on failure to find the interrupt.

---
 drivers/base/platform.c         | 22 ++++++++++++++++++++++
 include/linux/platform_device.h |  1 +
 2 files changed, 23 insertions(+)
drivers/base/platform.c +22 -0
index 8ad701068c11..0dda6ade50fd 100644
@@ -192,6 +192,28 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)
 }
 EXPORT_SYMBOL_GPL(platform_get_irq);
 
+/**
+ * platform_get_irq_optional - get an optional IRQ for a device
+ * @dev: platform device
+ * @num: IRQ number index
+ *
+ * Gets an IRQ for a platform device. Device drivers should check the return
+ * value for errors so as to not pass a negative integer value to the
+ * request_irq() APIs. This is the same as platform_get_irq(), except that it
+ * does not print an error message if an IRQ can not be obtained.
+ *
+ * Example:
+ *		int irq = platform_get_irq_optional(pdev, 0);
+ *		if (irq < 0)
+ *			return irq;
+ *
+ * Return: IRQ number on success, negative error number on failure.
+ */
+int platform_get_irq_optional(struct platform_device *dev, unsigned int num)
+{
+	return __platform_get_irq(dev, num);
+}
+
 /**
  * platform_irq_count - Count the number of IRQs a platform device uses
  * @dev: platform device
include/linux/platform_device.h +1 -0
index 37e15a935a42..35bc4355a9df 100644
@@ -58,6 +58,7 @@ extern void __iomem *
 devm_platform_ioremap_resource(struct platform_device *pdev,
 			       unsigned int index);
 extern int platform_get_irq(struct platform_device *, unsigned int);
+extern int platform_get_irq_optional(struct platform_device *, unsigned int);
 extern int platform_irq_count(struct platform_device *);
 extern struct resource *platform_get_resource_byname(struct platform_device *,
 						     unsigned int,
Signature · 1 line
2.22.0
#1 lore raw

PATCH 2/2 hwmon: pwm-fan: Use platform_get_irq_optional()

From: Thierry Reding <[email protected]>

The PWM fan interrupt is optional, so we don't want an error message in the kernel log if it wasn't specified.

---
 drivers/hwmon/pwm-fan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/pwm-fan.c +1 -1
index 54c0ff00d67f..42ffd2e5182d 100644
@@ -304,7 +304,7 @@ static int pwm_fan_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, ctx);
 
-	ctx->irq = platform_get_irq(pdev, 0);
+	ctx->irq = platform_get_irq_optional(pdev, 0);
 	if (ctx->irq == -EPROBE_DEFER)
 		return ctx->irq;
 
Signature · 1 line
2.22.0
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] hwmon: pwm-fan: Use platform_get_irq_optional()

Quoted 6 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The PWM fan interrupt is optional, so we don't want an error message in the kernel log if it wasn't specified.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

Quoted 17 lines
---
 drivers/hwmon/pwm-fan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/pwm-fan.c +1 -1
index 54c0ff00d67f..42ffd2e5182d 100644
@@ -304,7 +304,7 @@ static int pwm_fan_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, ctx);
 
-	ctx->irq = platform_get_irq(pdev, 0);
+	ctx->irq = platform_get_irq_optional(pdev, 0);
 	if (ctx->irq == -EPROBE_DEFER)
 		return ctx->irq;
 
maintainer Acked-by on v1 2/2
#3 lore raw

Re: [PATCH 2/2] hwmon: pwm-fan: Use platform_get_irq_optional()

In reply to Thierry Reding
Quoted 6 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The PWM fan interrupt is optional, so we don't want an error message in the kernel log if it wasn't specified.

I assume that Greg will pick up this patch.

Guenter

Quoted 20 lines
---
 drivers/hwmon/pwm-fan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/pwm-fan.c +1 -1
index 54c0ff00d67f..42ffd2e5182d 100644
@@ -304,7 +304,7 @@ static int pwm_fan_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, ctx);
 
-	ctx->irq = platform_get_irq(pdev, 0);
+	ctx->irq = platform_get_irq_optional(pdev, 0);
 	if (ctx->irq == -EPROBE_DEFER)
 		return ctx->irq;
 
Signature · 1 line
2.22.0
#4 lore raw

Re: [PATCH 2/2] hwmon: pwm-fan: Use platform_get_irq_optional()

Quoted 11 lines · Guenter Roeck
Quoted 6 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The PWM fan interrupt is optional, so we don't want an error message in the kernel log if it wasn't specified.

I assume that Greg will pick up this patch.

Will do, thanks.

greg k-h

#6 lore raw
In reply to Thierry Reding
Quoted 19 lines · Thierry Reding

From: Thierry Reding <[email protected]>

In some cases the interrupt line of a device is optional. Introduce a new platform_get_irq_optional() that works much like platform_get_irq() but does not output an error on failure to find the interrupt.

---
 drivers/base/platform.c         | 22 ++++++++++++++++++++++
 include/linux/platform_device.h |  1 +
 2 files changed, 23 insertions(+)
drivers/base/platform.c +0 -0
index 8ad701068c11..0dda6ade50fd 100644
@@ -192,6 +192,28 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)
 }
 EXPORT_SYMBOL_GPL(platform_get_irq);

drivers/base/platform.c int platform_get_irq(struct platform_device *dev, unsigned int num) · line 203

Quoted 10 lines
drivers/base/platform.c +9 -0
 
+/**
+ * platform_get_irq_optional - get an optional IRQ for a device
+ * @dev: platform device
+ * @num: IRQ number index
+ *
+ * Gets an IRQ for a platform device. Device drivers should check the return
+ * value for errors so as to not pass a negative integer value to the
+ * request_irq() APIs. This is the same as platform_get_irq(), except that it
+ * does not print an error message if an IRQ can not be obtained.

Kind of funny that the work people did to put error messages in a central place needs to be worked around at times :)

Anyway, I have no objection to this, but it looks like it has to go in through my tree. I can take the hwmon patch as well through my tree if the hwmon maintainer(s) say it is ok to do so.

thanks,

greg k-h

#7 lore raw
Quoted 21 lines · Greg Kroah-Hartman
Quoted 20 lines · Thierry Reding

From: Thierry Reding <[email protected]>

In some cases the interrupt line of a device is optional. Introduce a new platform_get_irq_optional() that works much like platform_get_irq() but does not output an error on failure to find the interrupt.

---
 drivers/base/platform.c         | 22 ++++++++++++++++++++++
 include/linux/platform_device.h |  1 +
 2 files changed, 23 insertions(+)
drivers/base/platform.c +0 -0
index 8ad701068c11..0dda6ade50fd 100644
@@ -192,6 +192,28 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)
 }
 EXPORT_SYMBOL_GPL(platform_get_irq);
 
Quoted 12 lines

drivers/base/platform.c int platform_get_irq(struct platform_device *dev, unsigned int num) · line 203

Quoted 9 lines
drivers/base/platform.c +9 -0
+/**
+ * platform_get_irq_optional - get an optional IRQ for a device
+ * @dev: platform device
+ * @num: IRQ number index
+ *
+ * Gets an IRQ for a platform device. Device drivers should check the return
+ * value for errors so as to not pass a negative integer value to the
+ * request_irq() APIs. This is the same as platform_get_irq(), except that it
+ * does not print an error message if an IRQ can not be obtained.

Kind of funny that the work people did to put error messages in a central place needs to be worked around at times :)

Indeed. I think it does make sense in this case to have the error message in a central place, because it really does seem like the vast majority of users really do want that IRQ. Having the _optional variant makes it really explicit in the cases where it's fine to continue without the IRQ.

Quoted 3 lines

Anyway, I have no objection to this, but it looks like it has to go in through my tree. I can take the hwmon patch as well through my tree if the hwmon maintainer(s) say it is ok to do so.

I suppose we could technically make this go through the driver core and hwmon trees separately with a bit of timing, but the hwmon patch is so trivial that it would indeed be simplest to take it through the driver core tree as well.

Thierry

maintainer
#8 lore raw
In reply to Greg Kroah-Hartman
Quoted 34 lines · Greg Kroah-Hartman
Quoted 19 lines · Thierry Reding

From: Thierry Reding <[email protected]>

In some cases the interrupt line of a device is optional. Introduce a new platform_get_irq_optional() that works much like platform_get_irq() but does not output an error on failure to find the interrupt.

---
 drivers/base/platform.c         | 22 ++++++++++++++++++++++
 include/linux/platform_device.h |  1 +
 2 files changed, 23 insertions(+)
drivers/base/platform.c +0 -0
index 8ad701068c11..0dda6ade50fd 100644
@@ -192,6 +192,28 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)
 }
 EXPORT_SYMBOL_GPL(platform_get_irq);

drivers/base/platform.c int platform_get_irq(struct platform_device *dev, unsigned int num) · line 203

Quoted 10 lines
drivers/base/platform.c +9 -0
 
+/**
+ * platform_get_irq_optional - get an optional IRQ for a device
+ * @dev: platform device
+ * @num: IRQ number index
+ *
+ * Gets an IRQ for a platform device. Device drivers should check the return
+ * value for errors so as to not pass a negative integer value to the
+ * request_irq() APIs. This is the same as platform_get_irq(), except that it
+ * does not print an error message if an IRQ can not be obtained.

Kind of funny that the work people did to put error messages in a central place needs to be worked around at times :)

Quoted 4 lines

Anyway, I have no objection to this, but it looks like it has to go in through my tree. I can take the hwmon patch as well through my tree if the hwmon maintainer(s) say it is ok to do so.

Ok with me.

Guenter

Reviewed-by on v1 1/2
#9 lore raw
In reply to Thierry Reding

Quoting Thierry Reding (2019-08-28 01:34:10)

Quoted 8 lines

From: Thierry Reding <[email protected]>

In some cases the interrupt line of a device is optional. Introduce a new platform_get_irq_optional() that works much like platform_get_irq() but does not output an error on failure to find the interrupt.

---

Thanks!

#10 lore raw
In reply to Thierry Reding
Quoted 31 lines · Thierry Reding

From: Thierry Reding <[email protected]>

In some cases the interrupt line of a device is optional. Introduce a new platform_get_irq_optional() that works much like platform_get_irq() but does not output an error on failure to find the interrupt.

---
 drivers/base/platform.c         | 22 ++++++++++++++++++++++
 include/linux/platform_device.h |  1 +
 2 files changed, 23 insertions(+)
drivers/base/platform.c +11 -0
index 8ad701068c11..0dda6ade50fd 100644
@@ -192,6 +192,28 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)
 }
 EXPORT_SYMBOL_GPL(platform_get_irq);
 
+/**
+ * platform_get_irq_optional - get an optional IRQ for a device
+ * @dev: platform device
+ * @num: IRQ number index
+ *
+ * Gets an IRQ for a platform device. Device drivers should check the return
+ * value for errors so as to not pass a negative integer value to the
+ * request_irq() APIs. This is the same as platform_get_irq(), except that it
+ * does not print an error message if an IRQ can not be obtained.
+ *
+ * Example:

drivers/base/platform.c int platform_get_irq(struct platform_device *dev, unsigned int num) · line 215

Quoted 10 lines
drivers/base/platform.c +10 -0
+ *		int irq = platform_get_irq_optional(pdev, 0);
+ *		if (irq < 0)
+ *			return irq;
+ *
+ * Return: IRQ number on success, negative error number on failure.
+ */
+int platform_get_irq_optional(struct platform_device *dev, unsigned int num)
+{
+	return __platform_get_irq(dev, num);
+}

Oh my... this is embarrassing, but the kbuild test robot reported that the second patch here fails to build because I forgot to export this symbol. I've attached a patch that fixes it.

Thierry

Quoted 19 lines
drivers/base/platform.c +1 -0
+
 /**
  * platform_irq_count - Count the number of IRQs a platform device uses
  * @dev: platform device
include/linux/platform_device.h +1 -0
index 37e15a935a42..35bc4355a9df 100644
@@ -58,6 +58,7 @@ extern void __iomem *
 devm_platform_ioremap_resource(struct platform_device *pdev,
 			       unsigned int index);
 extern int platform_get_irq(struct platform_device *, unsigned int);
+extern int platform_get_irq_optional(struct platform_device *, unsigned int);
 extern int platform_irq_count(struct platform_device *);
 extern struct resource *platform_get_resource_byname(struct platform_device *,
 						     unsigned int,
Signature · 1 line
2.22.0

From 0f7695c4d3f30b2946c97160b717de03c3deb73f Mon Sep 17 00:00:00 2001
From: Thierry Reding <[email protected]>
Date: Thu, 29 Aug 2019 09:29:32 +0200
Subject: [PATCH] driver core: platform: Export platform_get_irq_optional()

This function can be used by modules, so it needs to be exported.

---
 drivers/base/platform.c | 1 +
 1 file changed, 1 insertion(+)
drivers/base/platform.c +1 -0
index 014dc07b0056..b6c6c7d97d5b 100644
@@ -194,6 +194,7 @@ int platform_get_irq_optional(struct platform_device *dev, unsigned int num)
 {
 	return __platform_get_irq(dev, num);
 }
+EXPORT_SYMBOL_GPL(platform_get_irq_optional);
 
 /**
  * platform_irq_count - Count the number of IRQs a platform device uses
Signature · 1 line
2.22.0
#11 lore raw
Quoted 97 lines · Thierry Reding
Quoted 31 lines · Thierry Reding

From: Thierry Reding <[email protected]>

In some cases the interrupt line of a device is optional. Introduce a new platform_get_irq_optional() that works much like platform_get_irq() but does not output an error on failure to find the interrupt.

---
 drivers/base/platform.c         | 22 ++++++++++++++++++++++
 include/linux/platform_device.h |  1 +
 2 files changed, 23 insertions(+)
drivers/base/platform.c +11 -0
index 8ad701068c11..0dda6ade50fd 100644
@@ -192,6 +192,28 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)
 }
 EXPORT_SYMBOL_GPL(platform_get_irq);
 
+/**
+ * platform_get_irq_optional - get an optional IRQ for a device
+ * @dev: platform device
+ * @num: IRQ number index
+ *
+ * Gets an IRQ for a platform device. Device drivers should check the return
+ * value for errors so as to not pass a negative integer value to the
+ * request_irq() APIs. This is the same as platform_get_irq(), except that it
+ * does not print an error message if an IRQ can not be obtained.
+ *
+ * Example:

drivers/base/platform.c int platform_get_irq(struct platform_device *dev, unsigned int num) · line 215

Quoted 10 lines
drivers/base/platform.c +10 -0
+ *		int irq = platform_get_irq_optional(pdev, 0);
+ *		if (irq < 0)
+ *			return irq;
+ *
+ * Return: IRQ number on success, negative error number on failure.
+ */
+int platform_get_irq_optional(struct platform_device *dev, unsigned int num)
+{
+	return __platform_get_irq(dev, num);
+}

Oh my... this is embarrassing, but the kbuild test robot reported that the second patch here fails to build because I forgot to export this symbol. I've attached a patch that fixes it.

Thierry

Quoted 19 lines
drivers/base/platform.c +1 -0
+
 /**
  * platform_irq_count - Count the number of IRQs a platform device uses
  * @dev: platform device
include/linux/platform_device.h +1 -0
index 37e15a935a42..35bc4355a9df 100644
@@ -58,6 +58,7 @@ extern void __iomem *
 devm_platform_ioremap_resource(struct platform_device *pdev,
 			       unsigned int index);
 extern int platform_get_irq(struct platform_device *, unsigned int);
+extern int platform_get_irq_optional(struct platform_device *, unsigned int);
 extern int platform_irq_count(struct platform_device *);
 extern struct resource *platform_get_resource_byname(struct platform_device *,
 						     unsigned int,
Signature · 1 line
2.22.0

From 0f7695c4d3f30b2946c97160b717de03c3deb73f Mon Sep 17 00:00:00 2001
From: Thierry Reding <[email protected]>
Date: Thu, 29 Aug 2019 09:29:32 +0200
Subject: [PATCH] driver core: platform: Export platform_get_irq_optional()

This function can be used by modules, so it needs to be exported.

---
 drivers/base/platform.c | 1 +
 1 file changed, 1 insertion(+)
drivers/base/platform.c +1 -0
index 014dc07b0056..b6c6c7d97d5b 100644
@@ -194,6 +194,7 @@ int platform_get_irq_optional(struct platform_device *dev, unsigned int num)
 {
 	return __platform_get_irq(dev, num);
 }
+EXPORT_SYMBOL_GPL(platform_get_irq_optional);
 
 /**
  * platform_irq_count - Count the number of IRQs a platform device uses
Signature · 1 line
2.22.0

Now merged, thanks.

greg k-h

#12 lore raw

PATCH 1/1 driver core: simplify definitions of platform_get_irq*

In reply to Thierry Reding

platform_get_irq_optional is just a wrapper for __platform_get_irq. So rename __platform_get_irq to platform_get_irq_optional and drop platform_get_irq_optional's previous implementation. This way there is one function and one indirection less without loss of functionality.

---
 drivers/base/platform.c | 47 ++++++++++++++++++-----------------------
 1 file changed, 21 insertions(+), 26 deletions(-)
drivers/base/platform.c +21 -26
index b6c6c7d97d5b..60ff536b46f1 100644
@@ -80,7 +80,24 @@ void __iomem *devm_platform_ioremap_resource(struct platform_device *pdev,
 EXPORT_SYMBOL_GPL(devm_platform_ioremap_resource);
 #endif /* CONFIG_HAS_IOMEM */
 
-static int __platform_get_irq(struct platform_device *dev, unsigned int num)
+/**
+ * platform_get_irq_optional - get an optional IRQ for a device
+ * @dev: platform device
+ * @num: IRQ number index
+ *
+ * Gets an IRQ for a platform device. Device drivers should check the return
+ * value for errors so as to not pass a negative integer value to the
+ * request_irq() APIs. This is the same as platform_get_irq(), except that it
+ * does not print an error message if an IRQ can not be obtained.
+ *
+ * Example:
+ *		int irq = platform_get_irq_optional(pdev, 0);
+ *		if (irq < 0)
+ *			return irq;
+ *
+ * Return: IRQ number on success, negative error number on failure.
+ */
+int platform_get_irq_optional(struct platform_device *dev, unsigned int num)
 {
 #ifdef CONFIG_SPARC
 	/* sparc does not have irqs represented as IORESOURCE_IRQ resources */
@@ -144,6 +161,7 @@ static int __platform_get_irq(struct platform_device *dev, unsigned int num)
 	return -ENXIO;
 #endif
 }
+EXPORT_SYMBOL_GPL(platform_get_irq_optional);
 
 /**
  * platform_get_irq - get an IRQ for a device
@@ -165,7 +183,7 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)
 {
 	int ret;
 
-	ret = __platform_get_irq(dev, num);
+	ret = platform_get_irq_optional(dev, num);
 	if (ret < 0 && ret != -EPROBE_DEFER)
 		dev_err(&dev->dev, "IRQ index %u not found\n", num);
 
@@ -173,29 +191,6 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)
 }
 EXPORT_SYMBOL_GPL(platform_get_irq);
 
-/**
- * platform_get_irq_optional - get an optional IRQ for a device
- * @dev: platform device
- * @num: IRQ number index
- *
- * Gets an IRQ for a platform device. Device drivers should check the return
- * value for errors so as to not pass a negative integer value to the
- * request_irq() APIs. This is the same as platform_get_irq(), except that it
- * does not print an error message if an IRQ can not be obtained.
- *
- * Example:
- *		int irq = platform_get_irq_optional(pdev, 0);
- *		if (irq < 0)
- *			return irq;
- *
- * Return: IRQ number on success, negative error number on failure.
- */
-int platform_get_irq_optional(struct platform_device *dev, unsigned int num)
-{
-	return __platform_get_irq(dev, num);
-}
-EXPORT_SYMBOL_GPL(platform_get_irq_optional);
-
 /**
  * platform_irq_count - Count the number of IRQs a platform device uses
  * @dev: platform device
@@ -206,7 +201,7 @@ int platform_irq_count(struct platform_device *dev)
 {
 	int ret, nr = 0;
 
-	while ((ret = __platform_get_irq(dev, nr)) >= 0)
+	while ((ret = platform_get_irq_optional(dev, nr)) >= 0)
 		nr++;
 
 	if (ret == -EPROBE_DEFER)
Signature · 1 line
2.23.0
maintainer Reviewed-by on v1 1/1
#13 lore raw

Re: [PATCH] driver core: simplify definitions of platform_get_irq*

Quoted 7 lines · Uwe Kleine-König

platform_get_irq_optional is just a wrapper for __platform_get_irq. So rename __platform_get_irq to platform_get_irq_optional and drop platform_get_irq_optional's previous implementation. This way there is one function and one indirection less without loss of functionality.

Makes sense to me:

Quoted 93 lines
---
 drivers/base/platform.c | 47 ++++++++++++++++++-----------------------
 1 file changed, 21 insertions(+), 26 deletions(-)
drivers/base/platform.c +21 -27
index b6c6c7d97d5b..60ff536b46f1 100644
@@ -80,7 +80,24 @@ void __iomem *devm_platform_ioremap_resource(struct platform_device *pdev,
 EXPORT_SYMBOL_GPL(devm_platform_ioremap_resource);
 #endif /* CONFIG_HAS_IOMEM */
 
-static int __platform_get_irq(struct platform_device *dev, unsigned int num)
+/**
+ * platform_get_irq_optional - get an optional IRQ for a device
+ * @dev: platform device
+ * @num: IRQ number index
+ *
+ * Gets an IRQ for a platform device. Device drivers should check the return
+ * value for errors so as to not pass a negative integer value to the
+ * request_irq() APIs. This is the same as platform_get_irq(), except that it
+ * does not print an error message if an IRQ can not be obtained.
+ *
+ * Example:
+ *             int irq = platform_get_irq_optional(pdev, 0);
+ *             if (irq < 0)
+ *                     return irq;
+ *
+ * Return: IRQ number on success, negative error number on failure.
+ */
+int platform_get_irq_optional(struct platform_device *dev, unsigned int num)
 {
 #ifdef CONFIG_SPARC
        /* sparc does not have irqs represented as IORESOURCE_IRQ resources */
@@ -144,6 +161,7 @@ static int __platform_get_irq(struct platform_device *dev, unsigned int num)
        return -ENXIO;
 #endif
 }
+EXPORT_SYMBOL_GPL(platform_get_irq_optional);
 
 /**
  * platform_get_irq - get an IRQ for a device
@@ -165,7 +183,7 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)
 {
        int ret;
 
-       ret = __platform_get_irq(dev, num);
+       ret = platform_get_irq_optional(dev, num);
        if (ret < 0 && ret != -EPROBE_DEFER)
                dev_err(&dev->dev, "IRQ index %u not found\n", num);
 
@@ -173,29 +191,6 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)
 }
 EXPORT_SYMBOL_GPL(platform_get_irq);
 
-/**
- * platform_get_irq_optional - get an optional IRQ for a device
- * @dev: platform device
- * @num: IRQ number index
- *
- * Gets an IRQ for a platform device. Device drivers should check the return
- * value for errors so as to not pass a negative integer value to the
- * request_irq() APIs. This is the same as platform_get_irq(), except that it
- * does not print an error message if an IRQ can not be obtained.
- *
- * Example:
- *             int irq = platform_get_irq_optional(pdev, 0);
- *             if (irq < 0)
- *                     return irq;
- *
- * Return: IRQ number on success, negative error number on failure.
- */
-int platform_get_irq_optional(struct platform_device *dev, unsigned int num)
-{
-       return __platform_get_irq(dev, num);
-}
-EXPORT_SYMBOL_GPL(platform_get_irq_optional);
-
 /**
  * platform_irq_count - Count the number of IRQs a platform device uses
  * @dev: platform device
@@ -206,7 +201,7 @@ int platform_irq_count(struct platform_device *dev)
 {
        int ret, nr = 0;
 
-       while ((ret = __platform_get_irq(dev, nr)) >= 0)
+       while ((ret = platform_get_irq_optional(dev, nr)) >= 0)
                nr++;
 
        if (ret == -EPROBE_DEFER)
--

2.23.0