Skip to contentSkip to conversation

driver core: platform: Make use of the helper function dev_err_probe()

PATCH Superseded Cai Huoqing 2 participants 2 messages Nov 5, 2021 Driver core

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 driver core: platform: Make use of the helper function dev_err_probe()

When possible using dev_err_probe() helps to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file.
BTW rename 'dev' to 'pdev'.

---
 drivers/base/platform.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/base/platform.c +5 -4
index 598acf93a360..5befd3258677 100644
@@ -253,13 +253,14 @@ EXPORT_SYMBOL_GPL(platform_get_irq_optional);
  *
  * Return: non-zero IRQ number on success, negative error number on failure.
  */
-int platform_get_irq(struct platform_device *dev, unsigned int num)
+int platform_get_irq(struct platform_device *pdev, unsigned int num)
 {
 	int ret;
 
-	ret = platform_get_irq_optional(dev, num);
-	if (ret < 0 && ret != -EPROBE_DEFER)
-		dev_err(&dev->dev, "IRQ index %u not found\n", num);
+	ret = platform_get_irq_optional(pdev, num);
+	if (ret < 0)
+		return dev_err_probe(&pdev->dev, ret,
+				     "IRQ index %u not found\n", num);
 
 	return ret;
 }
Signature · 1 line
2.25.1
#1 lore raw
Quoted 4 lines · Cai Huoqing

When possible using dev_err_probe() helps to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file.
BTW rename 'dev' to 'pdev'.

"BTW"???

Quoted 10 lines
---
 drivers/base/platform.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/base/platform.c +0 -0
index 598acf93a360..5befd3258677 100644

drivers/base/platform.c EXPORT_SYMBOL_GPL(platform_get_irq_optional); · line 256

Quoted 5 lines
drivers/base/platform.c +1 -1
@@ -253,13 +253,14 @@ EXPORT_SYMBOL_GPL(platform_get_irq_optional);
  *
  * Return: non-zero IRQ number on success, negative error number on failure.
  */
-int platform_get_irq(struct platform_device *dev, unsigned int num)
+int platform_get_irq(struct platform_device *pdev, unsigned int num)

Why change the variable name? It has nothing to do with this change, please do not do that.

thanks,

greg k-h