On 03.06.2022 19:28:44, Vincent Mailhol wrote:
> The canonical way to select or deselect an object during compilation
> is to use this pattern in the relevant Makefile:
>
> bar-$(CONFIG_FOO) := foo.o
>
> bittiming.c instead uses some #ifdef CONFIG_CAN_CALC_BITTIMG.
>
> Create a new file named calc_bittiming.c with all the functions which
> are conditionally compiled with CONFIG_CAN_CALC_BITTIMG and modify the
> Makefile according to above pattern.
>
> Signed-off-by: Vincent Mailhol <[email protected]>
> ---
> drivers/net/can/Kconfig | 4 +
> drivers/net/can/dev/Makefile | 2 +
> drivers/net/can/dev/bittiming.c | 197 --------------------------
> drivers/net/can/dev/calc_bittiming.c | 202 +++++++++++++++++++++++++++
> 4 files changed, 208 insertions(+), 197 deletions(-)
> create mode 100644 drivers/net/can/dev/calc_bittiming.c
>
> diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig
> index b1e47f6c5586..8f3b97aea638 100644
> --- a/drivers/net/can/Kconfig
> +++ b/drivers/net/can/Kconfig
> @@ -96,6 +96,10 @@ config CAN_CALC_BITTIMING
> source clock frequencies. Disabling saves some space, but then the
> bit-timing parameters must be specified directly using the Netlink
> arguments "tq", "prop_seg", "phase_seg1", "phase_seg2" and "sjw".
> +
> + The additional features selected by this option will be added to the
> + can-dev module.
> +
> If unsure, say Y.
>
> config CAN_AT91
> diff --git a/drivers/net/can/dev/Makefile b/drivers/net/can/dev/Makefile
> index 919f87e36eed..b8a55b1d90cd 100644
> --- a/drivers/net/can/dev/Makefile
> +++ b/drivers/net/can/dev/Makefile
> @@ -9,3 +9,5 @@ can-dev-$(CONFIG_CAN_NETLINK) += dev.o
> can-dev-$(CONFIG_CAN_NETLINK) += length.o
> can-dev-$(CONFIG_CAN_NETLINK) += netlink.o
> can-dev-$(CONFIG_CAN_NETLINK) += rx-offload.o
> +
> +can-dev-$(CONFIG_CAN_CALC_BITTIMING) += calc_bittiming.o
Nitpick:
Can we keep this list sorted?
Marc
--
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 |