Skip to content

drivers/pci: avoid module_init in non-modular host/pci*

Paul Gortmaker linux-arm-kernel linux-omap linux-pci linux-sh linux-tegra lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest10 patches 22 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10drivers/pci: make host/pci-imx6.c driver explicitly non-modulardrivers/pci/host/pci-imx6.c+4 -81 reply
2/10drivers/pci: make host/pcie-spear13xx.c driver explicitly non-modulardrivers/pci/host/pcie-spear13xx.c+3 -70 replies
3/10drivers/pci: make host/pci-mvebu.c explicitly non-modulardrivers/pci/host/pci-mvebu.c+4 -72 replies
4/10drivers/pci: make host/pci-dra7xx.c explicitly non-modulardrivers/pci/host/pci-dra7xx.c+3 -280 replies
5/10drivers/pci: make host/pci-rcar-gen2.c explicitly non-modulardrivers/pci/host/pci-rcar-gen2.c+3 -94 replies
6/10drivers/pci: make host/pci-tegra.c explicitly non-modulardrivers/pci/host/pci-tegra.c+4 -71 reply
7/10drivers/pci: make host/pcie-rcar.c explicitly non-modulardrivers/pci/host/pcie-rcar.c+4 -75 replies
8/10drivers/pci: make host/pcie-xilinx.c explicitly non-modulardrivers/pci/host/pcie-xilinx.c+2 -511 reply
9/10drivers/pci: make host/pci-keystone.c explicitly non-modulardrivers/pci/host/pci-keystone.c+3 -180 replies
10/10drivers/pci: make host/pcie-altera.c explicitly non-modulardrivers/pci/host/pcie-altera.c+5 -70 replies

Reviews trailers per patch

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

PatchThomas PetazzoniSimon HormanMichal SimekPhil Edworthy
1/10
2/10
3/10R-b
4/10
5/10A-b
6/10
7/10A-b A-b
8/10A-b
9/10
10/10

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

Read the v1 thread

Cover letter [PATCH 00/10] drivers/pci: avoid module_init in non-modular host/pci*

This series of commits is a slice of a larger project to ensure people don't have dead code for module removal in non-modular drivers. Overall there was roughly 5k lines of dead code in the kernel due to this. So far we've fixed several areas, like tty, x86, net, etc. and we continue to work on other areas.

There are several reasons to not use module_init for code that can never be built as a module, but the big ones are:

(1) it is easy to accidentally code up 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.

Here we convert some module_init() calls into device_initcall() and delete any module_exit and remove code that gets orphaned in the process, for an overall net code reduction, which is always welcome.

The use of device_initcall ensures that the init function ordering remains unchanged, but one could argue that PCI host code might be more appropriate to be handled under subsys_initcall. Fortunately we can revisit making this extra change at a later date if desired; it does not need to happen now, and we reduce the risk of introducing regressions at this point in time by separating the two changes.

Over half of the drivers changed here already explicitly disallowed any unbind operations. For the rest we make them the same, since there is not really any sensible use case to unbind any built-in bus support that I can think of.

I have more "avoid module usage in non-modular code" cleanups for the PCI subsystem, but these all have a common theme and it makes for a more maintainer friendly series size to just ask to digest these 1st.

Testing was done on linux-next, using an ARCH=arm allmodconfig and then explicitly building the files changed in this series. If desired, I can provide a v4.4-rc4 based branch for merging vs e-mail processing, since I don't think the underlying baseline is overly important for this (largely trivial) series of patches.

Paul.
---

Cc Alexandre Courbot <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Kishon Vijay Abraham I <[email protected]>
Cc Ley Foon Tan <[email protected]>
Cc Lucas Stach <[email protected]>
Cc Michal Simek <[email protected]>
Cc Murali Karicheri <[email protected]>
Cc Pratyush Anand <[email protected]>
Cc Richard Zhu <[email protected]>
Cc Simon Horman <[email protected]>
Cc "S?ren Brinkmann" <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Thierry Reding <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc linux-omap at vger.kernel.org
Cc linux-pci at vger.kernel.org
Cc linux-sh at vger.kernel.org
Cc linux-tegra at vger.kernel.org
Cc rfi at lists.rocketboards.org

Paul Gortmaker (10):
drivers/pci: make host/pci-imx6.c driver explicitly non-modular drivers/pci: make host/pcie-spear13xx.c driver explicitly non-modular drivers/pci: make host/pci-mvebu.c explicitly non-modular drivers/pci: make host/pci-dra7xx.c explicitly non-modular drivers/pci: make host/pci-rcar-gen2.c explicitly non-modular drivers/pci: make host/pci-tegra.c explicitly non-modular drivers/pci: make host/pcie-rcar.c explicitly non-modular drivers/pci: make host/pcie-xilinx.c explicitly non-modular drivers/pci: make host/pci-keystone.c explicitly non-modular drivers/pci: make host/pcie-altera.c explicitly non-modular

 drivers/pci/host/pci-dra7xx.c     | 31 +++--------------------
 drivers/pci/host/pci-imx6.c       | 12 +++------
 drivers/pci/host/pci-keystone.c   | 21 +++-------------
 drivers/pci/host/pci-mvebu.c      | 11 +++-----
 drivers/pci/host/pci-rcar-gen2.c  | 12 +++------
 drivers/pci/host/pci-tegra.c      | 11 +++-----
 drivers/pci/host/pcie-altera.c    | 12 ++++-----
 drivers/pci/host/pcie-rcar.c      | 11 +++-----
 drivers/pci/host/pcie-spear13xx.c | 10 +++-----
 drivers/pci/host/pcie-xilinx.c    | 53 ++-------------------------------------
 10 files changed, 35 insertions(+), 149 deletions(-)
Signature · 1 line
2.6.1