[PATCH 0/3] phy: remove needless usage of module header

From: Paul Gortmaker
Date: Sun Dec 09 2018 - 19:35:18 EST

The most important thing to note here, is these clean-ups make no
changes to the final generated run-time. The 1st commit removes an
unused function, otherwise the generated objects are also unchanged.

The work here represents a scan over the phy dir, looking for files
that have nothing to do with a modular use case, but are using modular
infrastructure regardless.

We are trying to make driver code consistent with the Makefiles/Kconfigs
that control them. This means not using modular functions/macros for
drivers that can never be built as a module. This has been done in quite
a lot of other mainline subsystem dirs already.

Using modular infrastructure in non-modules might seem harmless, but some
of the downfalls this leads to are:

(1) it is easy to accidentally write unused module_exit and remove code
(2) it can be misleading when reading the source, thinking it can be
modular when the Makefile and/or Kconfig prohibit it
(3) it requires the include of the module.h header file which in turn
includes nearly everything else, thus adding to CPP overhead.
(4) it gets copied/replicated into other drivers and spreads quickly.

As a data point for #3 above, an empty C file that just includes the
module.h header generates over 750kB of CPP output. Repeating the same
experiment with init.h and the result is less than 12kB; with export.h
it is only about 1/2kB; with both it still is less than 12kB.

Build tested on x86-64 and ARM-64.


Cc: Andrew Lunn <andrew@xxxxxxx>
Cc: Gregory CLEMENT <gregory.clement@xxxxxxxxxxxxxxxxxx>
Cc: Kishon Vijay Abraham I <kishon@xxxxxx>

Paul Gortmaker (3):
phy: make phy-core explicitly non-modular
phy: make phy-mvebu-sata explicitly non-modular
phy: make phy-armada375-usb2 explicitly non-modular

drivers/phy/marvell/phy-armada375-usb2.c | 8 +-------
drivers/phy/marvell/phy-mvebu-sata.c | 9 ++-------
drivers/phy/phy-core.c | 12 +-----------
3 files changed, 4 insertions(+), 25 deletions(-)