Skip to contentSkip to conversation

staging: make non-modular code explicitly non-modular

PATCH New Paul Gortmaker 1 participant 2 messages Oct 11, 2015 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover staging: make non-modular code explicitly non-modular

In a previous merge window, we made changes to allow better delineation between modular and non-modular code in commit 0fd972a7d91d6e15393c449492a04d94c0b89351 ("module: relocate module_init from init.h to module.h"). This allows us to now ensure module code looks modular and non-modular code does not accidentally look modular just to avoid suffering build breakage.

Here we target code that is, by nature of their Makefile and/or Kconfig settings, only available to be built-in, but implicitly presenting itself as being possibly modular by way of using modular headers, macros, and functions.

The goal here is to remove that illusion of modularity from these files, but in a way that leaves the actual runtime unchanged. In doing so, we remove code that has never been tested and adds no value to the tree. And we continue the process of expecting a level of consistency between the Kconfig/Makefile of code and the code in use itself.

There are two exceptions to unchanged runtime here: The first is in emxx_udc.c driver: one previously could use sysfs to unbind the driver which would try and use a .remove function that the linker should have dropped as it was __exit. We simply disable unbind/bind for this driver. The second is for Tegra ION memory manager; it clearly was intended to be tristate but the makefile did not allow it to be; that is now fixed.

Build tested on staging-testing from Sat, on ARM, since the majority of drivers here are Android related.

Paul.
--

Cc Alexandre Courbot <[email protected]>
Cc "Arve Hjønnevåg" <[email protected]>
Cc Chris Rorvick <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc "Gujulan Elango, Hari Prasath (H.)" <[email protected]>
Cc Haneen Mohammed <[email protected]>
Cc Markus Elfring <[email protected]>
Cc Peter Chen <[email protected]>
Cc Riley Andrews <[email protected]>
Cc Roberta Dobrescu <[email protected]>
Cc Robert Baldyga <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Tapasweni Pathak <[email protected]>
Cc Thierry Reding <[email protected]>
Cc Vincenzo Scotti <[email protected]>
Signature · 21 lines
2.6.1
Paul Gortmaker (7):
  drivers/staging: make android ashmem.c explicitly non-modular
  drivers/staging: make android ion_page_pool.c explicitly non-modular
  drivers/staging: make android tegra_ion.c properly tristate
  drivers/staging: make android sw_sync.c explicitly non-modular
  drivers/staging: make android lowmemorykiller.c explicitly non-modular
  drivers/staging: make android timed_output.c explicitly non-modular
  drivers/staging: make emxx_udc.c explicitly non-modular

 drivers/staging/android/ashmem.c            | 20 +++-------------
 drivers/staging/android/ion/ion_page_pool.c | 10 ++------
 drivers/staging/android/ion/tegra/Makefile  |  2 +-
 drivers/staging/android/lowmemorykiller.c   | 18 ++++++--------
 drivers/staging/android/sw_sync.c           | 11 ++-------
 drivers/staging/android/timed_output.c      | 16 +++----------
 drivers/staging/emxx_udc/emxx_udc.c         | 37 ++++-------------------------
 7 files changed, 22 insertions(+), 92 deletions(-)

-- 
2.6.1

A message that is not in the archive (sent off-list or not yet received): 1444592854-30683-1-git-send-email-paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org

#2 lore raw

PATCH 3/7 drivers/staging: make android tegra_ion.c properly tristate

The Kconfig currently controlling compilation of this code is:

drivers/staging/android/ion/Kconfig:config ION_TEGRA
drivers/staging/android/ion/Kconfig: tristate "Ion for Tegra"

...which led me to incorrectly conclude this file was built modular earlier. However the above CONFIG is just used to enter the dir and once we do enter that dir, we see the build is unconditional:

drivers/staging/android/ion/Makefile:obj-$(CONFIG_ION_TEGRA) += tegra/ drivers/staging/android/ion/tegra/Makefile:obj-y += tegra_ion.o

...meaning that it currently is not being built as a module by anyone.

However, given that the Kconfig did explicitly choose tristate, and that the dummy ion driver is (functionally) tristate, I chose to make the Makefile do the right thing for it to build as a module.

After this change, on an ARM allmodconfig, we see:

CC [M] drivers/staging/android/ion/tegra/tegra_ion.o

so it does build OK as a module. I can't vouch for the modular functionality however, so consider this compile tested only.

Cc Greg Kroah-Hartman <[email protected]>
Cc "Arve Hjønnevåg" <[email protected]>
Cc Riley Andrews <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Thierry Reding <[email protected]>
Cc Alexandre Courbot <[email protected]>
Cc Markus Elfring <[email protected]>
---
 drivers/staging/android/ion/tegra/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/ion/tegra/Makefile +1 -1
index 11cd003fb08f..808f1f53f11a 100644
@@ -1 +1 @@
-obj-y += tegra_ion.o
+obj-$(CONFIG_ION_TEGRA) += tegra_ion.o
Signature · 1 line
2.6.1