Skip to contentSkip to conversation

irqchip/ti-sci: Simplify with dev_err_probe()

PATCH Applied Krzysztof Kozlowski 3 participants 5 messages Sep 2, 2020 – Oct 11, 2020

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

PATCH 1/2 irqchip/ti-sci: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed.

There is also no need to assign NULL to 'intr->sci' as it is part of devm-allocated memory.

---
 drivers/irqchip/irq-ti-sci-inta.c | 10 +++-------
 drivers/irqchip/irq-ti-sci-intr.c | 10 +++-------
 2 files changed, 6 insertions(+), 14 deletions(-)
drivers/irqchip/irq-ti-sci-inta.c +3 -7
index d4e97605456b..bc863ef7998d 100644
@@ -600,13 +600,9 @@ static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev)
 
 	inta->pdev = pdev;
 	inta->sci = devm_ti_sci_get_by_phandle(dev, "ti,sci");
-	if (IS_ERR(inta->sci)) {
-		ret = PTR_ERR(inta->sci);
-		if (ret != -EPROBE_DEFER)
-			dev_err(dev, "ti,sci read fail %d\n", ret);
-		inta->sci = NULL;
-		return ret;
-	}
+	if (IS_ERR(inta->sci))
+		return dev_err_probe(dev, PTR_ERR(inta->sci),
+				     "ti,sci read fail\n");
 
 	ret = of_property_read_u32(dev->of_node, "ti,sci-dev-id", &inta->ti_sci_id);
 	if (ret) {
drivers/irqchip/irq-ti-sci-intr.c +3 -7
index cbc1758228d9..6a6fb6616c21 100644
@@ -254,13 +254,9 @@ static int ti_sci_intr_irq_domain_probe(struct platform_device *pdev)
 	}
 
 	intr->sci = devm_ti_sci_get_by_phandle(dev, "ti,sci");
-	if (IS_ERR(intr->sci)) {
-		ret = PTR_ERR(intr->sci);
-		if (ret != -EPROBE_DEFER)
-			dev_err(dev, "ti,sci read fail %d\n", ret);
-		intr->sci = NULL;
-		return ret;
-	}
+	if (IS_ERR(intr->sci))
+		return dev_err_probe(dev, PTR_ERR(intr->sci),
+				     "ti,sci read fail\n");
 
 	ret = of_property_read_u32(dev_of_node(dev), "ti,sci-dev-id",
 				   &intr->ti_sci_id);
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 irqchip/ti-sci-inta: Fix kerneldoc

Fix kerneldoc W=1 warnings:

drivers/irqchip/irq-ti-sci-inta.c:144: warning: Function parameter or member 'vint_id' not described in 'ti_sci_inta_xlate_irq' drivers/irqchip/irq-ti-sci-inta.c:144: warning: Excess function parameter 'irq' description in 'ti_sci_inta_xlate_irq'

---
 drivers/irqchip/irq-ti-sci-inta.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-ti-sci-inta.c +1 -1
index bc863ef7998d..84929f3e2003 100644
@@ -134,7 +134,7 @@ static void ti_sci_inta_irq_handler(struct irq_desc *desc)
 /**
  * ti_sci_inta_xlate_irq() - Translate hwirq to parent's hwirq.
  * @inta:	IRQ domain corresponding to Interrupt Aggregator
- * @irq:	Hardware irq corresponding to the above irq domain
+ * @vint_id:	TISCI vint ID
  *
  * Return parent irq number if translation is available else -ENOENT.
  */
Signature · 1 line
2.17.1
maintainer
#2 lore raw

Re: [PATCH 2/2] irqchip/ti-sci-inta: Fix kerneldoc

Quoted 16 lines · Krzysztof Kozlowski

Fix kerneldoc W=1 warnings:

drivers/irqchip/irq-ti-sci-inta.c:144: warning: Function parameter or member 'vint_id' not described in 'ti_sci_inta_xlate_irq' drivers/irqchip/irq-ti-sci-inta.c:144: warning: Excess function parameter 'irq' description in 'ti_sci_inta_xlate_irq'

---
 drivers/irqchip/irq-ti-sci-inta.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-ti-sci-inta.c +0 -0
index bc863ef7998d..84929f3e2003 100644

drivers/irqchip/irq-ti-sci-inta.c static void ti_sci_inta_irq_handler(struct irq_desc *desc) · line 137

Quoted 5 lines
drivers/irqchip/irq-ti-sci-inta.c +1 -1
@@ -134,7 +134,7 @@ static void ti_sci_inta_irq_handler(struct irq_desc *desc)
 /**
  * ti_sci_inta_xlate_irq() - Translate hwirq to parent's hwirq.
  * @inta:	IRQ domain corresponding to Interrupt Aggregator
- * @irq:	Hardware irq corresponding to the above irq domain
+ * @vint_id:	TISCI vint ID

I'm not sure that replacing a flaky variable name with something that is essentially unintelligible is a huge improvement.

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
maintainer Applied
#3 lore raw
In reply to Krzysztof Kozlowski
Quoted 5 lines · Krzysztof Kozlowski

Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed.

There is also no need to assign NULL to 'intr->sci' as it is part of devm-allocated memory.

Applied to irq/irqchip-next, thanks!

[1/2] irqchip/ti-sci: Simplify with dev_err_probe()

      commit: ea6c25e6057c0b7c18337696be84b8f9751f19ec

Patch #2 didn't make a lot of sense, so not applied.

Cheers,

	M.
Signature · 7 lines
Without deviation from the norm, progress is not possible.


_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
#4 lore raw
In reply to Krzysztof Kozlowski
The following commit has been merged into the irq/core branch of tip:

The following commit has been merged into the irq/core branch of tip:

Commit-ID:     ea6c25e6057c0b7c18337696be84b8f9751f19ec
Gitweb:        https://git.kernel.org/tip/ea6c25e6057c0b7c18337696be84b8f9751f19ec
Author:        Krzysztof Kozlowski <[email protected]>
AuthorDate:    Wed, 02 Sep 2020 19:46:14 +02:00
Committer:     Marc Zyngier <[email protected]>
CommitterDate: Sun, 13 Sep 2020 17:38:37 +01:00

irqchip/ti-sci: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed.

There is also no need to assign NULL to 'intr->sci' as it is part of devm-allocated memory.

---
 drivers/irqchip/irq-ti-sci-inta.c | 10 +++-------
 drivers/irqchip/irq-ti-sci-intr.c | 10 +++-------
 2 files changed, 6 insertions(+), 14 deletions(-)
drivers/irqchip/irq-ti-sci-inta.c +3 -7
index d4e9760..bc863ef 100644
@@ -600,13 +600,9 @@ static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev)
 
 	inta->pdev = pdev;
 	inta->sci = devm_ti_sci_get_by_phandle(dev, "ti,sci");
-	if (IS_ERR(inta->sci)) {
-		ret = PTR_ERR(inta->sci);
-		if (ret != -EPROBE_DEFER)
-			dev_err(dev, "ti,sci read fail %d\n", ret);
-		inta->sci = NULL;
-		return ret;
-	}
+	if (IS_ERR(inta->sci))
+		return dev_err_probe(dev, PTR_ERR(inta->sci),
+				     "ti,sci read fail\n");
 
 	ret = of_property_read_u32(dev->of_node, "ti,sci-dev-id", &inta->ti_sci_id);
 	if (ret) {
drivers/irqchip/irq-ti-sci-intr.c +3 -7
index cbc1758..6a6fb66 100644
@@ -254,13 +254,9 @@ static int ti_sci_intr_irq_domain_probe(struct platform_device *pdev)
 	}
 
 	intr->sci = devm_ti_sci_get_by_phandle(dev, "ti,sci");
-	if (IS_ERR(intr->sci)) {
-		ret = PTR_ERR(intr->sci);
-		if (ret != -EPROBE_DEFER)
-			dev_err(dev, "ti,sci read fail %d\n", ret);
-		intr->sci = NULL;
-		return ret;
-	}
+	if (IS_ERR(intr->sci))
+		return dev_err_probe(dev, PTR_ERR(intr->sci),
+				     "ti,sci read fail\n");
 
 	ret = of_property_read_u32(dev_of_node(dev), "ti,sci-dev-id",
 				   &intr->ti_sci_id);