diff options
| author | Vincent Mailhol <mailhol@kernel.org> | 2025-09-23 09:37:09 +0300 | 
|---|---|---|
| committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2025-09-23 11:04:58 +0300 | 
| commit | 7c7da8aa3fd69b77e8efaa14b80bddd948547739 (patch) | |
| tree | a0babc72da6f587b05c4078c0b19405f72629588 /drivers/net/can/dev/dev.c | |
| parent | c67732d067860850b767c81736b49f88a946bffb (diff) | |
| download | linux-7c7da8aa3fd69b77e8efaa14b80bddd948547739.tar.xz | |
can: dev: turn can_set_static_ctrlmode() into a non-inline function
can_set_static_ctrlmode() is declared as a static inline. But it is
only called in the probe function of the devices and so does not
really benefit from any kind of optimization.
Transform it into a "normal" function by moving it to
  drivers/net/can/dev/dev.c
Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
Link: https://patch.msgid.link/20250923-can-fix-mtu-v3-2-581bde113f52@kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/dev/dev.c')
| -rw-r--r-- | drivers/net/can/dev/dev.c | 21 | 
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/net/can/dev/dev.c b/drivers/net/can/dev/dev.c index 99b78cbb2252..02bfed37cc93 100644 --- a/drivers/net/can/dev/dev.c +++ b/drivers/net/can/dev/dev.c @@ -347,6 +347,27 @@ int can_change_mtu(struct net_device *dev, int new_mtu)  }  EXPORT_SYMBOL_GPL(can_change_mtu); +/* helper to define static CAN controller features at device creation time */ +int can_set_static_ctrlmode(struct net_device *dev, u32 static_mode) +{ +	struct can_priv *priv = netdev_priv(dev); + +	/* alloc_candev() succeeded => netdev_priv() is valid at this point */ +	if (priv->ctrlmode_supported & static_mode) { +		netdev_warn(dev, +			    "Controller features can not be supported and static at the same time\n"); +		return -EINVAL; +	} +	priv->ctrlmode = static_mode; + +	/* override MTU which was set by default in can_setup()? */ +	if (static_mode & CAN_CTRLMODE_FD) +		dev->mtu = CANFD_MTU; + +	return 0; +} +EXPORT_SYMBOL_GPL(can_set_static_ctrlmode); +  /* generic implementation of netdev_ops::ndo_eth_ioctl for CAN devices   * supporting hardware timestamps   */  | 
