Commit 5597f082 authored by Marc Kleine-Budde's avatar Marc Kleine-Budde

can: bittiming: mark function arguments and local variables as const

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

Link: https://lore.kernel.org/all/20220124215642.3474154-7-mkl@pengutronix.deSigned-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 5b60d334
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
*/ */
static int static int
can_update_sample_point(const struct can_bittiming_const *btc, 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 *tseg1_ptr, unsigned int *tseg2_ptr,
unsigned int *sample_point_error_ptr) unsigned int *sample_point_error_ptr)
{ {
...@@ -63,7 +63,7 @@ can_update_sample_point(const struct can_bittiming_const *btc, ...@@ -63,7 +63,7 @@ can_update_sample_point(const struct can_bittiming_const *btc,
return best_sample_point; 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) const struct can_bittiming_const *btc)
{ {
struct can_priv *priv = netdev_priv(dev); 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, ...@@ -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 * prescaler value brp. You can find more information in the header
* file linux/can/netlink.h. * 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) 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; unsigned int tseg1, alltseg;
u64 brp64; u64 brp64;
...@@ -244,7 +244,7 @@ static int can_fixup_bittiming(struct net_device *dev, struct can_bittiming *bt, ...@@ -244,7 +244,7 @@ static int can_fixup_bittiming(struct net_device *dev, struct can_bittiming *bt,
/* Checks the validity of predefined bitrate settings */ /* Checks the validity of predefined bitrate settings */
static int 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 u32 *bitrate_const,
const unsigned int bitrate_const_cnt) const unsigned int bitrate_const_cnt)
{ {
...@@ -258,7 +258,7 @@ can_validate_bitrate(struct net_device *dev, struct can_bittiming *bt, ...@@ -258,7 +258,7 @@ can_validate_bitrate(struct net_device *dev, struct can_bittiming *bt,
return -EINVAL; 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 struct can_bittiming_const *btc,
const u32 *bitrate_const, const u32 *bitrate_const,
const unsigned int bitrate_const_cnt) const unsigned int bitrate_const_cnt)
......
...@@ -113,7 +113,7 @@ struct can_tdc_const { ...@@ -113,7 +113,7 @@ struct can_tdc_const {
}; };
#ifdef CONFIG_CAN_CALC_BITTIMING #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); const struct can_bittiming_const *btc);
void can_calc_tdco(struct can_tdc *tdc, const struct can_tdc_const *tdc_const, 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, ...@@ -121,7 +121,7 @@ void can_calc_tdco(struct can_tdc *tdc, const struct can_tdc_const *tdc_const,
u32 *ctrlmode, u32 ctrlmode_supported); u32 *ctrlmode, u32 ctrlmode_supported);
#else /* !CONFIG_CAN_CALC_BITTIMING */ #else /* !CONFIG_CAN_CALC_BITTIMING */
static inline int 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) const struct can_bittiming_const *btc)
{ {
netdev_err(dev, "bit-timing calculation not available\n"); 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, ...@@ -136,7 +136,7 @@ can_calc_tdco(struct can_tdc *tdc, const struct can_tdc_const *tdc_const,
} }
#endif /* CONFIG_CAN_CALC_BITTIMING */ #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 struct can_bittiming_const *btc,
const u32 *bitrate_const, const u32 *bitrate_const,
const unsigned int bitrate_const_cnt); const unsigned int bitrate_const_cnt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment