Message ID | 20220603102848.17907-3-mailhol.vincent@wanadoo.fr (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | can: refactoring of can-dev module and of Kbuild | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Series ignored based on subject, async |
On 03.06.2022 19:28:43, Vincent Mailhol wrote: > In the next patches, the software/virtual drivers (slcan, v(x)can) > will depend on drivers/net/can/dev/skb.o. > > This patch changes the scope of the can-dev module to include the > above mentioned drivers. > > To do so, we reuse the menu "CAN Device Drivers" and turn it into a > configmenu using the config symbol CAN_DEV (which we released in > previous patch). Also, add a description to this new CAN_DEV > menuconfig. > > The symbol CAN_DEV now only triggers the build of skb.o. For this > reasons, all the macros from linux/module.h are deported from > drivers/net/can/dev/dev.c to drivers/net/can/dev/skb.c. > > Finally, drivers/net/can/dev/Makefile is adjusted accordingly. > > Suggested-by: Oliver Hartkopp <socketcan@hartkopp.net> > Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> > --- > drivers/net/can/Kconfig | 29 ++++++++++++++++++++++++++--- > drivers/net/can/dev/Makefile | 16 +++++++++------- > drivers/net/can/dev/dev.c | 9 +-------- > drivers/net/can/dev/skb.c | 7 +++++++ > 4 files changed, 43 insertions(+), 18 deletions(-) > > diff --git a/drivers/net/can/dev/Makefile b/drivers/net/can/dev/Makefile > index 5b4c813c6222..919f87e36eed 100644 > --- a/drivers/net/can/dev/Makefile > +++ b/drivers/net/can/dev/Makefile > @@ -1,9 +1,11 @@ > # SPDX-License-Identifier: GPL-2.0 > > -obj-$(CONFIG_CAN_NETLINK) += can-dev.o ^^^^^^^^^^^^^^^^^^^^^ Nitpick: I think you can directly use "y" here. Marc
On Sat. 4 juin 2022 at 20:27, Marc Kleine-Budde <mkl@pengutronix.de> wrote: > On 03.06.2022 19:28:43, Vincent Mailhol wrote: > > In the next patches, the software/virtual drivers (slcan, v(x)can) > > will depend on drivers/net/can/dev/skb.o. > > > > This patch changes the scope of the can-dev module to include the > > above mentioned drivers. > > > > To do so, we reuse the menu "CAN Device Drivers" and turn it into a > > configmenu using the config symbol CAN_DEV (which we released in > > previous patch). Also, add a description to this new CAN_DEV > > menuconfig. > > > > The symbol CAN_DEV now only triggers the build of skb.o. For this > > reasons, all the macros from linux/module.h are deported from > > drivers/net/can/dev/dev.c to drivers/net/can/dev/skb.c. > > > > Finally, drivers/net/can/dev/Makefile is adjusted accordingly. > > > > Suggested-by: Oliver Hartkopp <socketcan@hartkopp.net> > > Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> > > --- > > drivers/net/can/Kconfig | 29 ++++++++++++++++++++++++++--- > > drivers/net/can/dev/Makefile | 16 +++++++++------- > > drivers/net/can/dev/dev.c | 9 +-------- > > drivers/net/can/dev/skb.c | 7 +++++++ > > 4 files changed, 43 insertions(+), 18 deletions(-) > > > > > diff --git a/drivers/net/can/dev/Makefile b/drivers/net/can/dev/Makefile > > index 5b4c813c6222..919f87e36eed 100644 > > --- a/drivers/net/can/dev/Makefile > > +++ b/drivers/net/can/dev/Makefile > > @@ -1,9 +1,11 @@ > > # SPDX-License-Identifier: GPL-2.0 > > > > -obj-$(CONFIG_CAN_NETLINK) += can-dev.o > > +obj-$(CONFIG_CAN_DEV) += can-dev.o > ^^^^^^^^^^^^^^^^^^^^^ > > Nitpick: I think you can directly use "y" here. I see. So the idea would be that if we deselect CONFIG_CAN_DEV, then despite of can-dev.o being always "yes", it would be empty and thus ignored. I just didn't know this trick. I will do as suggested.
On 04.06.2022 21:30:57, Vincent MAILHOL wrote: > > > diff --git a/drivers/net/can/dev/Makefile b/drivers/net/can/dev/Makefile > > > index 5b4c813c6222..919f87e36eed 100644 > > > --- a/drivers/net/can/dev/Makefile > > > +++ b/drivers/net/can/dev/Makefile > > > @@ -1,9 +1,11 @@ > > > # SPDX-License-Identifier: GPL-2.0 > > > > > > -obj-$(CONFIG_CAN_NETLINK) += can-dev.o > > > +obj-$(CONFIG_CAN_DEV) += can-dev.o > > ^^^^^^^^^^^^^^^^^^^^^ > > > > Nitpick: I think you can directly use "y" here. > > I see. So the idea would be that if we deselect CONFIG_CAN_DEV, then > despite of can-dev.o being always "yes", it would be empty and thus > ignored. ACK Marc
My previous mail on this was wrong (as you noticed).... so here's the corrected one (hopefully). On 03.06.2022 19:28:43, Vincent Mailhol wrote: > diff --git a/drivers/net/can/dev/Makefile b/drivers/net/can/dev/Makefile > index 5b4c813c6222..919f87e36eed 100644 > --- a/drivers/net/can/dev/Makefile > +++ b/drivers/net/can/dev/Makefile > @@ -1,9 +1,11 @@ > # SPDX-License-Identifier: GPL-2.0 > > -obj-$(CONFIG_CAN_NETLINK) += can-dev.o > -can-dev-y += bittiming.o > -can-dev-y += dev.o > -can-dev-y += length.o > -can-dev-y += netlink.o > -can-dev-y += rx-offload.o > -can-dev-y += skb.o > +obj-$(CONFIG_CAN_DEV) += can-dev.o > + > +can-dev-$(CONFIG_CAN_DEV) += skb.o ^^^^^^^^^^^^^^^^ As "skb.o" is always part of "can-dev.o" (if build at all), you can use "can-dev-y" here. Marc
diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig index 99f189ad35ad..b1e47f6c5586 100644 --- a/drivers/net/can/Kconfig +++ b/drivers/net/can/Kconfig @@ -1,5 +1,25 @@ # SPDX-License-Identifier: GPL-2.0-only -menu "CAN Device Drivers" + +menuconfig CAN_DEV + tristate "CAN Device Drivers" + default y + help + Controller Area Network (CAN) is serial communications protocol up to + 1Mbit/s for its original release (now known as Classical CAN) and up + to 8Mbit/s for the more recent CAN with Flexible Data-Rate + (CAN-FD). The CAN bus was originally mainly for automotive, but is now + widely used in marine (NMEA2000), industrial, and medical + applications. More information on the CAN network protocol family + PF_CAN is contained in <Documentation/networking/can.rst>. + + This section contains all the CAN(-FD) device drivers including the + virtual ones. If you own such devices or plan to use the virtual CAN + interface to develop applications, say Y here. + + To compile as a module, choose M here: the module will be called + can-dev. + +if CAN_DEV config CAN_VCAN tristate "Virtual Local CAN Interface (vcan)" @@ -49,7 +69,7 @@ config CAN_SLCAN also be built as a module. If so, the module will be called slcan. config CAN_NETLINK - tristate "CAN device drivers with Netlink support" + bool "CAN device drivers with Netlink support" default y help Enables the common framework for CAN device drivers. This is the @@ -57,6 +77,9 @@ config CAN_NETLINK as bittiming validation, support of CAN error states, device restart and others. + The additional features selected by this option will be added to the + can-dev module. + This is required by all platform and hardware CAN drivers. If you plan to use such devices or if unsure, say Y. @@ -178,4 +201,4 @@ config CAN_DEBUG_DEVICES a problem with CAN support and want to see more of what is going on. -endmenu +endif #CAN_DEV diff --git a/drivers/net/can/dev/Makefile b/drivers/net/can/dev/Makefile index 5b4c813c6222..919f87e36eed 100644 --- a/drivers/net/can/dev/Makefile +++ b/drivers/net/can/dev/Makefile @@ -1,9 +1,11 @@ # SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_CAN_NETLINK) += can-dev.o -can-dev-y += bittiming.o -can-dev-y += dev.o -can-dev-y += length.o -can-dev-y += netlink.o -can-dev-y += rx-offload.o -can-dev-y += skb.o +obj-$(CONFIG_CAN_DEV) += can-dev.o + +can-dev-$(CONFIG_CAN_DEV) += skb.o + +can-dev-$(CONFIG_CAN_NETLINK) += bittiming.o +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 diff --git a/drivers/net/can/dev/dev.c b/drivers/net/can/dev/dev.c index 96c9d9db00cf..523eaacfe29e 100644 --- a/drivers/net/can/dev/dev.c +++ b/drivers/net/can/dev/dev.c @@ -4,7 +4,6 @@ * Copyright (C) 2008-2009 Wolfgang Grandegger <wg@grandegger.com> */ -#include <linux/module.h> #include <linux/kernel.h> #include <linux/slab.h> #include <linux/netdevice.h> @@ -17,12 +16,6 @@ #include <linux/gpio/consumer.h> #include <linux/of.h> -#define MOD_DESC "CAN device driver interface" - -MODULE_DESCRIPTION(MOD_DESC); -MODULE_LICENSE("GPL v2"); -MODULE_AUTHOR("Wolfgang Grandegger <wg@grandegger.com>"); - static void can_update_state_error_stats(struct net_device *dev, enum can_state new_state) { @@ -513,7 +506,7 @@ static __init int can_dev_init(void) err = can_netlink_register(); if (!err) - pr_info(MOD_DESC "\n"); + pr_info("CAN device driver interface\n"); return err; } diff --git a/drivers/net/can/dev/skb.c b/drivers/net/can/dev/skb.c index 61660248c69e..a4208f125b76 100644 --- a/drivers/net/can/dev/skb.c +++ b/drivers/net/can/dev/skb.c @@ -5,6 +5,13 @@ */ #include <linux/can/dev.h> +#include <linux/module.h> + +#define MOD_DESC "CAN device driver interface" + +MODULE_DESCRIPTION(MOD_DESC); +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Wolfgang Grandegger <wg@grandegger.com>"); /* Local echo of CAN messages *
In the next patches, the software/virtual drivers (slcan, v(x)can) will depend on drivers/net/can/dev/skb.o. This patch changes the scope of the can-dev module to include the above mentioned drivers. To do so, we reuse the menu "CAN Device Drivers" and turn it into a configmenu using the config symbol CAN_DEV (which we released in previous patch). Also, add a description to this new CAN_DEV menuconfig. The symbol CAN_DEV now only triggers the build of skb.o. For this reasons, all the macros from linux/module.h are deported from drivers/net/can/dev/dev.c to drivers/net/can/dev/skb.c. Finally, drivers/net/can/dev/Makefile is adjusted accordingly. Suggested-by: Oliver Hartkopp <socketcan@hartkopp.net> Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> --- drivers/net/can/Kconfig | 29 ++++++++++++++++++++++++++--- drivers/net/can/dev/Makefile | 16 +++++++++------- drivers/net/can/dev/dev.c | 9 +-------- drivers/net/can/dev/skb.c | 7 +++++++ 4 files changed, 43 insertions(+), 18 deletions(-)