Skip to content

drivers/bus: remove unused modular code from non-modular drivers

Paul Gortmaker linux-arm-kernel lkml 1 version NAK

Status from this message: NAK.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 11 repliesNAK

Patches in v1

#Subject and filesSizeRepliesApplied
1/4drivers/bus: make brcmstb_gisb.c driver explicitly non-modulardrivers/bus/brcmstb_gisb.c+1 -32 replies
2/4drivers/bus: make imx-weim.c explicitly non-modulardrivers/bus/imx-weim.c+2 -71 reply
3/4drivers/bus: make simple-pm-bus.c explicitly non-modulardrivers/bus/simple-pm-bus.c+5 -172 replies
4/4drivers/bus: make arm-ccn.c driver explicitly non-modulardrivers/bus/arm-ccn.c+5 -365 replies

Reviews trailers per patch

2 of 4 patches have a Reviewed-by or Acked-by.

PatchBrian NorrisShawn GuoFlorian Fainelli
1/4A-b A-b
2/4A-b
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [PATCH 0/4] drivers/bus: remove unused modular code from non-modular drivers

The drivers/bus doesn't have a strict maintainer entry, but since all the changes here are for ARM platforms, I'm Cc'ing arm-kernel and hoping it makes sense to vector these few changes through the arm-soc. [Olof, Will, Arnd? Seems you guys handle most of it...]

My ongoing audit looking for non-modular code that needlessly uses modular macros (vs. built-in equivalents) and/or has dead code relating to module unloading that can never be executed led to the creation of these four commits.

Two are of the trivial kind, where we substitute in the non-modular versions that CPP would have put in place anyway, resulting in no actual changes, even at the binary output level.

The other two are of the kind where there was a ".remove" function registered into the driver struct. Being non-modular, these functions will never be called via a normal module_exit path.

However, since it was possible (but largely pointless, and without a real use case) to unbind these drivers via sysfs, we explicitly disallow the unbind as part of the removal of the ".remove" itself.

For anyone new to the underlying goal of this cleanup, we are trying to not use module support for code that can never be built as a module since:

(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 code and spreads like weeds.

Build tested for arm and arm64 on v4.6-rc1 to ensure no silly typos that would break compilation crept in.

---

Cc Alison Chaiken <[email protected]>
Cc Brian Norris <[email protected]>
Cc Florian Fainelli <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Gregory Fong <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Pawel Moll <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Simon Horman <[email protected]>
Cc Wolfram Sang <[email protected]>
Cc linux-arm-kernel at lists.infradead.org

Paul Gortmaker (4):
drivers/bus: make brcmstb_gisb.c driver explicitly non-modular drivers/bus: make imx-weim.c explicitly non-modular drivers/bus: make simple-pm-bus.c explicitly non-modular drivers/bus: make arm-ccn.c driver explicitly non-modular

 drivers/bus/arm-ccn.c       | 41 +++++------------------------------------
 drivers/bus/brcmstb_gisb.c  |  4 +---
 drivers/bus/imx-weim.c      |  9 ++-------
 drivers/bus/simple-pm-bus.c | 22 +++++-----------------
 4 files changed, 13 insertions(+), 63 deletions(-)
Signature · 1 line
2.6.1