Skip to contentSkip to conversation

: m_can fixes

RFC In review Marc Kleine-Budde 2 participants 7 messages Dec 15, 2020

Subsystems (2)
lore
Share & tools
lore

Marc Kleine-Budde

author maintainer
#0 lore raw

Hello,

this is a series with 2 fixes the for m_can and the tcan4x5x driver. Maybe we can get this into v5.10, if not I'll ask the David and Jakub to queue this for v5.11 and stable.

regards,
Marc

author maintainer
#1 lore raw

PATCH 1/2 can: m_can: m_can_class_unregister(): remove erroneous m_can_clk_stop()

In m_can_class_register() the clock is started, but stopped on exit. When calling m_can_class_unregister(), the clock is stopped a second time.

This patch removes the erroneous m_can_clk_stop() in m_can_class_unregister().

Fixes f524f829b75a ("can: m_can: Create a m_can platform framework")
Cc Dan Murphy <[email protected]>
Cc Sriram Dash <[email protected]>
---
 drivers/net/can/m_can/m_can.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/can/m_can/m_can.c +0 -2
index 61a93b192037..075ee760b5ba 100644
@@ -1918,8 +1918,6 @@ EXPORT_SYMBOL_GPL(m_can_class_resume);
 void m_can_class_unregister(struct m_can_classdev *m_can_dev)
 {
 	unregister_candev(m_can_dev->net);
-
-	m_can_clk_stop(m_can_dev);
 }
 EXPORT_SYMBOL_GPL(m_can_class_unregister);
 

base-commit: 7f376f1917d7461e05b648983e8d2aea9d0712b2

Signature · 1 line
2.29.2
Reviewed-by on v1 1/2
#2 lore raw

Re: [net-rfc 1/2] can: m_can: m_can_class_unregister(): remove erroneous m_can_clk_stop()

Quoted 4 lines · Marc Kleine-Budde

In m_can_class_register() the clock is started, but stopped on exit. When calling m_can_class_unregister(), the clock is stopped a second time.

This patch removes the erroneous m_can_clk_stop() in m_can_class_unregister().

Looks good :) I have a little question... Will ndo_stop() be called if the driver is removed?

Quoted 5 lines
Fixes f524f829b75a ("can: m_can: Create a m_can platform framework")
Cc Dan Murphy <[email protected]>
Cc Sriram Dash <[email protected]>
Quoted 19 lines
---
  drivers/net/can/m_can/m_can.c | 2 --
  1 file changed, 2 deletions(-)
drivers/net/can/m_can/m_can.c +0 -2
index 61a93b192037..075ee760b5ba 100644
@@ -1918,8 +1918,6 @@ EXPORT_SYMBOL_GPL(m_can_class_resume);
  void m_can_class_unregister(struct m_can_classdev *m_can_dev)
  {
  	unregister_candev(m_can_dev->net);
-
-	m_can_clk_stop(m_can_dev);
  }
  EXPORT_SYMBOL_GPL(m_can_class_unregister);
 

base-commit: 7f376f1917d7461e05b648983e8d2aea9d0712b2

author maintainer
#3 lore raw

Re: [net-rfc 1/2] can: m_can: m_can_class_unregister(): remove erroneous m_can_clk_stop()

Quoted 7 lines · Sean Nyekjaer
Quoted 4 lines · Marc Kleine-Budde

In m_can_class_register() the clock is started, but stopped on exit. When calling m_can_class_unregister(), the clock is stopped a second time.

This patch removes the erroneous m_can_clk_stop() in m_can_class_unregister().

Looks good :) I have a little question... Will ndo_stop() be called if the driver is removed?

Yes, you cannot remove a driver if the interface is still up.

Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |
author maintainer
#4 lore raw

PATCH 2/2 can: tcan4x5x: fix bittiming const, use common bittiming from m_can driver

In reply to Marc Kleine-Budde

According to the TCAN4550 datasheet "SLLSF91 - DECEMBER 2018" the tcan4x5x has the same bittiming constants as a m_can revision 3.2.x/3.3.0.

The tcan4x5x chip I'm using identifies itself as m_can revision 3.2.1, so remove the tcan4x5x specific bittiming values and rely on the values in the m_can driver, which are selected according to core revision.

Fixes 5443c226ba91 ("can: tcan4x5x: Add tcan4x5x driver to the kernel")
Cc Dan Murphy <[email protected]>
---
 drivers/net/can/m_can/tcan4x5x.c | 26 --------------------------
 1 file changed, 26 deletions(-)
drivers/net/can/m_can/tcan4x5x.c +0 -26
index 7347ab39c5b6..f726c5112294 100644
@@ -129,30 +129,6 @@ struct tcan4x5x_priv {
 	int reg_offset;
 };
 
-static struct can_bittiming_const tcan4x5x_bittiming_const = {
-	.name = DEVICE_NAME,
-	.tseg1_min = 2,
-	.tseg1_max = 31,
-	.tseg2_min = 2,
-	.tseg2_max = 16,
-	.sjw_max = 16,
-	.brp_min = 1,
-	.brp_max = 32,
-	.brp_inc = 1,
-};
-
-static struct can_bittiming_const tcan4x5x_data_bittiming_const = {
-	.name = DEVICE_NAME,
-	.tseg1_min = 1,
-	.tseg1_max = 32,
-	.tseg2_min = 1,
-	.tseg2_max = 16,
-	.sjw_max = 16,
-	.brp_min = 1,
-	.brp_max = 32,
-	.brp_inc = 1,
-};
-
 static void tcan4x5x_check_wake(struct tcan4x5x_priv *priv)
 {
 	int wake_state = 0;
@@ -479,8 +455,6 @@ static int tcan4x5x_can_probe(struct spi_device *spi)
 	mcan_class->dev = &spi->dev;
 	mcan_class->ops = &tcan4x5x_ops;
 	mcan_class->is_peripheral = true;
-	mcan_class->bit_timing = &tcan4x5x_bittiming_const;
-	mcan_class->data_timing = &tcan4x5x_data_bittiming_const;
 	mcan_class->net->irq = spi->irq;
 
 	spi_set_drvdata(spi, priv);
Signature · 1 line
2.29.2
Reviewed-by on v1 2/2
#5 lore raw

Re: [net-rfc 2/2] can: tcan4x5x: fix bittiming const, use common bittiming from m_can driver

Quoted 10 lines · Marc Kleine-Budde

According to the TCAN4550 datasheet "SLLSF91 - DECEMBER 2018" the tcan4x5x has the same bittiming constants as a m_can revision 3.2.x/3.3.0.

The tcan4x5x chip I'm using identifies itself as m_can revision 3.2.1, so remove the tcan4x5x specific bittiming values and rely on the values in the m_can driver, which are selected according to core revision.

Fixes 5443c226ba91 ("can: tcan4x5x: Add tcan4x5x driver to the kernel")
Cc Dan Murphy <[email protected]>
Quoted 48 lines
---
  drivers/net/can/m_can/tcan4x5x.c | 26 --------------------------
  1 file changed, 26 deletions(-)
drivers/net/can/m_can/tcan4x5x.c +0 -26
index 7347ab39c5b6..f726c5112294 100644
@@ -129,30 +129,6 @@ struct tcan4x5x_priv {
  	int reg_offset;
  };
 
-static struct can_bittiming_const tcan4x5x_bittiming_const = {
-	.name = DEVICE_NAME,
-	.tseg1_min = 2,
-	.tseg1_max = 31,
-	.tseg2_min = 2,
-	.tseg2_max = 16,
-	.sjw_max = 16,
-	.brp_min = 1,
-	.brp_max = 32,
-	.brp_inc = 1,
-};
-
-static struct can_bittiming_const tcan4x5x_data_bittiming_const = {
-	.name = DEVICE_NAME,
-	.tseg1_min = 1,
-	.tseg1_max = 32,
-	.tseg2_min = 1,
-	.tseg2_max = 16,
-	.sjw_max = 16,
-	.brp_min = 1,
-	.brp_max = 32,
-	.brp_inc = 1,
-};
-
  static void tcan4x5x_check_wake(struct tcan4x5x_priv *priv)
  {
  	int wake_state = 0;
@@ -479,8 +455,6 @@ static int tcan4x5x_can_probe(struct spi_device *spi)
  	mcan_class->dev = &spi->dev;
  	mcan_class->ops = &tcan4x5x_ops;
  	mcan_class->is_peripheral = true;
-	mcan_class->bit_timing = &tcan4x5x_bittiming_const;
-	mcan_class->data_timing = &tcan4x5x_data_bittiming_const;
  	mcan_class->net->irq = spi->irq;
 
  	spi_set_drvdata(spi, priv);
author maintainer
#6 lore raw
In reply to Marc Kleine-Budde
Quoted 5 lines · Marc Kleine-Budde

Hello,

this is a series with 2 fixes the for m_can and the tcan4x5x driver. Maybe we can get this into v5.10, if not I'll ask the David and Jakub to queue this for v5.11 and stable.

Due to limited time traveling resources this will wait for v5.11.

Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |