Skip to contentSkip to conversation

i3c: master: dw-i3c: Fix missing reset assertion in remove() callback

PATCH Applied Felix Gu 3 participants 3 messages Mar 20 – Apr 12

Subsystems (2)
lore
Share & tools
lore

Felix Gu

author
#0 lore raw

PATCH v3 1/1 i3c: master: dw-i3c: Fix missing reset assertion in remove() callback

The reset line acquired during probe is currently left deasserted when the driver is unbound.

Switch to devm_reset_control_get_optional_exclusive_deasserted() to ensure the reset is automatically re-asserted by the devres core when the driver is removed.

Fixes 62fe9d06f570 ("i3c: dw: Add power management support")

---
Changes in v3:
- Fix the format to pass checkpatch --strict.
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Switch to devm_reset_control_get_optional_exclusive_deasserted() suggested by Philipp Zabel.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 drivers/i3c/master/dw-i3c-master.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/i3c/master/dw-i3c-master.c +3 -8
index d87bde3f7700..d104807cf74e 100644
@@ -1606,13 +1606,11 @@ int dw_i3c_common_probe(struct dw_i3c_master *master,
 	if (IS_ERR(master->pclk))
 		return PTR_ERR(master->pclk);
 
-	master->core_rst = devm_reset_control_get_optional_exclusive(&pdev->dev,
-								    "core_rst");
+	master->core_rst = devm_reset_control_get_optional_exclusive_deasserted(&pdev->dev,
+										"core_rst");
 	if (IS_ERR(master->core_rst))
 		return PTR_ERR(master->core_rst);
 
-	reset_control_deassert(master->core_rst);
-
 	spin_lock_init(&master->xferqueue.lock);
 	INIT_LIST_HEAD(&master->xferqueue.list);
 
@@ -1624,7 +1622,7 @@ int dw_i3c_common_probe(struct dw_i3c_master *master,
 			       dw_i3c_master_irq_handler, 0,
 			       dev_name(&pdev->dev), master);
 	if (ret)
-		goto err_assert_rst;
+		return ret;
 
 	platform_set_drvdata(pdev, master);
 
@@ -1671,9 +1669,6 @@ int dw_i3c_common_probe(struct dw_i3c_master *master,
 	pm_runtime_set_suspended(&pdev->dev);
 	pm_runtime_dont_use_autosuspend(&pdev->dev);
 
-err_assert_rst:
-	reset_control_assert(master->core_rst);
-
 	return ret;
 }
 EXPORT_SYMBOL_GPL(dw_i3c_common_probe);

---
base-commit: b84a0ebe421ca56995ff78b66307667b62b3a900
change-id: 20260316-dw-i3c-e7a36bc90682

Best regards,

Signature · 1 line
Felix Gu <[email protected]>
reviewer Reviewed-by on v3 1/1
#1 lore raw
Quoted 11 lines · Felix Gu

The reset line acquired during probe is currently left deasserted when the driver is unbound.

Switch to devm_reset_control_get_optional_exclusive_deasserted() to ensure the reset is automatically re-asserted by the devres core when the driver is removed.

Fixes 62fe9d06f570 ("i3c: dw: Add power management support")

---

Quoted 60 lines

Changes in v3:
- Fix the format to pass checkpatch --strict.
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Switch to devm_reset_control_get_optional_exclusive_deasserted() suggested by Philipp Zabel.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 drivers/i3c/master/dw-i3c-master.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/i3c/master/dw-i3c-master.c +3 -9
index d87bde3f7700..d104807cf74e 100644
@@ -1606,13 +1606,11 @@ int dw_i3c_common_probe(struct dw_i3c_master *master,
 	if (IS_ERR(master->pclk))
 		return PTR_ERR(master->pclk);
 
-	master->core_rst = devm_reset_control_get_optional_exclusive(&pdev->dev,
-								    "core_rst");
+	master->core_rst = devm_reset_control_get_optional_exclusive_deasserted(&pdev->dev,
+										"core_rst");
 	if (IS_ERR(master->core_rst))
 		return PTR_ERR(master->core_rst);
 
-	reset_control_deassert(master->core_rst);
-
 	spin_lock_init(&master->xferqueue.lock);
 	INIT_LIST_HEAD(&master->xferqueue.list);
 
@@ -1624,7 +1622,7 @@ int dw_i3c_common_probe(struct dw_i3c_master *master,
 			       dw_i3c_master_irq_handler, 0,
 			       dev_name(&pdev->dev), master);
 	if (ret)
-		goto err_assert_rst;
+		return ret;
 
 	platform_set_drvdata(pdev, master);
 
@@ -1671,9 +1669,6 @@ int dw_i3c_common_probe(struct dw_i3c_master *master,
 	pm_runtime_set_suspended(&pdev->dev);
 	pm_runtime_dont_use_autosuspend(&pdev->dev);
 
-err_assert_rst:
-	reset_control_assert(master->core_rst);
-
 	return ret;
 }
 EXPORT_SYMBOL_GPL(dw_i3c_common_probe);
 
---

base-commit: b84a0ebe421ca56995ff78b66307667b62b3a900
change-id: 20260316-dw-i3c-e7a36bc90682

Best regards,
--
Felix Gu <[email protected]>

maintainer Applied
#2 lore raw
In reply to Felix Gu
Quoted 8 lines · Felix Gu

The reset line acquired during probe is currently left deasserted when the driver is unbound.

Switch to devm_reset_control_get_optional_exclusive_deasserted() to ensure the reset is automatically re-asserted by the devres core when the driver is removed.

[...]

Applied, thanks!

[1/1] i3c: master: dw-i3c: Fix missing reset assertion in remove() callback

      https://git.kernel.org/i3c/c/bef1eef66718

Best regards,

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com