Skip to contentSkip to conversation

dt-binding, bittiming and other cleanups

PATCH In review Marc Kleine-Budde 3 participants 13 messages Jan 24, 2022 – Feb 17, 2022

Subsystems (10)
lore
Share & tools
lore

Marc Kleine-Budde

author maintainer
#0 lore raw

cover dt-binding, bittiming and other cleanups

Hello,

here are some cleanup patches which will be included in my next pull request to net-next/master.

regards,
Marc

author maintainer
#1 lore raw

PATCH 1/9 dt-binding: can: mcp251xfd: include common CAN controller bindings

Since commit

| 1f9234401ce0 ("dt-bindings: can: add can-controller.yaml")

there is a common CAN controller binding. Add this to the mcp251xfd binding.

Cc Manivannan Sadhasivam <[email protected]>
Cc Thomas Kopp <[email protected]>
---
 .../devicetree/bindings/net/can/microchip,mcp251xfd.yaml       | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/net/can/microchip,mcp251xfd.yaml +3 -0
index 2a884c1fe0e0..b3826af6bd6e 100644
@@ -11,6 +11,9 @@ title:
 maintainers:
   - Marc Kleine-Budde <[email protected]>
 
+allOf:
+  - $ref: can-controller.yaml#
+
 properties:
   compatible:
     oneOf:
Signature · 1 line
2.34.1
author maintainer
#2 lore raw

PATCH 2/9 dt-binding: can: sun4i_can: include common CAN controller bindings

In reply to Marc Kleine-Budde

Since commit

| 1f9234401ce0 ("dt-bindings: can: add can-controller.yaml")

there is a common CAN controller binding. Add this to the sun4i_can binding.

Cc Evgeny Boger <[email protected]>
Cc Gerhard Bertelsmann <[email protected]>
---
 .../devicetree/bindings/net/can/allwinner,sun4i-a10-can.yaml   | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/net/can/allwinner,sun4i-a10-can.yaml +3 -0
index c93fe9d3ea82..3c51b2d02957 100644
@@ -10,6 +10,9 @@ maintainers:
   - Chen-Yu Tsai <[email protected]>
   - Maxime Ripard <[email protected]>
 
+allOf:
+  - $ref: can-controller.yaml#
+
 properties:
   compatible:
     oneOf:
Signature · 1 line
2.34.1
author maintainer
#3 lore raw

PATCH 3/9 dt-binding: can: m_can: include common CAN controller bindings

In reply to Marc Kleine-Budde

Since commit

| 1f9234401ce0 ("dt-bindings: can: add can-controller.yaml")

there is a common CAN controller binding. Add this to the m_can binding.

Cc Chandrasekar Ramakrishnan <[email protected]>
---
 Documentation/devicetree/bindings/net/can/bosch,m_can.yaml | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +3 -0
index fb547e26c676..710880dc7594 100644
@@ -11,6 +11,9 @@ description: Bosch MCAN controller for CAN bus
 maintainers:
   - Sriram Dash <[email protected]>
 
+allOf:
+  - $ref: can-controller.yaml#
+
 properties:
   compatible:
     const: bosch,m_can
Signature · 1 line
2.34.1
Reviewed-by on v1 3/9
#4 lore raw

RE: [PATCH 3/9] dt-binding: can: m_can: include common CAN controller bindings

Ccing Rob Herring and devicetree mailing list.

Quoted 11 lines

-----Original Message-----
From: Marc Kleine-Budde <[email protected]>
Sent: 25 January 2022 03:27
To: [email protected]
Cc: Marc Kleine-Budde <[email protected]>; Chandrasekar Ramakrishnan <[email protected]>
Subject: [PATCH 3/9] dt-binding: can: m_can: include common CAN controller bindings

Since commit

Quoted 7 lines

| 1f9234401ce0 ("dt-bindings: can: add can-controller.yaml")

there is a common CAN controller binding. Add this to the m_can binding.

Cc Chandrasekar Ramakrishnan <[email protected]>

---

Quoted 22 lines
 Documentation/devicetree/bindings/net/can/bosch,m_can.yaml | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +3 -1
index fb547e26c676..710880dc7594 100644
@@ -11,6 +11,9 @@ description: Bosch MCAN controller for CAN bus
 maintainers:
   - Sriram Dash <[email protected]>
 
+allOf:
+  - $ref: can-controller.yaml#
+
 properties:
   compatible:
     const: bosch,m_can
--

2.34.1

author maintainer
#5 lore raw

Re: [PATCH 3/9] dt-binding: can: m_can: include common CAN controller bindings

Quoted 11 lines · Chandrasekar R
Quoted 11 lines

-----Original Message-----
From: Marc Kleine-Budde <[email protected]>
Sent: 25 January 2022 03:27
To: [email protected]
Cc: Marc Kleine-Budde <[email protected]>; Chandrasekar Ramakrishnan <[email protected]>
Subject: [PATCH 3/9] dt-binding: can: m_can: include common CAN controller bindings

Since commit

Quoted 8 lines
Quoted 7 lines

| 1f9234401ce0 ("dt-bindings: can: add can-controller.yaml")

there is a common CAN controller binding. Add this to the m_can binding.

Cc Chandrasekar Ramakrishnan <[email protected]>

---

Thanks for you review.

regards,
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
#6 lore raw

PATCH 4/9 dt-binding: can: rcar-can: include common CAN controller bindings

In reply to Marc Kleine-Budde

Since commit

| 1f9234401ce0 ("dt-bindings: can: add can-controller.yaml")

there is a common CAN controller binding. Add this to the rcar-can binding.

Cc Yoshihiro Shimoda <[email protected]>
Cc Fabrizio Castro <[email protected]>
Cc lrich Hecht <[email protected]>
---
 .../devicetree/bindings/net/can/renesas,rcar-can.yaml          | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/net/can/renesas,rcar-can.yaml +3 -0
index fadc871fd6b0..64247d3635e9 100644
@@ -9,6 +9,9 @@ title: Renesas R-Car CAN Controller
 maintainers:
   - Sergei Shtylyov <[email protected]>
 
+allOf:
+  - $ref: can-controller.yaml#
+
 properties:
   compatible:
     oneOf:
Signature · 1 line
2.34.1
author maintainer
#7 lore raw

PATCH 5/9 can: bittiming: can_validate_bitrate(): simplify bit rate checking

In reply to Marc Kleine-Budde

This patch simplifies the validation of the fixed bit rates. If a supported bit rate is found, directly return 0.

If no valid bit rate is found return -EINVAL;

---
 drivers/net/can/dev/bittiming.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/net/can/dev/bittiming.c +2 -6
index d5fca3bfaf9a..1b1d1499e2f1 100644
@@ -248,18 +248,14 @@ can_validate_bitrate(struct net_device *dev, struct can_bittiming *bt,
 		     const u32 *bitrate_const,
 		     const unsigned int bitrate_const_cnt)
 {
-	struct can_priv *priv = netdev_priv(dev);
 	unsigned int i;
 
 	for (i = 0; i < bitrate_const_cnt; i++) {
 		if (bt->bitrate == bitrate_const[i])
-			break;
+			return 0;
 	}
 
-	if (i >= priv->bitrate_const_cnt)
-		return -EINVAL;
-
-	return 0;
+	return -EINVAL;
 }
 
 int can_get_bittiming(struct net_device *dev, struct can_bittiming *bt,
Signature · 1 line
2.34.1
author maintainer
#8 lore raw

PATCH 6/9 can: bittiming: mark function arguments and local variables as const

In reply to Marc Kleine-Budde

This patch marks the arguments of some functions as well as some local variables as constant.

---
 drivers/net/can/dev/bittiming.c | 12 ++++++------
 include/linux/can/bittiming.h   |  6 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)
drivers/net/can/dev/bittiming.c +6 -6
index 1b1d1499e2f1..2103bcca9012 100644
@@ -24,7 +24,7 @@
  */
 static int
 can_update_sample_point(const struct can_bittiming_const *btc,
-			unsigned int sample_point_nominal, unsigned int tseg,
+			const unsigned int sample_point_nominal, const unsigned int tseg,
 			unsigned int *tseg1_ptr, unsigned int *tseg2_ptr,
 			unsigned int *sample_point_error_ptr)
 {
@@ -63,7 +63,7 @@ can_update_sample_point(const struct can_bittiming_const *btc,
 	return best_sample_point;
 }
 
-int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt,
+int can_calc_bittiming(const struct net_device *dev, struct can_bittiming *bt,
 		       const struct can_bittiming_const *btc)
 {
 	struct can_priv *priv = netdev_priv(dev);
@@ -208,10 +208,10 @@ void can_calc_tdco(struct can_tdc *tdc, const struct can_tdc_const *tdc_const,
  * prescaler value brp. You can find more information in the header
  * file linux/can/netlink.h.
  */
-static int can_fixup_bittiming(struct net_device *dev, struct can_bittiming *bt,
+static int can_fixup_bittiming(const struct net_device *dev, struct can_bittiming *bt,
 			       const struct can_bittiming_const *btc)
 {
-	struct can_priv *priv = netdev_priv(dev);
+	const struct can_priv *priv = netdev_priv(dev);
 	unsigned int tseg1, alltseg;
 	u64 brp64;
 
@@ -244,7 +244,7 @@ static int can_fixup_bittiming(struct net_device *dev, struct can_bittiming *bt,
 
 /* Checks the validity of predefined bitrate settings */
 static int
-can_validate_bitrate(struct net_device *dev, struct can_bittiming *bt,
+can_validate_bitrate(const struct net_device *dev, const struct can_bittiming *bt,
 		     const u32 *bitrate_const,
 		     const unsigned int bitrate_const_cnt)
 {
@@ -258,7 +258,7 @@ can_validate_bitrate(struct net_device *dev, struct can_bittiming *bt,
 	return -EINVAL;
 }
 
-int can_get_bittiming(struct net_device *dev, struct can_bittiming *bt,
+int can_get_bittiming(const struct net_device *dev, struct can_bittiming *bt,
 		      const struct can_bittiming_const *btc,
 		      const u32 *bitrate_const,
 		      const unsigned int bitrate_const_cnt)
include/linux/can/bittiming.h +3 -3
index a81652d1c6f3..7ae21c0f7f23 100644
@@ -113,7 +113,7 @@ struct can_tdc_const {
 };
 
 #ifdef CONFIG_CAN_CALC_BITTIMING
-int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt,
+int can_calc_bittiming(const struct net_device *dev, struct can_bittiming *bt,
 		       const struct can_bittiming_const *btc);
 
 void can_calc_tdco(struct can_tdc *tdc, const struct can_tdc_const *tdc_const,
@@ -121,7 +121,7 @@ void can_calc_tdco(struct can_tdc *tdc, const struct can_tdc_const *tdc_const,
 		   u32 *ctrlmode, u32 ctrlmode_supported);
 #else /* !CONFIG_CAN_CALC_BITTIMING */
 static inline int
-can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt,
+can_calc_bittiming(const struct net_device *dev, struct can_bittiming *bt,
 		   const struct can_bittiming_const *btc)
 {
 	netdev_err(dev, "bit-timing calculation not available\n");
@@ -136,7 +136,7 @@ can_calc_tdco(struct can_tdc *tdc, const struct can_tdc_const *tdc_const,
 }
 #endif /* CONFIG_CAN_CALC_BITTIMING */
 
-int can_get_bittiming(struct net_device *dev, struct can_bittiming *bt,
+int can_get_bittiming(const struct net_device *dev, struct can_bittiming *bt,
 		      const struct can_bittiming_const *btc,
 		      const u32 *bitrate_const,
 		      const unsigned int bitrate_const_cnt);
Signature · 1 line
2.34.1
author maintainer
#9 lore raw

PATCH 7/9 can: drivers: don't print IO remapped address of base registers

In reply to Marc Kleine-Budde

This patch removes the printing of the IO remapped base registers of all CAN devices. As documented in

| Documentation/core-api/printk-formats.rst,

to prevent information leaks a hashed value of the address is printed, until the kernel gathers enough entropy only "(ptrval)" is displayed.

This patch removes the printing of the base address as the information is not really useful.

Cc Nicolas Ferre <[email protected]>
Cc Alexandre Belloni <[email protected]>
Cc Ludovic Desroches <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
Cc Jernej Skrabec <[email protected]>
Cc Appana Durga Kedareswara rao <[email protected]>
Cc Naga Sureshkumar Relli <[email protected]>
Cc Michal Simek <[email protected]>
Cc Dario Binacchi <[email protected]>
Cc Zheyu Ma <[email protected]>
Cc Stephane Grosjean <[email protected]>
Cc Lad Prabhakar <[email protected]>
---
 drivers/net/can/at91_can.c                    | 3 +--
 drivers/net/can/c_can/c_can_pci.c             | 4 ++--
 drivers/net/can/c_can/c_can_platform.c        | 4 ++--
 drivers/net/can/cc770/cc770.c                 | 6 ++----
 drivers/net/can/cc770/cc770_isa.c             | 3 +--
 drivers/net/can/cc770/cc770_platform.c        | 4 ++--
 drivers/net/can/grcan.c                       | 4 ++--
 drivers/net/can/ifi_canfd/ifi_canfd.c         | 4 ++--
 drivers/net/can/mscan/mpc5xxx_can.c           | 4 ++--
 drivers/net/can/peak_canfd/peak_pciefd_main.c | 4 ++--
 drivers/net/can/sja1000/ems_pci.c             | 4 ++--
 drivers/net/can/sja1000/ems_pcmcia.c          | 4 ++--
 drivers/net/can/sja1000/f81601.c              | 4 ++--
 drivers/net/can/sja1000/kvaser_pci.c          | 3 +--
 drivers/net/can/sja1000/peak_pci.c            | 4 +---
 drivers/net/can/sja1000/peak_pcmcia.c         | 4 ++--
 drivers/net/can/sja1000/plx_pci.c             | 4 ++--
 drivers/net/can/sja1000/sja1000_isa.c         | 4 ++--
 drivers/net/can/sja1000/sja1000_platform.c    | 4 ++--
 drivers/net/can/sun4i_can.c                   | 4 ++--
 drivers/net/can/ti_hecc.c                     | 3 +--
 drivers/net/can/xilinx_can.c                  | 4 ++--
 22 files changed, 39 insertions(+), 47 deletions(-)
drivers/net/can/at91_can.c +1 -2
index a00655ccda02..5a7f96791014 100644
@@ -1333,8 +1333,7 @@ static int at91_can_probe(struct platform_device *pdev)
 
 	devm_can_led_init(dev);
 
-	dev_info(&pdev->dev, "device registered (reg_base=%p, irq=%d)\n",
-		 priv->reg_base, dev->irq);
+	dev_info(&pdev->dev, "device registered (irq=%d)\n", dev->irq);
 
 	return 0;
 
drivers/net/can/c_can/c_can_pci.c +2 -2
index bf2f8c3da1c1..5992a712acdb 100644
@@ -216,8 +216,8 @@ static int c_can_pci_probe(struct pci_dev *pdev,
 		goto out_free_c_can;
 	}
 
-	dev_dbg(&pdev->dev, "%s device registered (regs=%p, irq=%d)\n",
-		KBUILD_MODNAME, priv->regs, dev->irq);
+	dev_dbg(&pdev->dev, "%s device registered (irq=%d)\n",
+		KBUILD_MODNAME, dev->irq);
 
 	return 0;
 
drivers/net/can/c_can/c_can_platform.c +2 -2
index 86e95e9d6533..2f089098da90 100644
@@ -398,8 +398,8 @@ static int c_can_plat_probe(struct platform_device *pdev)
 		goto exit_free_device;
 	}
 
-	dev_info(&pdev->dev, "%s device registered (regs=%p, irq=%d)\n",
-		 KBUILD_MODNAME, priv->base, dev->irq);
+	dev_info(&pdev->dev, "%s device registered (irq=%d)\n",
+		 KBUILD_MODNAME, dev->irq);
 	return 0;
 
 exit_free_device:
drivers/net/can/cc770/cc770.c +2 -4
index bb7224cfc6ab..4ebac0312a18 100644
@@ -300,8 +300,7 @@ static int cc770_probe_chip(struct net_device *dev)
 	 * is no chip in this address space
 	 */
 	if (cc770_read_reg(priv, cpu_interface) & CPUIF_RST) {
-		netdev_info(dev, "probing @0x%p failed (reset)\n",
-			    priv->reg_base);
+		netdev_info(dev, "probing failed (reset)\n");
 		return -ENODEV;
 	}
 
@@ -312,8 +311,7 @@ static int cc770_probe_chip(struct net_device *dev)
 	if ((cc770_read_reg(priv, msgobj[1].data[1]) != 0x25) ||
 	    (cc770_read_reg(priv, msgobj[2].data[3]) != 0x52) ||
 	    (cc770_read_reg(priv, msgobj[10].data[6]) != 0xc3)) {
-		netdev_info(dev, "probing @0x%p failed (pattern)\n",
-			    priv->reg_base);
+		netdev_info(dev, "probing failed (pattern)\n");
 		return -ENODEV;
 	}
 
drivers/net/can/cc770/cc770_isa.c +1 -2
index 194c86e0f340..372de4d18a7f 100644
@@ -267,8 +267,7 @@ static int cc770_isa_probe(struct platform_device *pdev)
 		goto exit_unmap;
 	}
 
-	dev_info(&pdev->dev, "device registered (reg_base=0x%p, irq=%d)\n",
-		 priv->reg_base, dev->irq);
+	dev_info(&pdev->dev, "device registered (irq=%d)\n", dev->irq);
 	return 0;
 
  exit_unmap:
drivers/net/can/cc770/cc770_platform.c +2 -2
index 8d916e2ee6c2..2049921eed89 100644
@@ -203,9 +203,9 @@ static int cc770_platform_probe(struct platform_device *pdev)
 		goto exit_free_cc770;
 
 	dev_dbg(&pdev->dev,
-		 "reg_base=0x%p irq=%d clock=%d cpu_interface=0x%02x "
+		 "irq=%d clock=%d cpu_interface=0x%02x "
 		 "bus_config=0x%02x clkout=0x%02x\n",
-		 priv->reg_base, dev->irq, priv->can.clock.freq,
+		 dev->irq, priv->can.clock.freq,
 		 priv->cpu_interface, priv->bus_config, priv->clkout);
 
 	platform_set_drvdata(pdev, dev);
drivers/net/can/grcan.c +2 -2
index d0c5a7a60daf..80e1485675a9 100644
@@ -1616,8 +1616,8 @@ static int grcan_setup_netdev(struct platform_device *ofdev,
 	netif_napi_add(dev, &priv->napi, grcan_poll, GRCAN_NAPI_WEIGHT);
 
 	SET_NETDEV_DEV(dev, &ofdev->dev);
-	dev_info(&ofdev->dev, "regs=0x%p, irq=%d, clock=%d\n",
-		 priv->regs, dev->irq, priv->can.clock.freq);
+	dev_info(&ofdev->dev, "irq=%d, clock=%d\n",
+		 dev->irq, priv->can.clock.freq);
 
 	err = register_candev(dev);
 	if (err)
drivers/net/can/ifi_canfd/ifi_canfd.c +2 -2
index b0a3473f211d..82aeac04ad89 100644
@@ -1006,8 +1006,8 @@ static int ifi_canfd_plat_probe(struct platform_device *pdev)
 
 	devm_can_led_init(ndev);
 
-	dev_info(dev, "Driver registered: regs=%p, irq=%d, clock=%d\n",
-		 priv->base, ndev->irq, priv->can.clock.freq);
+	dev_info(dev, "Driver registered: irq=%d, clock=%d\n",
+		 ndev->irq, priv->can.clock.freq);
 
 	return 0;
 
drivers/net/can/mscan/mpc5xxx_can.c +2 -2
index de4ddf79ba9b..3d577489b5fb 100644
@@ -330,8 +330,8 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)
 		goto exit_free_mscan;
 	}
 
-	dev_info(&ofdev->dev, "MSCAN at 0x%p, irq %d, clock %d Hz\n",
-		 priv->reg_base, dev->irq, priv->can.clock.freq);
+	dev_info(&ofdev->dev, "MSCAN at irq %d, clock %d Hz\n",
+		 dev->irq, priv->can.clock.freq);
 
 	return 0;
 
drivers/net/can/peak_canfd/peak_pciefd_main.c +2 -2
index 1df3c4b54f03..be483b82c314 100644
@@ -678,8 +678,8 @@ static int pciefd_can_probe(struct pciefd_board *pciefd)
 	/* save the object address in the board structure */
 	pciefd->can[pciefd->can_count] = priv;
 
-	dev_info(&pciefd->pci_dev->dev, "%s at reg_base=0x%p irq=%d\n",
-		 ndev->name, priv->reg_base, ndev->irq);
+	dev_info(&pciefd->pci_dev->dev, "%s at irq=%d\n",
+		 ndev->name, pciefd->pci_dev->irq);
 
 	return 0;
 
drivers/net/can/sja1000/ems_pci.c +2 -2
index 4ab91759a5c6..cab01076f60f 100644
@@ -333,8 +333,8 @@ static int ems_pci_add_card(struct pci_dev *pdev,
 
 			card->channels++;
 
-			dev_info(&pdev->dev, "Channel #%d at 0x%p, irq %d\n",
-					i + 1, priv->reg_base, dev->irq);
+			dev_info(&pdev->dev, "Channel #%d, irq %d\n",
+					i + 1, dev->irq);
 		} else {
 			free_sja1000dev(dev);
 		}
drivers/net/can/sja1000/ems_pcmcia.c +2 -2
index 4642b6d4aaf7..4f267566edbb 100644
@@ -228,8 +228,8 @@ static int ems_pcmcia_add_card(struct pcmcia_device *pdev, unsigned long base)
 			card->channels++;
 
 			printk(KERN_INFO "%s: registered %s on channel "
-			       "#%d at 0x%p, irq %d\n", DRV_NAME, dev->name,
-			       i, priv->reg_base, dev->irq);
+			       "#%d, irq %d\n", DRV_NAME, dev->name,
+			       i, dev->irq);
 		} else
 			free_sja1000dev(dev);
 	}
drivers/net/can/sja1000/f81601.c +2 -2
index 8f25e95814ef..8e2ba36866fe 100644
@@ -184,8 +184,8 @@ static int f81601_pci_probe(struct pci_dev *pdev,
 		}
 
 		card->net_dev[i] = dev;
-		dev_info(&pdev->dev, "Channel #%d, %s at 0x%p, irq %d\n", i,
-			 dev->name, priv->reg_base, dev->irq);
+		dev_info(&pdev->dev, "Channel #%d, %s, irq %d\n", i,
+			 dev->name, dev->irq);
 	}
 
 	return 0;
drivers/net/can/sja1000/kvaser_pci.c +1 -2
index 95fe9ee1ce32..b9371579acd2 100644
@@ -251,8 +251,7 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel,
 	priv->irq_flags = IRQF_SHARED;
 	dev->irq = pdev->irq;
 
-	dev_info(&pdev->dev, "reg_base=%p conf_addr=%p irq=%d\n",
-		 priv->reg_base, board->conf_addr, dev->irq);
+	dev_info(&pdev->dev, "irq=%d\n", dev->irq);
 
 	SET_NETDEV_DEV(dev, &pdev->dev);
 	dev->dev_id = channel;
drivers/net/can/sja1000/peak_pci.c +1 -3
index 84f34020aafb..71e84e2f9773 100644
@@ -686,9 +686,7 @@ static int peak_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 			goto failure_free_dev;
 		}
 
-		dev_info(&pdev->dev,
-			 "%s at reg_base=0x%p cfg_base=0x%p irq=%d\n",
-			 dev->name, priv->reg_base, chan->cfg_base, dev->irq);
+		dev_info(&pdev->dev, "%s at irq=%d\n", dev->name, dev->irq);
 	}
 
 	/* Enable interrupts */
drivers/net/can/sja1000/peak_pcmcia.c +2 -2
index 131a084c3535..743780947c0b 100644
@@ -580,8 +580,8 @@ static int pcan_add_channels(struct pcan_pccard *card)
 		ccr &= ~PCC_CCR_LED_OFF_CHAN(i);
 
 		dev_info(&pdev->dev,
-			"%s on channel %d at 0x%p irq %d\n",
-			netdev->name, i, priv->reg_base, pdev->irq);
+			"%s on channel %d at irq %d\n",
+			netdev->name, i, pdev->irq);
 	}
 
 	/* write new ccr (change leds state) */
drivers/net/can/sja1000/plx_pci.c +2 -2
index 5de1ebb0c6f0..568e2efed76f 100644
@@ -704,8 +704,8 @@ static int plx_pci_add_card(struct pci_dev *pdev,
 
 			card->channels++;
 
-			dev_info(&pdev->dev, "Channel #%d at 0x%p, irq %d "
-				 "registered as %s\n", i + 1, priv->reg_base,
+			dev_info(&pdev->dev, "Channel #%d at irq %d "
+				 "registered as %s\n", i + 1,
 				 dev->irq, dev->name);
 		} else {
 			dev_err(&pdev->dev, "Channel #%d not detected\n",
drivers/net/can/sja1000/sja1000_isa.c +2 -2
index d513fac50718..9fe0f3d72d9f 100644
@@ -205,8 +205,8 @@ static int sja1000_isa_probe(struct platform_device *pdev)
 		goto exit_unmap;
 	}
 
-	dev_info(&pdev->dev, "%s device registered (reg_base=0x%p, irq=%d)\n",
-		 DRV_NAME, priv->reg_base, dev->irq);
+	dev_info(&pdev->dev, "%s device registered (irq=%d)\n",
+		 DRV_NAME, dev->irq);
 	return 0;
 
  exit_unmap:
drivers/net/can/sja1000/sja1000_platform.c +2 -2
index f9ec7bd8dfac..ff99fe711d0b 100644
@@ -288,8 +288,8 @@ static int sp_probe(struct platform_device *pdev)
 		goto exit_free;
 	}
 
-	dev_info(&pdev->dev, "%s device registered (reg_base=%p, irq=%d)\n",
-		 DRV_NAME, priv->reg_base, dev->irq);
+	dev_info(&pdev->dev, "%s device registered (irq=%d)\n",
+		 DRV_NAME, dev->irq);
 	return 0;
 
  exit_free:
drivers/net/can/sun4i_can.c +2 -2
index 25d6d81ab4f4..04f93c2f8eca 100644
@@ -885,8 +885,8 @@ static int sun4ican_probe(struct platform_device *pdev)
 	}
 	devm_can_led_init(dev);
 
-	dev_info(&pdev->dev, "device registered (base=%p, irq=%d)\n",
-		 priv->base, dev->irq);
+	dev_info(&pdev->dev, "device registered (irq=%d)\n",
+		 dev->irq);
 
 	return 0;
 
drivers/net/can/ti_hecc.c +1 -2
index ff31b993ab17..fbb0b7b7c16e 100644
@@ -956,8 +956,7 @@ static int ti_hecc_probe(struct platform_device *pdev)
 
 	devm_can_led_init(ndev);
 
-	dev_info(&pdev->dev, "device registered (reg_base=%p, irq=%u)\n",
-		 priv->base, (u32)ndev->irq);
+	dev_info(&pdev->dev, "device registered (irq=%u)\n", (u32)ndev->irq);
 
 	return 0;
 
drivers/net/can/xilinx_can.c +2 -2
index 1674b561c9a2..2c5a030c29e7 100644
@@ -1820,8 +1820,8 @@ static int xcan_probe(struct platform_device *pdev)
 		priv->write_reg(priv, XCAN_AFR_2_MASK_OFFSET, 0x00000000);
 	}
 
-	netdev_dbg(ndev, "reg_base=0x%p irq=%d clock=%d, tx buffers: actual %d, using %d\n",
-		   priv->reg_base, ndev->irq, priv->can.clock.freq,
+	netdev_dbg(ndev, "irq=%d clock=%d, tx buffers: actual %d, using %d\n",
+		   ndev->irq, priv->can.clock.freq,
 		   hw_tx_max, priv->tx_max);
 
 	return 0;
Signature · 1 line
2.34.1
#10 lore raw

Re: [PATCH 7/9] can: drivers: don't print IO remapped address of base registers

Hello,

Quoted 10 lines · Marc Kleine-Budde

This patch removes the printing of the IO remapped base registers of all CAN devices. As documented in

| Documentation/core-api/printk-formats.rst,

to prevent information leaks a hashed value of the address is printed, until the kernel gathers enough entropy only "(ptrval)" is displayed.

This patch removes the printing of the base address as the information is not really useful.

Is the info useful at all? I guess most of the instances could be replaced by a single dev_info in the can core once the device is registered and the other ones are failures where the device probing code would already print the failure.

Quoted 381 lines
Cc Nicolas Ferre <[email protected]>
Cc Alexandre Belloni <[email protected]>
Cc Ludovic Desroches <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
Cc Jernej Skrabec <[email protected]>
Cc Appana Durga Kedareswara rao <[email protected]>
Cc Naga Sureshkumar Relli <[email protected]>
Cc Michal Simek <[email protected]>
Cc Dario Binacchi <[email protected]>
Cc Zheyu Ma <[email protected]>
Cc Stephane Grosjean <[email protected]>
Cc Lad Prabhakar <[email protected]>
---
 drivers/net/can/at91_can.c                    | 3 +--
 drivers/net/can/c_can/c_can_pci.c             | 4 ++--
 drivers/net/can/c_can/c_can_platform.c        | 4 ++--
 drivers/net/can/cc770/cc770.c                 | 6 ++----
 drivers/net/can/cc770/cc770_isa.c             | 3 +--
 drivers/net/can/cc770/cc770_platform.c        | 4 ++--
 drivers/net/can/grcan.c                       | 4 ++--
 drivers/net/can/ifi_canfd/ifi_canfd.c         | 4 ++--
 drivers/net/can/mscan/mpc5xxx_can.c           | 4 ++--
 drivers/net/can/peak_canfd/peak_pciefd_main.c | 4 ++--
 drivers/net/can/sja1000/ems_pci.c             | 4 ++--
 drivers/net/can/sja1000/ems_pcmcia.c          | 4 ++--
 drivers/net/can/sja1000/f81601.c              | 4 ++--
 drivers/net/can/sja1000/kvaser_pci.c          | 3 +--
 drivers/net/can/sja1000/peak_pci.c            | 4 +---
 drivers/net/can/sja1000/peak_pcmcia.c         | 4 ++--
 drivers/net/can/sja1000/plx_pci.c             | 4 ++--
 drivers/net/can/sja1000/sja1000_isa.c         | 4 ++--
 drivers/net/can/sja1000/sja1000_platform.c    | 4 ++--
 drivers/net/can/sun4i_can.c                   | 4 ++--
 drivers/net/can/ti_hecc.c                     | 3 +--
 drivers/net/can/xilinx_can.c                  | 4 ++--
 22 files changed, 39 insertions(+), 47 deletions(-)
drivers/net/can/at91_can.c +1 -2
index a00655ccda02..5a7f96791014 100644
@@ -1333,8 +1333,7 @@ static int at91_can_probe(struct platform_device *pdev)
 
 	devm_can_led_init(dev);
 
-	dev_info(&pdev->dev, "device registered (reg_base=%p, irq=%d)\n",
-		 priv->reg_base, dev->irq);
+	dev_info(&pdev->dev, "device registered (irq=%d)\n", dev->irq);
 
 	return 0;
 
drivers/net/can/c_can/c_can_pci.c +2 -2
index bf2f8c3da1c1..5992a712acdb 100644
@@ -216,8 +216,8 @@ static int c_can_pci_probe(struct pci_dev *pdev,
 		goto out_free_c_can;
 	}
 
-	dev_dbg(&pdev->dev, "%s device registered (regs=%p, irq=%d)\n",
-		KBUILD_MODNAME, priv->regs, dev->irq);
+	dev_dbg(&pdev->dev, "%s device registered (irq=%d)\n",
+		KBUILD_MODNAME, dev->irq);
 
 	return 0;
 
drivers/net/can/c_can/c_can_platform.c +2 -2
index 86e95e9d6533..2f089098da90 100644
@@ -398,8 +398,8 @@ static int c_can_plat_probe(struct platform_device *pdev)
 		goto exit_free_device;
 	}
 
-	dev_info(&pdev->dev, "%s device registered (regs=%p, irq=%d)\n",
-		 KBUILD_MODNAME, priv->base, dev->irq);
+	dev_info(&pdev->dev, "%s device registered (irq=%d)\n",
+		 KBUILD_MODNAME, dev->irq);
 	return 0;
 
 exit_free_device:
drivers/net/can/cc770/cc770.c +2 -4
index bb7224cfc6ab..4ebac0312a18 100644
@@ -300,8 +300,7 @@ static int cc770_probe_chip(struct net_device *dev)
 	 * is no chip in this address space
 	 */
 	if (cc770_read_reg(priv, cpu_interface) & CPUIF_RST) {
-		netdev_info(dev, "probing @0x%p failed (reset)\n",
-			    priv->reg_base);
+		netdev_info(dev, "probing failed (reset)\n");
 		return -ENODEV;
 	}
 
@@ -312,8 +311,7 @@ static int cc770_probe_chip(struct net_device *dev)
 	if ((cc770_read_reg(priv, msgobj[1].data[1]) != 0x25) ||
 	    (cc770_read_reg(priv, msgobj[2].data[3]) != 0x52) ||
 	    (cc770_read_reg(priv, msgobj[10].data[6]) != 0xc3)) {
-		netdev_info(dev, "probing @0x%p failed (pattern)\n",
-			    priv->reg_base);
+		netdev_info(dev, "probing failed (pattern)\n");
 		return -ENODEV;
 	}
 
drivers/net/can/cc770/cc770_isa.c +1 -2
index 194c86e0f340..372de4d18a7f 100644
@@ -267,8 +267,7 @@ static int cc770_isa_probe(struct platform_device *pdev)
 		goto exit_unmap;
 	}
 
-	dev_info(&pdev->dev, "device registered (reg_base=0x%p, irq=%d)\n",
-		 priv->reg_base, dev->irq);
+	dev_info(&pdev->dev, "device registered (irq=%d)\n", dev->irq);
 	return 0;
 
  exit_unmap:
drivers/net/can/cc770/cc770_platform.c +2 -2
index 8d916e2ee6c2..2049921eed89 100644
@@ -203,9 +203,9 @@ static int cc770_platform_probe(struct platform_device *pdev)
 		goto exit_free_cc770;
 
 	dev_dbg(&pdev->dev,
-		 "reg_base=0x%p irq=%d clock=%d cpu_interface=0x%02x "
+		 "irq=%d clock=%d cpu_interface=0x%02x "
 		 "bus_config=0x%02x clkout=0x%02x\n",
-		 priv->reg_base, dev->irq, priv->can.clock.freq,
+		 dev->irq, priv->can.clock.freq,
 		 priv->cpu_interface, priv->bus_config, priv->clkout);
 
 	platform_set_drvdata(pdev, dev);
drivers/net/can/grcan.c +2 -2
index d0c5a7a60daf..80e1485675a9 100644
@@ -1616,8 +1616,8 @@ static int grcan_setup_netdev(struct platform_device *ofdev,
 	netif_napi_add(dev, &priv->napi, grcan_poll, GRCAN_NAPI_WEIGHT);
 
 	SET_NETDEV_DEV(dev, &ofdev->dev);
-	dev_info(&ofdev->dev, "regs=0x%p, irq=%d, clock=%d\n",
-		 priv->regs, dev->irq, priv->can.clock.freq);
+	dev_info(&ofdev->dev, "irq=%d, clock=%d\n",
+		 dev->irq, priv->can.clock.freq);
 
 	err = register_candev(dev);
 	if (err)
drivers/net/can/ifi_canfd/ifi_canfd.c +2 -2
index b0a3473f211d..82aeac04ad89 100644
@@ -1006,8 +1006,8 @@ static int ifi_canfd_plat_probe(struct platform_device *pdev)
 
 	devm_can_led_init(ndev);
 
-	dev_info(dev, "Driver registered: regs=%p, irq=%d, clock=%d\n",
-		 priv->base, ndev->irq, priv->can.clock.freq);
+	dev_info(dev, "Driver registered: irq=%d, clock=%d\n",
+		 ndev->irq, priv->can.clock.freq);
 
 	return 0;
 
drivers/net/can/mscan/mpc5xxx_can.c +2 -2
index de4ddf79ba9b..3d577489b5fb 100644
@@ -330,8 +330,8 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)
 		goto exit_free_mscan;
 	}
 
-	dev_info(&ofdev->dev, "MSCAN at 0x%p, irq %d, clock %d Hz\n",
-		 priv->reg_base, dev->irq, priv->can.clock.freq);
+	dev_info(&ofdev->dev, "MSCAN at irq %d, clock %d Hz\n",
+		 dev->irq, priv->can.clock.freq);
 
 	return 0;
 
drivers/net/can/peak_canfd/peak_pciefd_main.c +2 -2
index 1df3c4b54f03..be483b82c314 100644
@@ -678,8 +678,8 @@ static int pciefd_can_probe(struct pciefd_board *pciefd)
 	/* save the object address in the board structure */
 	pciefd->can[pciefd->can_count] = priv;
 
-	dev_info(&pciefd->pci_dev->dev, "%s at reg_base=0x%p irq=%d\n",
-		 ndev->name, priv->reg_base, ndev->irq);
+	dev_info(&pciefd->pci_dev->dev, "%s at irq=%d\n",
+		 ndev->name, pciefd->pci_dev->irq);
 
 	return 0;
 
drivers/net/can/sja1000/ems_pci.c +2 -2
index 4ab91759a5c6..cab01076f60f 100644
@@ -333,8 +333,8 @@ static int ems_pci_add_card(struct pci_dev *pdev,
 
 			card->channels++;
 
-			dev_info(&pdev->dev, "Channel #%d at 0x%p, irq %d\n",
-					i + 1, priv->reg_base, dev->irq);
+			dev_info(&pdev->dev, "Channel #%d, irq %d\n",
+					i + 1, dev->irq);
 		} else {
 			free_sja1000dev(dev);
 		}
drivers/net/can/sja1000/ems_pcmcia.c +2 -2
index 4642b6d4aaf7..4f267566edbb 100644
@@ -228,8 +228,8 @@ static int ems_pcmcia_add_card(struct pcmcia_device *pdev, unsigned long base)
 			card->channels++;
 
 			printk(KERN_INFO "%s: registered %s on channel "
-			       "#%d at 0x%p, irq %d\n", DRV_NAME, dev->name,
-			       i, priv->reg_base, dev->irq);
+			       "#%d, irq %d\n", DRV_NAME, dev->name,
+			       i, dev->irq);
 		} else
 			free_sja1000dev(dev);
 	}
drivers/net/can/sja1000/f81601.c +2 -2
index 8f25e95814ef..8e2ba36866fe 100644
@@ -184,8 +184,8 @@ static int f81601_pci_probe(struct pci_dev *pdev,
 		}
 
 		card->net_dev[i] = dev;
-		dev_info(&pdev->dev, "Channel #%d, %s at 0x%p, irq %d\n", i,
-			 dev->name, priv->reg_base, dev->irq);
+		dev_info(&pdev->dev, "Channel #%d, %s, irq %d\n", i,
+			 dev->name, dev->irq);
 	}
 
 	return 0;
drivers/net/can/sja1000/kvaser_pci.c +1 -2
index 95fe9ee1ce32..b9371579acd2 100644
@@ -251,8 +251,7 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel,
 	priv->irq_flags = IRQF_SHARED;
 	dev->irq = pdev->irq;
 
-	dev_info(&pdev->dev, "reg_base=%p conf_addr=%p irq=%d\n",
-		 priv->reg_base, board->conf_addr, dev->irq);
+	dev_info(&pdev->dev, "irq=%d\n", dev->irq);
 
 	SET_NETDEV_DEV(dev, &pdev->dev);
 	dev->dev_id = channel;
drivers/net/can/sja1000/peak_pci.c +1 -3
index 84f34020aafb..71e84e2f9773 100644
@@ -686,9 +686,7 @@ static int peak_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 			goto failure_free_dev;
 		}
 
-		dev_info(&pdev->dev,
-			 "%s at reg_base=0x%p cfg_base=0x%p irq=%d\n",
-			 dev->name, priv->reg_base, chan->cfg_base, dev->irq);
+		dev_info(&pdev->dev, "%s at irq=%d\n", dev->name, dev->irq);
 	}
 
 	/* Enable interrupts */
drivers/net/can/sja1000/peak_pcmcia.c +2 -2
index 131a084c3535..743780947c0b 100644
@@ -580,8 +580,8 @@ static int pcan_add_channels(struct pcan_pccard *card)
 		ccr &= ~PCC_CCR_LED_OFF_CHAN(i);
 
 		dev_info(&pdev->dev,
-			"%s on channel %d at 0x%p irq %d\n",
-			netdev->name, i, priv->reg_base, pdev->irq);
+			"%s on channel %d at irq %d\n",
+			netdev->name, i, pdev->irq);
 	}
 
 	/* write new ccr (change leds state) */
drivers/net/can/sja1000/plx_pci.c +2 -2
index 5de1ebb0c6f0..568e2efed76f 100644
@@ -704,8 +704,8 @@ static int plx_pci_add_card(struct pci_dev *pdev,
 
 			card->channels++;
 
-			dev_info(&pdev->dev, "Channel #%d at 0x%p, irq %d "
-				 "registered as %s\n", i + 1, priv->reg_base,
+			dev_info(&pdev->dev, "Channel #%d at irq %d "
+				 "registered as %s\n", i + 1,
 				 dev->irq, dev->name);
 		} else {
 			dev_err(&pdev->dev, "Channel #%d not detected\n",
drivers/net/can/sja1000/sja1000_isa.c +2 -2
index d513fac50718..9fe0f3d72d9f 100644
@@ -205,8 +205,8 @@ static int sja1000_isa_probe(struct platform_device *pdev)
 		goto exit_unmap;
 	}
 
-	dev_info(&pdev->dev, "%s device registered (reg_base=0x%p, irq=%d)\n",
-		 DRV_NAME, priv->reg_base, dev->irq);
+	dev_info(&pdev->dev, "%s device registered (irq=%d)\n",
+		 DRV_NAME, dev->irq);
 	return 0;
 
  exit_unmap:
drivers/net/can/sja1000/sja1000_platform.c +2 -2
index f9ec7bd8dfac..ff99fe711d0b 100644
@@ -288,8 +288,8 @@ static int sp_probe(struct platform_device *pdev)
 		goto exit_free;
 	}
 
-	dev_info(&pdev->dev, "%s device registered (reg_base=%p, irq=%d)\n",
-		 DRV_NAME, priv->reg_base, dev->irq);
+	dev_info(&pdev->dev, "%s device registered (irq=%d)\n",
+		 DRV_NAME, dev->irq);
 	return 0;
 
  exit_free:
drivers/net/can/sun4i_can.c +2 -2
index 25d6d81ab4f4..04f93c2f8eca 100644
@@ -885,8 +885,8 @@ static int sun4ican_probe(struct platform_device *pdev)
 	}
 	devm_can_led_init(dev);
 
-	dev_info(&pdev->dev, "device registered (base=%p, irq=%d)\n",
-		 priv->base, dev->irq);
+	dev_info(&pdev->dev, "device registered (irq=%d)\n",
+		 dev->irq);
 
 	return 0;
 
drivers/net/can/ti_hecc.c +1 -2
index ff31b993ab17..fbb0b7b7c16e 100644
@@ -956,8 +956,7 @@ static int ti_hecc_probe(struct platform_device *pdev)
 
 	devm_can_led_init(ndev);
 
-	dev_info(&pdev->dev, "device registered (reg_base=%p, irq=%u)\n",
-		 priv->base, (u32)ndev->irq);
+	dev_info(&pdev->dev, "device registered (irq=%u)\n", (u32)ndev->irq);
 
 	return 0;
 
drivers/net/can/xilinx_can.c +2 -2
index 1674b561c9a2..2c5a030c29e7 100644
@@ -1820,8 +1820,8 @@ static int xcan_probe(struct platform_device *pdev)
 		priv->write_reg(priv, XCAN_AFR_2_MASK_OFFSET, 0x00000000);
 	}
 
-	netdev_dbg(ndev, "reg_base=0x%p irq=%d clock=%d, tx buffers: actual %d, using %d\n",
-		   priv->reg_base, ndev->irq, priv->can.clock.freq,
+	netdev_dbg(ndev, "irq=%d clock=%d, tx buffers: actual %d, using %d\n",
+		   ndev->irq, priv->can.clock.freq,
 		   hw_tx_max, priv->tx_max);
 
 	return 0;
Signature · 1 line
2.34.1
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author maintainer
#11 lore raw

PATCH 8/9 can: kvaser_usb: kvaser_usb_send_cmd(): remove redundant variable actual_len

In reply to Marc Kleine-Budde

The function usb_bulk_msg() can be called with a NULL pointer as the "actual_length" parameter. This patch removes this variable.

---
 drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +1 -3
index c4b4d3d0a387..e67658b53d02 100644
@@ -205,12 +205,10 @@ MODULE_DEVICE_TABLE(usb, kvaser_usb_table);
 
 int kvaser_usb_send_cmd(const struct kvaser_usb *dev, void *cmd, int len)
 {
-	int actual_len; /* Not used */
-
 	return usb_bulk_msg(dev->udev,
 			    usb_sndbulkpipe(dev->udev,
 					    dev->bulk_out->bEndpointAddress),
-			    cmd, len, &actual_len, KVASER_USB_TIMEOUT);
+			    cmd, len, NULL, KVASER_USB_TIMEOUT);
 }
 
 int kvaser_usb_recv_cmd(const struct kvaser_usb *dev, void *cmd, int len,
Signature · 1 line
2.34.1
author maintainer
#12 lore raw

PATCH 9/9 can: c_can: ethtool: use default drvinfo

In reply to Marc Kleine-Budde

The ethtool core implements a default drvinfo.

There's no need to replicate this in the driver, no additional information is added, so remove this and rely on the default.

---
 drivers/net/can/c_can/c_can_ethtool.c | 9 ---------
 1 file changed, 9 deletions(-)
drivers/net/can/c_can/c_can_ethtool.c +0 -9
index 6655146294fc..8a826a6813bd 100644
@@ -11,14 +11,6 @@
 
 #include "c_can.h"
 
-static void c_can_get_drvinfo(struct net_device *netdev,
-			      struct ethtool_drvinfo *info)
-{
-	struct c_can_priv *priv = netdev_priv(netdev);
-	strscpy(info->driver, "c_can", sizeof(info->driver));
-	strscpy(info->bus_info, dev_name(priv->device), sizeof(info->bus_info));
-}
-
 static void c_can_get_ringparam(struct net_device *netdev,
 				struct ethtool_ringparam *ring,
 				struct kernel_ethtool_ringparam *kernel_ring,
@@ -33,7 +25,6 @@ static void c_can_get_ringparam(struct net_device *netdev,
 }
 
 static const struct ethtool_ops c_can_ethtool_ops = {
-	.get_drvinfo = c_can_get_drvinfo,
 	.get_ringparam = c_can_get_ringparam,
 };
 
Signature · 1 line
2.34.1