Skip to contentSkip to conversation

can: m_can: remove redundant check for pm_clock_support

PATCH In review Francesco Dolcini 3 participants 4 messages Jan 4, 2024 – Feb 16, 2024

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

PATCH 1/1 can: m_can: remove redundant check for pm_clock_support

From: Francesco Dolcini <[email protected]>

m_can_clk_start() already skip starting the clock when clock support is disabled, remove the redundant check in m_can_class_register().

This also solves the imbalance with m_can_clk_stop() that is called afterward in the same function before the return.

---
I spotted the issue while debugging some other part of the code, the patch is only compile-tested.

---
 drivers/net/can/m_can/m_can.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/can/m_can/m_can.c +3 -5
index 16ecc11c7f62..bd1d1626684d 100644
@@ -2056,11 +2056,9 @@ int m_can_class_register(struct m_can_classdev *cdev)
 {
 	int ret;
 
-	if (cdev->pm_clock_support) {
-		ret = m_can_clk_start(cdev);
-		if (ret)
-			return ret;
-	}
+	ret = m_can_clk_start(cdev);
+	if (ret)
+		return ret;
 
 	if (cdev->is_peripheral) {
 		ret = can_rx_offload_add_manual(cdev->net, &cdev->offload,
Signature · 1 line
2.39.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Francesco Dolcini

From: Francesco Dolcini <[email protected]>

m_can_clk_start() already skip starting the clock when clock support is disabled, remove the redundant check in m_can_class_register().

This also solves the imbalance with m_can_clk_stop() that is called afterward in the same function before the return.

Best,
Markus

Quoted 29 lines

---
I spotted the issue while debugging some other part of the code, the patch is only compile-tested.

---
 drivers/net/can/m_can/m_can.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/can/m_can/m_can.c +3 -5
index 16ecc11c7f62..bd1d1626684d 100644
@@ -2056,11 +2056,9 @@ int m_can_class_register(struct m_can_classdev *cdev)
 {
 	int ret;
 
-	if (cdev->pm_clock_support) {
-		ret = m_can_clk_start(cdev);
-		if (ret)
-			return ret;
-	}
+	ret = m_can_clk_start(cdev);
+	if (ret)
+		return ret;
 
 	if (cdev->is_peripheral) {
 		ret = can_rx_offload_add_manual(cdev->net, &cdev->offload,
Signature · 1 line
2.39.2
#2 lore raw
In reply to Francesco Dolcini

Hello Marc and Vincent,

Quoted 10 lines · Francesco Dolcini

From: Francesco Dolcini <[email protected]>

m_can_clk_start() already skip starting the clock when clock support is disabled, remove the redundant check in m_can_class_register().

This also solves the imbalance with m_can_clk_stop() that is called afterward in the same function before the return.

Did you missed this? Or do you have some concern with it?

Francesco

#3 lore raw
Quoted 9 lines · Francesco Dolcini

Hello Marc and Vincent,

Quoted 6 lines · Francesco Dolcini

From: Francesco Dolcini <[email protected]>

m_can_clk_start() already skip starting the clock when clock support is disabled, remove the redundant check in m_can_class_register().

Quoted 6 lines
Quoted 4 lines

This also solves the imbalance with m_can_clk_stop() that is called afterward in the same function before the return.

Did you missed this? Or do you have some concern with it?

Somehow missed it in the last PR, but already part of the next PR.

regards,
Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |