Skip to contentSkip to conversation

pull-request: can-next 2023-05-15

PATCH Applied Marc Kleine-Budde 2 participants 24 messages May 15, 2023 – May 17, 2023

Subsystems (12)
lore
Share & tools
lore

Marc Kleine-Budde

author maintainer
#0 lore raw

cover pull-request: can-next 2023-05-15

Hello netdev-team,

this is a pull request of 22 patches for net-next/master.

The 1st patch is by Ji-Ze Hong and adds support for the Fintek F81604 USB-CAN adapter.

Jiapeng Chong's patch removes unnecessary dev_err() functions from the bxcan driver.

The next patch is by me an makes a CAN internal header file self contained.

The remaining 19 patches are by Uwe Kleine-König, they all convert the platform driver remove callback to return void.

regards,
Marc

---

The following changes since commit 0d9b41daa5907756a31772d8af8ac5ff25cf17c1:

nfc: llcp: fix possible use of uninitialized variable in nfc_llcp_send_connect() (2023-05-15 13:03:34 +0100)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git tags/linux-can-next-for-6.5-20230515

for you to fetch changes up to 2a3e16360290642202450dad67847824157cccae:

Merge patch series "can: Convert to platform remove callback returning void" (2023-05-15 22:54:22 +0200)

----------------------------------------------------------------
linux-can-next-for-6.5-20230515

----------------------------------------------------------------
Ji-Ze Hong (1):

      can: usb: f81604: add Fintek F81604 support

Jiapeng Chong (1):
can: bxcan: Remove unnecessary print function dev_err()

Marc Kleine-Budde (2):
can: length: make header self contained
Merge patch series "can: Convert to platform remove callback returning void"

Uwe Kleine-König (19):
can: at91_can: Convert to platform remove callback returning void
can: bxcan: Convert to platform remove callback returning void
can: c_can: Convert to platform remove callback returning void
can: cc770_isa: Convert to platform remove callback returning void
can: cc770_platform: Convert to platform remove callback returning void
can: ctucanfd: Convert to platform remove callback returning void
can: flexcan: Convert to platform remove callback returning void
can: grcan: Convert to platform remove callback returning void
can: ifi_canfd: Convert to platform remove callback returning void
can: janz-ican3: Convert to platform remove callback returning void
can: m_can: Convert to platform remove callback returning void
can: mscan: mpc5xxx_can: Convert to platform remove callback returning void
can: rcar: Convert to platform remove callback returning void
can: sja1000_isa: Convert to platform remove callback returning void
can: sja1000_platform: Convert to platform remove callback returning void
can: softing: Convert to platform remove callback returning void
can: sun4i_can: Convert to platform remove callback returning void
can: ti_hecc: Convert to platform remove callback returning void
can: xilinx: Convert to platform remove callback returning void

 MAINTAINERS                                  |    6 +
 drivers/net/can/at91_can.c                   |    6 +-
 drivers/net/can/bxcan.c                      |   17 +-
 drivers/net/can/c_can/c_can_platform.c       |    6 +-
 drivers/net/can/cc770/cc770_isa.c            |    6 +-
 drivers/net/can/cc770/cc770_platform.c       |    6 +-
 drivers/net/can/ctucanfd/ctucanfd_platform.c |    6 +-
 drivers/net/can/flexcan/flexcan-core.c       |    6 +-
 drivers/net/can/grcan.c                      |    6 +-
 drivers/net/can/ifi_canfd/ifi_canfd.c        |    6 +-
 drivers/net/can/janz-ican3.c                 |    6 +-
 drivers/net/can/m_can/m_can_platform.c       |    6 +-
 drivers/net/can/mscan/mpc5xxx_can.c          |    6 +-
 drivers/net/can/rcar/rcar_can.c              |    5 +-
 drivers/net/can/rcar/rcar_canfd.c            |    6 +-
 drivers/net/can/sja1000/sja1000_isa.c        |    6 +-
 drivers/net/can/sja1000/sja1000_platform.c   |    6 +-
 drivers/net/can/softing/softing_main.c       |    5 +-
 drivers/net/can/sun4i_can.c                  |    6 +-
 drivers/net/can/ti_hecc.c                    |    6 +-
 drivers/net/can/usb/Kconfig                  |   12 +
 drivers/net/can/usb/Makefile                 |    1 +
 drivers/net/can/usb/f81604.c                 | 1201 ++++++++++++++++++++++++++
 drivers/net/can/xilinx_can.c                 |    6 +-
 include/linux/can/length.h                   |    3 +
 25 files changed, 1266 insertions(+), 86 deletions(-)
 create mode 100644 drivers/net/can/usb/f81604.c
author maintainer
#1 lore raw

PATCH 1/22 can: at91_can: Convert to platform remove callback returning void

From: Uwe Kleine-König <[email protected]>

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/net/can/at91_can.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/can/at91_can.c +2 -4
index 199cb200f2bd..4621266851ed 100644
@@ -1346,7 +1346,7 @@ static int at91_can_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int at91_can_remove(struct platform_device *pdev)
+static void at91_can_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 	struct at91_priv *priv = netdev_priv(dev);
@@ -1362,8 +1362,6 @@ static int at91_can_remove(struct platform_device *pdev)
 	clk_put(priv->clk);
 
 	free_candev(dev);
-
-	return 0;
 }
 
 static const struct platform_device_id at91_can_id_table[] = {
@@ -1381,7 +1379,7 @@ MODULE_DEVICE_TABLE(platform, at91_can_id_table);
 
 static struct platform_driver at91_can_driver = {
 	.probe = at91_can_probe,
-	.remove = at91_can_remove,
+	.remove_new = at91_can_remove,
 	.driver = {
 		.name = KBUILD_MODNAME,
 		.of_match_table = of_match_ptr(at91_can_dt_ids),

base-commit: 0d9b41daa5907756a31772d8af8ac5ff25cf17c1

Signature · 1 line
2.39.2
#2 lore raw

Re: [PATCH net-next 01/22] can: at91_can: Convert to platform remove callback returning void

This series was applied to netdev/net-next.git (main) by Marc Kleine-Budde <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Marc Kleine-Budde <[email protected]>:

Quoted 11 lines · On Mon, 15 May 2023 22:57:38 +0200 you wrote:

From: Uwe Kleine-König <[email protected]>

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().

Quoted 1 line

[...]

Here is the summary with links:
- [net-next,01/22] can: at91_can: Convert to platform remove callback returning void

    https://git.kernel.org/netdev/net-next/c/03ef5a4b322f
  - [net-next,02/22] can: bxcan: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/cba8ed7f0043
  - [net-next,03/22] can: c_can: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/1708caf4c47d
  - [net-next,04/22] can: usb: f81604: add Fintek F81604 support
    https://git.kernel.org/netdev/net-next/c/88da17436973
  - [net-next,05/22] can: cc770_isa: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/938100762293
  - [net-next,06/22] can: bxcan: Remove unnecessary print function dev_err()
    https://git.kernel.org/netdev/net-next/c/cca7d85ad80c
  - [net-next,07/22] can: cc770_platform: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/86eb8a19b477
  - [net-next,08/22] can: length: make header self contained
    https://git.kernel.org/netdev/net-next/c/6882011e8854
  - [net-next,09/22] can: ctucanfd: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/45413bf75919
  - [net-next,10/22] can: flexcan: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/55216590c9cf
  - [net-next,11/22] can: grcan: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/6aa62362f14d
  - [net-next,12/22] can: ifi_canfd: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/a5095a981018
  - [net-next,13/22] can: janz-ican3: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/3ac96f45aac6
  - [net-next,14/22] can: m_can: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/2d7c33d032ff
  - [net-next,15/22] can: mscan: mpc5xxx_can: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/36157299e67b
  - [net-next,16/22] can: rcar: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/ae08f87afff7
  - [net-next,17/22] can: sja1000_isa: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/0367b598afbe
  - [net-next,18/22] can: sja1000_platform: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/bc79adfbd1fd
  - [net-next,19/22] can: softing: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/737aec8a8f13
  - [net-next,20/22] can: sun4i_can: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/aaa278e646c0
  - [net-next,21/22] can: ti_hecc: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/9587b93b7755
  - [net-next,22/22] can: xilinx: Convert to platform remove callback returning void
    https://git.kernel.org/netdev/net-next/c/0816e1dd5ea8

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
author maintainer
#3 lore raw

PATCH 2/22 can: bxcan: Convert to platform remove callback returning void

In reply to Marc Kleine-Budde

From: Uwe Kleine-König <[email protected]>

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/net/can/bxcan.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/can/bxcan.c +2 -3
index 7b285eeb08a1..99a4b599a655 100644
@@ -1021,7 +1021,7 @@ static int bxcan_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int bxcan_remove(struct platform_device *pdev)
+static void bxcan_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct bxcan_priv *priv = netdev_priv(ndev);
@@ -1030,7 +1030,6 @@ static int bxcan_remove(struct platform_device *pdev)
 	clk_disable_unprepare(priv->clk);
 	can_rx_offload_del(&priv->offload);
 	free_candev(ndev);
-	return 0;
 }
 
 static int __maybe_unused bxcan_suspend(struct device *dev)
@@ -1082,7 +1081,7 @@ static struct platform_driver bxcan_driver = {
 		.of_match_table = bxcan_of_match,
 	},
 	.probe = bxcan_probe,
-	.remove = bxcan_remove,
+	.remove_new = bxcan_remove,
 };
 
 module_platform_driver(bxcan_driver);
Signature · 1 line
2.39.2
author maintainer
#4 lore raw

PATCH 3/22 can: c_can: Convert to platform remove callback returning void

In reply to Marc Kleine-Budde

From: Uwe Kleine-König <[email protected]>

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/net/can/c_can/c_can_platform.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/can/c_can/c_can_platform.c +2 -4
index 03ccb7cfacaf..925930b6c4ca 100644
@@ -410,7 +410,7 @@ static int c_can_plat_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int c_can_plat_remove(struct platform_device *pdev)
+static void c_can_plat_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 	struct c_can_priv *priv = netdev_priv(dev);
@@ -418,8 +418,6 @@ static int c_can_plat_remove(struct platform_device *pdev)
 	unregister_c_can_dev(dev);
 	pm_runtime_disable(priv->device);
 	free_c_can_dev(dev);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM
@@ -487,7 +485,7 @@ static struct platform_driver c_can_plat_driver = {
 		.of_match_table = c_can_of_table,
 	},
 	.probe = c_can_plat_probe,
-	.remove = c_can_plat_remove,
+	.remove_new = c_can_plat_remove,
 	.suspend = c_can_suspend,
 	.resume = c_can_resume,
 	.id_table = c_can_id_table,
Signature · 1 line
2.39.2
author maintainer
#5 lore raw

PATCH 4/22 can: usb: f81604: add Fintek F81604 support

In reply to Marc Kleine-Budde

From: Ji-Ze Hong <[email protected]>

This patch adds support for Fintek USB to 2CAN controller.

Changelog:
v7: https://lore.kernel.org/all/[email protected]
1. Fix consistency of coding style for "break" in f81604_register_urbs().
2. Remove goto statement in f81604_open().

v6: https://lore.kernel.org/all/[email protected]
1. Remove non-used define and change constant mask to GENMASK().
2. Move some variables declaration from function start to block start.
3. Move some variables initization into declaration.
4. Change variable "id" in f81604_start_xmit() only for CAN ID usage.

v5: https://lore.kernel.org/all/[email protected]
1. Change all u8 *buff to struct f81604_int_data/f81604_can_frame.
2. Change all netdev->dev_id to netdev->dev_port.
3. Remove over design for f81604_process_rx_packet(). This device only report a frame at once, so the f81604_process_rx_packet() are reduced to process 1 frame.

v4: https://lore.kernel.org/all/[email protected]
1. Remove f81604_prepare_urbs/f81604_remove_urbs() and alloc URB/buffer dynamically in f81604_register_urbs(), using "urbs_anchor" for manage all rx/int URBs.
2. Add F81604 to MAINTAINERS list.
3. Change handle_clear_reg_work/handle_clear_overrun_work to single clear_reg_work and using bitwise "clear_flags" to record it.
4. Move __f81604_set_termination in front of f81604_probe() to avoid rarely racing condition.
5. Add __aligned to struct f81604_int_data / f81604_sff / f81604_eff.
6. Add aligned operations in f81604_start_xmit/f81604_process_rx_packet().
7. Change lots of CANBUS functions first parameter from struct usb_device*

     to struct f81604_port_priv *priv. But remain f81604_write / f81604_read
     / f81604_update_bits() as struct usb_device* for
     __f81604_set_termination() in probe() stage.
  8. Simplify f81604_read_int_callback() and separate into
     f81604_handle_tx / f81604_handle_can_bus_errors() functions.

v3: https://lore.kernel.org/all/[email protected]
1. Change CAN clock to using MEGA units.
2. Remove USB set/get retry, only remain SJA1000 reset/operation retry.
3. Fix all numberic constant to define.
4. Add terminator control. (only 0 & 120 ohm)
5. Using struct data to represent INT/TX/RX endpoints data instead byte arrays.
6. Error message reports changed from %d to %pe for mnemotechnic values.
7. Some bit operations are changed to FIELD_PREP().
8. Separate TX functions from f81604_read_int_callback().
9. cf->can_id |= CAN_ERR_CNT in f81604_read_int_callback to report valid TX/RX error counts.
10. Move f81604_prepare_urbs/f81604_remove_urbs() from CAN open/close() to USB probe/disconnect().
11. coding style refactoring.

v2: https://lore.kernel.org/all/[email protected]
1. coding style refactoring.
2. some const number are defined to describe itself.
3. fix wrong usage for can_get_echo_skb() in f81604_write_bulk_callback().

v1: https://lore.kernel.org/all/[email protected]

---
 MAINTAINERS                  |    6 +
 drivers/net/can/usb/Kconfig  |   12 +
 drivers/net/can/usb/Makefile |    1 +
 drivers/net/can/usb/f81604.c | 1201 ++++++++++++++++++++++++++++++++++
 4 files changed, 1220 insertions(+)
 create mode 100644 drivers/net/can/usb/f81604.c
MAINTAINERS +6 -0
index e2fd64c2ebdc..a83be7caa468 100644
@@ -7966,6 +7966,12 @@ S:	Maintained
 F:	drivers/hwmon/f75375s.c
 F:	include/linux/f75375s.h
 
+FINTEK F81604 USB to 2xCANBUS DEVICE DRIVER
+M:	Ji-Ze Hong (Peter Hong) <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/net/can/usb/f81604.c
+
 FIREWIRE AUDIO DRIVERS and IEC 61883-1/6 PACKET STREAMING ENGINE
 M:	Clemens Ladisch <[email protected]>
 M:	Takashi Sakamoto <[email protected]>
drivers/net/can/usb/Kconfig +12 -0
index 445504ababce..58fcd2b34820 100644
@@ -38,6 +38,18 @@ config CAN_ETAS_ES58X
 	  To compile this driver as a module, choose M here: the module
 	  will be called etas_es58x.
 
+config CAN_F81604
+        tristate "Fintek F81604 USB to 2CAN interface"
+        help
+          This driver supports the Fintek F81604 USB to 2CAN interface.
+          The device can support CAN2.0A/B protocol and also support
+          2 output pins to control external terminator (optional).
+
+          To compile this driver as a module, choose M here: the module will
+          be called f81604.
+
+          (see also https://www.fintek.com.tw).
+
 config CAN_GS_USB
 	tristate "Geschwister Schneider UG and candleLight compatible interfaces"
 	help
drivers/net/can/usb/Makefile +1 -0
index 1ea16be5743b..8b11088e9a59 100644
@@ -7,6 +7,7 @@ obj-$(CONFIG_CAN_8DEV_USB) += usb_8dev.o
 obj-$(CONFIG_CAN_EMS_USB) += ems_usb.o
 obj-$(CONFIG_CAN_ESD_USB) += esd_usb.o
 obj-$(CONFIG_CAN_ETAS_ES58X) += etas_es58x/
+obj-$(CONFIG_CAN_F81604) += f81604.o
 obj-$(CONFIG_CAN_GS_USB) += gs_usb.o
 obj-$(CONFIG_CAN_KVASER_USB) += kvaser_usb/
 obj-$(CONFIG_CAN_MCBA_USB) += mcba_usb.o
drivers/net/can/usb/f81604.c new file +1201 -0

1,201 lines not on this page · raw message

Signature · 1 line
2.39.2
author maintainer
#6 lore raw

PATCH 5/22 can: cc770_isa: Convert to platform remove callback returning void

In reply to Marc Kleine-Budde

From: Uwe Kleine-König <[email protected]>

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/net/can/cc770/cc770_isa.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/can/cc770/cc770_isa.c +2 -4
index 8f6dccd5a587..22009440a983 100644
@@ -285,7 +285,7 @@ static int cc770_isa_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int cc770_isa_remove(struct platform_device *pdev)
+static void cc770_isa_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 	struct cc770_priv *priv = netdev_priv(dev);
@@ -303,13 +303,11 @@ static int cc770_isa_remove(struct platform_device *pdev)
 			release_region(port[idx], CC770_IOSIZE);
 	}
 	free_cc770dev(dev);
-
-	return 0;
 }
 
 static struct platform_driver cc770_isa_driver = {
 	.probe = cc770_isa_probe,
-	.remove = cc770_isa_remove,
+	.remove_new = cc770_isa_remove,
 	.driver = {
 		.name = KBUILD_MODNAME,
 	},
Signature · 1 line
2.39.2
author maintainer
#7 lore raw

PATCH 6/22 can: bxcan: Remove unnecessary print function dev_err()

In reply to Marc Kleine-Budde

From: Jiapeng Chong <[email protected]>

The print function dev_err() is redundant because platform_get_irq_byname() already prints an error.

./drivers/net/can/bxcan.c:970:2-9: line 970 is redundant because platform_get_irq() already prints an error. ./drivers/net/can/bxcan.c:964:2-9: line 964 is redundant because platform_get_irq() already prints an error. ./drivers/net/can/bxcan.c:958:2-9: line 958 is redundant because platform_get_irq() already prints an error.

---
 drivers/net/can/bxcan.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/net/can/bxcan.c +3 -9
index e26ccd41e3cb..7b285eeb08a1 100644
@@ -954,22 +954,16 @@ static int bxcan_probe(struct platform_device *pdev)
 	}
 
 	rx_irq = platform_get_irq_byname(pdev, "rx0");
-	if (rx_irq < 0) {
-		dev_err(dev, "failed to get rx0 irq\n");
+	if (rx_irq < 0)
 		return rx_irq;
-	}
 
 	tx_irq = platform_get_irq_byname(pdev, "tx");
-	if (tx_irq < 0) {
-		dev_err(dev, "failed to get tx irq\n");
+	if (tx_irq < 0)
 		return tx_irq;
-	}
 
 	sce_irq = platform_get_irq_byname(pdev, "sce");
-	if (sce_irq < 0) {
-		dev_err(dev, "failed to get sce irq\n");
+	if (sce_irq < 0)
 		return sce_irq;
-	}
 
 	ndev = alloc_candev(sizeof(struct bxcan_priv), BXCAN_TX_MB_NUM);
 	if (!ndev) {
Signature · 1 line
2.39.2
author maintainer
#8 lore raw

PATCH 7/22 can: cc770_platform: Convert to platform remove callback returning void

In reply to Marc Kleine-Budde

From: Uwe Kleine-König <[email protected]>

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/net/can/cc770/cc770_platform.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/can/cc770/cc770_platform.c +2 -4
index 8dcc32e4e30e..13bcfba05f18 100644
@@ -230,7 +230,7 @@ static int cc770_platform_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int cc770_platform_remove(struct platform_device *pdev)
+static void cc770_platform_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 	struct cc770_priv *priv = netdev_priv(dev);
@@ -242,8 +242,6 @@ static int cc770_platform_remove(struct platform_device *pdev)
 
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	release_mem_region(mem->start, resource_size(mem));
-
-	return 0;
 }
 
 static const struct of_device_id cc770_platform_table[] = {
@@ -259,7 +257,7 @@ static struct platform_driver cc770_platform_driver = {
 		.of_match_table = cc770_platform_table,
 	},
 	.probe = cc770_platform_probe,
-	.remove = cc770_platform_remove,
+	.remove_new = cc770_platform_remove,
 };
 
 module_platform_driver(cc770_platform_driver);
Signature · 1 line
2.39.2
author maintainer
#9 lore raw

PATCH 8/22 can: length: make header self contained

In reply to Marc Kleine-Budde

Include the headers that "can/length.h" depends on.

Fixes bdd2e413192d ("can: dev: move length related code into seperate file")
---
 include/linux/can/length.h | 3 +++
 1 file changed, 3 insertions(+)
include/linux/can/length.h +3 -0
index 6995092b774e..69336549d24f 100644
@@ -6,6 +6,9 @@
 #ifndef _CAN_LENGTH_H
 #define _CAN_LENGTH_H
 
+#include <linux/can.h>
+#include <linux/can/netlink.h>
+
 /*
  * Size of a Classical CAN Standard Frame
  *
Signature · 1 line
2.39.2
author maintainer
#10 lore raw

PATCH 9/22 can: ctucanfd: Convert to platform remove callback returning void

In reply to Marc Kleine-Budde

From: Uwe Kleine-König <[email protected]>

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/net/can/ctucanfd/ctucanfd_platform.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/can/ctucanfd/ctucanfd_platform.c +2 -4
index a17561d97192..55bb10b157b4 100644
@@ -86,7 +86,7 @@ static int ctucan_platform_probe(struct platform_device *pdev)
  * This function frees all the resources allocated to the device.
  * Return: 0 always
  */
-static int ctucan_platform_remove(struct platform_device *pdev)
+static void ctucan_platform_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct ctucan_priv *priv = netdev_priv(ndev);
@@ -97,8 +97,6 @@ static int ctucan_platform_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 	netif_napi_del(&priv->napi);
 	free_candev(ndev);
-
-	return 0;
 }
 
 static SIMPLE_DEV_PM_OPS(ctucan_platform_pm_ops, ctucan_suspend, ctucan_resume);
@@ -113,7 +111,7 @@ MODULE_DEVICE_TABLE(of, ctucan_of_match);
 
 static struct platform_driver ctucanfd_driver = {
 	.probe	= ctucan_platform_probe,
-	.remove	= ctucan_platform_remove,
+	.remove_new = ctucan_platform_remove,
 	.driver	= {
 		.name = DRV_NAME,
 		.pm = &ctucan_platform_pm_ops,
Signature · 1 line
2.39.2
author maintainer
#11 lore raw

PATCH 10/22 can: flexcan: Convert to platform remove callback returning void

In reply to Marc Kleine-Budde

From: Uwe Kleine-König <[email protected]>

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/net/can/flexcan/flexcan-core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/can/flexcan/flexcan-core.c +2 -4
index 6d638c93977b..ff0fc18baf13 100644
@@ -2218,7 +2218,7 @@ static int flexcan_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int flexcan_remove(struct platform_device *pdev)
+static void flexcan_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 
@@ -2227,8 +2227,6 @@ static int flexcan_remove(struct platform_device *pdev)
 	unregister_flexcandev(dev);
 	pm_runtime_disable(&pdev->dev);
 	free_candev(dev);
-
-	return 0;
 }
 
 static int __maybe_unused flexcan_suspend(struct device *device)
@@ -2379,7 +2377,7 @@ static struct platform_driver flexcan_driver = {
 		.of_match_table = flexcan_of_match,
 	},
 	.probe = flexcan_probe,
-	.remove = flexcan_remove,
+	.remove_new = flexcan_remove,
 	.id_table = flexcan_id_table,
 };
 
Signature · 1 line
2.39.2
author maintainer
#12 lore raw

PATCH 11/22 can: grcan: Convert to platform remove callback returning void

In reply to Marc Kleine-Budde

From: Uwe Kleine-König <[email protected]>

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/net/can/grcan.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/can/grcan.c +2 -4
index 4bedcc3eea0d..3174efdae271 100644
@@ -1696,7 +1696,7 @@ static int grcan_probe(struct platform_device *ofdev)
 	return err;
 }
 
-static int grcan_remove(struct platform_device *ofdev)
+static void grcan_remove(struct platform_device *ofdev)
 {
 	struct net_device *dev = platform_get_drvdata(ofdev);
 	struct grcan_priv *priv = netdev_priv(dev);
@@ -1706,8 +1706,6 @@ static int grcan_remove(struct platform_device *ofdev)
 	irq_dispose_mapping(dev->irq);
 	netif_napi_del(&priv->napi);
 	free_candev(dev);
-
-	return 0;
 }
 
 static const struct of_device_id grcan_match[] = {
@@ -1726,7 +1724,7 @@ static struct platform_driver grcan_driver = {
 		.of_match_table = grcan_match,
 	},
 	.probe = grcan_probe,
-	.remove = grcan_remove,
+	.remove_new = grcan_remove,
 };
 
 module_platform_driver(grcan_driver);
Signature · 1 line
2.39.2
author maintainer
#13 lore raw

PATCH 12/22 can: ifi_canfd: Convert to platform remove callback returning void

In reply to Marc Kleine-Budde

From: Uwe Kleine-König <[email protected]>

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/net/can/ifi_canfd/ifi_canfd.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/can/ifi_canfd/ifi_canfd.c +2 -4
index 07eaf724a572..1d6642c94f2f 100644
@@ -1013,15 +1013,13 @@ static int ifi_canfd_plat_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int ifi_canfd_plat_remove(struct platform_device *pdev)
+static void ifi_canfd_plat_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 
 	unregister_candev(ndev);
 	platform_set_drvdata(pdev, NULL);
 	free_candev(ndev);
-
-	return 0;
 }
 
 static const struct of_device_id ifi_canfd_of_table[] = {
@@ -1036,7 +1034,7 @@ static struct platform_driver ifi_canfd_plat_driver = {
 		.of_match_table	= ifi_canfd_of_table,
 	},
 	.probe	= ifi_canfd_plat_probe,
-	.remove	= ifi_canfd_plat_remove,
+	.remove_new = ifi_canfd_plat_remove,
 };
 
 module_platform_driver(ifi_canfd_plat_driver);
Signature · 1 line
2.39.2
author maintainer
#14 lore raw

PATCH 13/22 can: janz-ican3: Convert to platform remove callback returning void

In reply to Marc Kleine-Budde

From: Uwe Kleine-König <[email protected]>

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/net/can/janz-ican3.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/can/janz-ican3.c +2 -4
index 0732a5092141..d048ea565b89 100644
@@ -2023,7 +2023,7 @@ static int ican3_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int ican3_remove(struct platform_device *pdev)
+static void ican3_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct ican3_dev *mod = netdev_priv(ndev);
@@ -2042,8 +2042,6 @@ static int ican3_remove(struct platform_device *pdev)
 	iounmap(mod->dpm);
 
 	free_candev(ndev);
-
-	return 0;
 }
 
 static struct platform_driver ican3_driver = {
@@ -2051,7 +2049,7 @@ static struct platform_driver ican3_driver = {
 		.name	= DRV_NAME,
 	},
 	.probe		= ican3_probe,
-	.remove		= ican3_remove,
+	.remove_new	= ican3_remove,
 };
 
 module_platform_driver(ican3_driver);
Signature · 1 line
2.39.2
author maintainer
#15 lore raw

PATCH 14/22 can: m_can: Convert to platform remove callback returning void

In reply to Marc Kleine-Budde

From: Uwe Kleine-König <[email protected]>

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/net/can/m_can/m_can_platform.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/can/m_can/m_can_platform.c +2 -4
index 9c1dcf838006..94dc82644113 100644
@@ -164,7 +164,7 @@ static __maybe_unused int m_can_resume(struct device *dev)
 	return m_can_class_resume(dev);
 }
 
-static int m_can_plat_remove(struct platform_device *pdev)
+static void m_can_plat_remove(struct platform_device *pdev)
 {
 	struct m_can_plat_priv *priv = platform_get_drvdata(pdev);
 	struct m_can_classdev *mcan_class = &priv->cdev;
@@ -172,8 +172,6 @@ static int m_can_plat_remove(struct platform_device *pdev)
 	m_can_class_unregister(mcan_class);
 
 	m_can_class_free_dev(mcan_class->net);
-
-	return 0;
 }
 
 static int __maybe_unused m_can_runtime_suspend(struct device *dev)
@@ -223,7 +221,7 @@ static struct platform_driver m_can_plat_driver = {
 		.pm     = &m_can_pmops,
 	},
 	.probe = m_can_plat_probe,
-	.remove = m_can_plat_remove,
+	.remove_new = m_can_plat_remove,
 };
 
 module_platform_driver(m_can_plat_driver);
Signature · 1 line
2.39.2
author maintainer
#16 lore raw

PATCH 15/22 can: mscan: mpc5xxx_can: Convert to platform remove callback returning void

In reply to Marc Kleine-Budde

From: Uwe Kleine-König <[email protected]>

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/net/can/mscan/mpc5xxx_can.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/can/mscan/mpc5xxx_can.c +2 -4
index b0ed798ae70f..4837df6efa92 100644
@@ -349,7 +349,7 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)
 	return err;
 }
 
-static int mpc5xxx_can_remove(struct platform_device *ofdev)
+static void mpc5xxx_can_remove(struct platform_device *ofdev)
 {
 	const struct of_device_id *match;
 	const struct mpc5xxx_can_data *data;
@@ -365,8 +365,6 @@ static int mpc5xxx_can_remove(struct platform_device *ofdev)
 	iounmap(priv->reg_base);
 	irq_dispose_mapping(dev->irq);
 	free_candev(dev);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM
@@ -437,7 +435,7 @@ static struct platform_driver mpc5xxx_can_driver = {
 		.of_match_table = mpc5xxx_can_table,
 	},
 	.probe = mpc5xxx_can_probe,
-	.remove = mpc5xxx_can_remove,
+	.remove_new = mpc5xxx_can_remove,
 #ifdef CONFIG_PM
 	.suspend = mpc5xxx_can_suspend,
 	.resume = mpc5xxx_can_resume,
Signature · 1 line
2.39.2
author maintainer
#17 lore raw

PATCH 16/22 can: rcar: Convert to platform remove callback returning void

In reply to Marc Kleine-Budde

From: Uwe Kleine-König <[email protected]>

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().

Trivially convert these drivers from always returning zero in the remove callback to the void returning variant.

---
 drivers/net/can/rcar/rcar_can.c   | 5 ++---
 drivers/net/can/rcar/rcar_canfd.c | 6 ++----
 2 files changed, 4 insertions(+), 7 deletions(-)
drivers/net/can/rcar/rcar_can.c +2 -3
index cc43c9c5e38c..f5aa5dbacaf2 100644
@@ -824,7 +824,7 @@ static int rcar_can_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int rcar_can_remove(struct platform_device *pdev)
+static void rcar_can_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct rcar_can_priv *priv = netdev_priv(ndev);
@@ -832,7 +832,6 @@ static int rcar_can_remove(struct platform_device *pdev)
 	unregister_candev(ndev);
 	netif_napi_del(&priv->napi);
 	free_candev(ndev);
-	return 0;
 }
 
 static int __maybe_unused rcar_can_suspend(struct device *dev)
@@ -908,7 +907,7 @@ static struct platform_driver rcar_can_driver = {
 		.pm = &rcar_can_pm_ops,
 	},
 	.probe = rcar_can_probe,
-	.remove = rcar_can_remove,
+	.remove_new = rcar_can_remove,
 };
 
 module_platform_driver(rcar_can_driver);
drivers/net/can/rcar/rcar_canfd.c +2 -4
index 963c42f43755..e4d748913439 100644
@@ -2078,7 +2078,7 @@ static int rcar_canfd_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int rcar_canfd_remove(struct platform_device *pdev)
+static void rcar_canfd_remove(struct platform_device *pdev)
 {
 	struct rcar_canfd_global *gpriv = platform_get_drvdata(pdev);
 	u32 ch;
@@ -2096,8 +2096,6 @@ static int rcar_canfd_remove(struct platform_device *pdev)
 	clk_disable_unprepare(gpriv->clkp);
 	reset_control_assert(gpriv->rstc1);
 	reset_control_assert(gpriv->rstc2);
-
-	return 0;
 }
 
 static int __maybe_unused rcar_canfd_suspend(struct device *dev)
@@ -2130,7 +2128,7 @@ static struct platform_driver rcar_canfd_driver = {
 		.pm = &rcar_canfd_pm_ops,
 	},
 	.probe = rcar_canfd_probe,
-	.remove = rcar_canfd_remove,
+	.remove_new = rcar_canfd_remove,
 };
 
 module_platform_driver(rcar_canfd_driver);
Signature · 1 line
2.39.2
author maintainer
#18 lore raw

PATCH 17/22 can: sja1000_isa: Convert to platform remove callback returning void

In reply to Marc Kleine-Budde

From: Uwe Kleine-König <[email protected]>

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/net/can/sja1000/sja1000_isa.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/can/sja1000/sja1000_isa.c +2 -4
index db3e767d5320..fca5a9a1d857 100644
@@ -223,7 +223,7 @@ static int sja1000_isa_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int sja1000_isa_remove(struct platform_device *pdev)
+static void sja1000_isa_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 	struct sja1000_priv *priv = netdev_priv(dev);
@@ -241,13 +241,11 @@ static int sja1000_isa_remove(struct platform_device *pdev)
 			release_region(port[idx], SJA1000_IOSIZE);
 	}
 	free_sja1000dev(dev);
-
-	return 0;
 }
 
 static struct platform_driver sja1000_isa_driver = {
 	.probe = sja1000_isa_probe,
-	.remove = sja1000_isa_remove,
+	.remove_new = sja1000_isa_remove,
 	.driver = {
 		.name = DRV_NAME,
 	},
Signature · 1 line
2.39.2
author maintainer
#19 lore raw

PATCH 18/22 can: sja1000_platform: Convert to platform remove callback returning void

In reply to Marc Kleine-Budde

From: Uwe Kleine-König <[email protected]>

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/net/can/sja1000/sja1000_platform.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/can/sja1000/sja1000_platform.c +2 -4
index 6779d5357069..b4889b5746e5 100644
@@ -317,19 +317,17 @@ static int sp_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int sp_remove(struct platform_device *pdev)
+static void sp_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 
 	unregister_sja1000dev(dev);
 	free_sja1000dev(dev);
-
-	return 0;
 }
 
 static struct platform_driver sp_driver = {
 	.probe = sp_probe,
-	.remove = sp_remove,
+	.remove_new = sp_remove,
 	.driver = {
 		.name = DRV_NAME,
 		.of_match_table = sp_of_table,
Signature · 1 line
2.39.2
author maintainer
#20 lore raw

PATCH 19/22 can: softing: Convert to platform remove callback returning void

In reply to Marc Kleine-Budde

From: Uwe Kleine-König <[email protected]>

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/net/can/softing/softing_main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/can/softing/softing_main.c +2 -3
index c72f505d29fe..bd25137062c5 100644
@@ -729,7 +729,7 @@ static const struct attribute_group softing_pdev_group = {
 /*
  * platform driver
  */
-static int softing_pdev_remove(struct platform_device *pdev)
+static void softing_pdev_remove(struct platform_device *pdev)
 {
 	struct softing *card = platform_get_drvdata(pdev);
 	int j;
@@ -747,7 +747,6 @@ static int softing_pdev_remove(struct platform_device *pdev)
 
 	iounmap(card->dpram);
 	kfree(card);
-	return 0;
 }
 
 static int softing_pdev_probe(struct platform_device *pdev)
@@ -855,7 +854,7 @@ static struct platform_driver softing_driver = {
 		.name = KBUILD_MODNAME,
 	},
 	.probe = softing_pdev_probe,
-	.remove = softing_pdev_remove,
+	.remove_new = softing_pdev_remove,
 };
 
 module_platform_driver(softing_driver);
Signature · 1 line
2.39.2
author maintainer
#21 lore raw

PATCH 20/22 can: sun4i_can: Convert to platform remove callback returning void

In reply to Marc Kleine-Budde

From: Uwe Kleine-König <[email protected]>

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/net/can/sun4i_can.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/can/sun4i_can.c +2 -4
index 2b78f9197681..0827830bbf28 100644
@@ -791,14 +791,12 @@ static const struct of_device_id sun4ican_of_match[] = {
 
 MODULE_DEVICE_TABLE(of, sun4ican_of_match);
 
-static int sun4ican_remove(struct platform_device *pdev)
+static void sun4ican_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 
 	unregister_netdev(dev);
 	free_candev(dev);
-
-	return 0;
 }
 
 static int sun4ican_probe(struct platform_device *pdev)
@@ -901,7 +899,7 @@ static struct platform_driver sun4i_can_driver = {
 		.of_match_table = sun4ican_of_match,
 	},
 	.probe = sun4ican_probe,
-	.remove = sun4ican_remove,
+	.remove_new = sun4ican_remove,
 };
 
 module_platform_driver(sun4i_can_driver);
Signature · 1 line
2.39.2
author maintainer
#22 lore raw

PATCH 21/22 can: ti_hecc: Convert to platform remove callback returning void

In reply to Marc Kleine-Budde

From: Uwe Kleine-König <[email protected]>

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/net/can/ti_hecc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/can/ti_hecc.c +2 -4
index 27700f72eac2..9bab0b4cc449 100644
@@ -963,7 +963,7 @@ static int ti_hecc_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int ti_hecc_remove(struct platform_device *pdev)
+static void ti_hecc_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct ti_hecc_priv *priv = netdev_priv(ndev);
@@ -973,8 +973,6 @@ static int ti_hecc_remove(struct platform_device *pdev)
 	clk_put(priv->clk);
 	can_rx_offload_del(&priv->offload);
 	free_candev(ndev);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM
@@ -1028,7 +1026,7 @@ static struct platform_driver ti_hecc_driver = {
 		.of_match_table = ti_hecc_dt_ids,
 	},
 	.probe = ti_hecc_probe,
-	.remove = ti_hecc_remove,
+	.remove_new = ti_hecc_remove,
 	.suspend = ti_hecc_suspend,
 	.resume = ti_hecc_resume,
 };
Signature · 1 line
2.39.2
author maintainer
#23 lore raw

PATCH 22/22 can: xilinx: Convert to platform remove callback returning void

In reply to Marc Kleine-Budde

From: Uwe Kleine-König <[email protected]>

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/net/can/xilinx_can.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/can/xilinx_can.c +2 -4
index 43c812ea1de0..797c69a0314d 100644
@@ -1898,20 +1898,18 @@ static int xcan_probe(struct platform_device *pdev)
  * This function frees all the resources allocated to the device.
  * Return: 0 always
  */
-static int xcan_remove(struct platform_device *pdev)
+static void xcan_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 
 	unregister_candev(ndev);
 	pm_runtime_disable(&pdev->dev);
 	free_candev(ndev);
-
-	return 0;
 }
 
 static struct platform_driver xcan_driver = {
 	.probe = xcan_probe,
-	.remove	= xcan_remove,
+	.remove_new = xcan_remove,
 	.driver	= {
 		.name = DRIVER_NAME,
 		.pm = &xcan_dev_pm_ops,
Signature · 1 line
2.39.2