Re: [PATCH] comedi: Make ni_mio_common a standalone module

From: Greg Kroah-Hartman
Date: Fri May 21 2021 - 14:14:42 EST


On Fri, May 21, 2021 at 07:27:50PM +0200, Uwe Kleine-König wrote:
> This allows to get rid of the ugly
>
> #include "ni_mio_common.c"
>
> in three modules.
>
> For an amd64 allmodconfig this changed the size for the following object
> files:
> | before | after
> drivers/comedi/drivers/ni_atmio.o | 323944 | 20752
> drivers/comedi/drivers/ni_mio_cs.o | 318376 | 14920
> drivers/comedi/drivers/ni_mio_common.o | - | 324872
> drivers/comedi/drivers/ni_pcimio.o | 389344 | 48168
> ---------------------------------------+---------+-------
> sum | 1031664 | 408712
>
> So this results in a considerable decrease in binary size of more than
> 600 KiB.

Very nice!

One tiny nit that I can see that might matter later on (not now):

> @@ -168,6 +173,7 @@ static const struct comedi_lrange range_ni_E_ao_ext = {
> RANGE_ext(0, 1)
> }
> };
> +EXPORT_SYMBOL_GPL(range_ni_E_ao_ext);

not the nicest global symbol, ideally these would all start with:
comedi_ni_...

Oh wait, use the module namespace here! Make a namespace for the NI
comedi drivers to use and then we don't care so much about the names
(within reason, 'allyesconfig' builds still will care).

But that's an add-on patch, not needed here.

thanks,

greg k-h