lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220604124139.pg2h33zanyqs54q5@pengutronix.de>
Date:   Sat, 4 Jun 2022 14:41:39 +0200
From:   Marc Kleine-Budde <mkl@...gutronix.de>
To:     Vincent MAILHOL <mailhol.vincent@...adoo.fr>
Cc:     linux-can@...r.kernel.org, linux-kernel@...r.kernel.org,
        Max Staudt <max@...as.org>,
        Oliver Hartkopp <socketcan@...tkopp.net>,
        netdev@...r.kernel.org
Subject: Re: [PATCH v4 3/7] can: bittiming: move bittiming calculation
 functions to calc_bittiming.c

On 04.06.2022 21:21:01, Vincent MAILHOL wrote:
> On Sat. 4 June 2022 at 20:25, Marc Kleine-Budde <mkl@...gutronix.de> wrote:
> > 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 <mailhol.vincent@...adoo.fr>
> > > ---
> > >  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?
> 
> My idea was first to group per CONFIG symbol according to the
> different levels: CAN_DEV first, then CAN_NETLINK and finally
> CAN_CALC_BITTIMING and CAN_RX_OFFLOAD. And then only sort by
> alphabetical order within each group.

I was thinking to order by CONFIG symbol and put the objects without an
additional symbol first

> By sorting the list, do literally mean to sort each line like this:
> 
> obj-$(CONFIG_CAN_DEV) += can-dev.o
> can-dev-$(CONFIG_CAN_CALC_BITTIMING) += calc_bittiming.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_RX_OFFLOAD) += rx-offload.o

...which results in:

obj-$(CONFIG_CAN_DEV) += can-dev.o

can-dev-y += skb.o

can-dev-$(CONFIG_CAN_CALC_BITTIMING) += calc_bittiming.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_RX_OFFLOAD) += rx-offload.o

> or do you mean to sort by object name (ignoring the config symbol) like that:
> 
> obj-$(CONFIG_CAN_DEV) += can-dev.o
> can-dev-$(CONFIG_CAN_NETLINK) += bittiming.o
> can-dev-$(CONFIG_CAN_CALC_BITTIMING) += calc_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_RX_OFFLOAD) += rx-offload.o
> can-dev-$(CONFIG_CAN_DEV) += skb.o
> 
> ?
> 
> (I honestly do not care so much how we sort the lines. My logic of
> grouping first by CONFIG symbols seems more natural, but I am fine to
> go with any other suggestion).

I think this makes it clear where new files should be added.

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 |

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ