Skip to contentSkip to conversation

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

PATCH Superseded Felix Gu 2 participants 2 messages Mar 16 – Mar 20

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Felix Gu

author
#0 lore raw

PATCH v2 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 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..f3dabd8d1225 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]>
Reviewed-by on v2 1/1
#1 lore raw
Quoted 23 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")

---
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 +0 -0
index d87bde3f7700..f3dabd8d1225 100644

drivers/i3c/master/dw-i3c-master.c int dw_i3c_common_probe(struct dw_i3c_master *master, · line 1610

Quoted 7 lines
drivers/i3c/master/dw-i3c-master.c +2 -2
@@ -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");

+ master->core_rst = devm_reset_control_get_optional_exclusive_deasserted(&pdev->dev,
+ "core_rst");

to make checkpatch --strict happy. Otherwise,

regards
Philipp

Signature · 3 lines
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c