public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] staging: make non-modular code explicitly non-modular
@ 2015-10-11 23:03 Paul Gortmaker
  2015-10-11 23:03 ` [PATCH 1/7] drivers/staging: make android ashmem.c " Paul Gortmaker
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Paul Gortmaker @ 2015-10-11 23:03 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Paul Gortmaker, Alexandre Courbot,
	Arve Hjønnevåg, Chris Rorvick, Felipe Balbi,
	Gujulan Elango, Hari Prasath (H.), Haneen Mohammed,
	Markus Elfring, Peter Chen, Riley Andrews, Roberta Dobrescu,
	Robert Baldyga, Stephen Warren, Tapasweni Pathak, Thierry Reding,
	Vincenzo Scotti, devel, linux-tegra

[resending; forgot to add lkml to Cc: -- sorry for those who get this 2x]

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 <gnurou@gmail.com>
Cc: "Arve Hjønnevåg" <arve@android.com>
Cc: Chris Rorvick <chris@rorvick.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Gujulan Elango, Hari Prasath (H.)" <hgujulan@visteon.com>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Cc: Markus Elfring <elfring@users.sourceforge.net>
Cc: Peter Chen <peter.chen@freescale.com>
Cc: Riley Andrews <riandrews@android.com>
Cc: Roberta Dobrescu <roberta.dobrescu@gmail.com>
Cc: Robert Baldyga <r.baldyga@samsung.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Tapasweni Pathak <tapaswenipathak@gmail.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Vincenzo Scotti <vinc94@gmail.com>
Cc: devel@driverdev.osuosl.org
Cc: linux-tegra@vger.kernel.org

-- 
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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/7] drivers/staging: make android ashmem.c explicitly non-modular
  2015-10-11 23:03 [PATCH 0/7] staging: make non-modular code explicitly non-modular Paul Gortmaker
@ 2015-10-11 23:03 ` Paul Gortmaker
  2015-10-11 23:03 ` [PATCH 2/7] drivers/staging: make android ion_page_pool.c " Paul Gortmaker
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Paul Gortmaker @ 2015-10-11 23:03 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Paul Gortmaker, Arve Hjønnevåg,
	Riley Andrews, devel

The Kconfig currently controlling compilation of this code is:

drivers/staging/android/Kconfig:config ASHMEM
drivers/staging/android/Kconfig:        bool "Enable the Anonymous Shared Memory Subsystem"

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

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.

We replace module.h with init.h and export.h ; the latter since this
file uses the global THIS_MODULE.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Arve Hjønnevåg" <arve@android.com>
Cc: Riley Andrews <riandrews@android.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/staging/android/ashmem.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
index f7f8c811af22..3f2a3d611e4b 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -18,7 +18,8 @@
 
 #define pr_fmt(fmt) "ashmem: " fmt
 
-#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/export.h>
 #include <linux/file.h>
 #include <linux/fs.h>
 #include <linux/falloc.h>
@@ -860,19 +861,4 @@ static int __init ashmem_init(void)
 
 	return 0;
 }
-
-static void __exit ashmem_exit(void)
-{
-	unregister_shrinker(&ashmem_shrinker);
-
-	misc_deregister(&ashmem_misc);
-	kmem_cache_destroy(ashmem_range_cachep);
-	kmem_cache_destroy(ashmem_area_cachep);
-
-	pr_info("unloaded\n");
-}
-
-module_init(ashmem_init);
-module_exit(ashmem_exit);
-
-MODULE_LICENSE("GPL");
+device_initcall(ashmem_init);
-- 
2.6.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/7] drivers/staging: make android ion_page_pool.c explicitly non-modular
  2015-10-11 23:03 [PATCH 0/7] staging: make non-modular code explicitly non-modular Paul Gortmaker
  2015-10-11 23:03 ` [PATCH 1/7] drivers/staging: make android ashmem.c " Paul Gortmaker
@ 2015-10-11 23:03 ` Paul Gortmaker
  2015-10-11 23:03 ` [PATCH 3/7] drivers/staging: make android tegra_ion.c properly tristate Paul Gortmaker
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Paul Gortmaker @ 2015-10-11 23:03 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Paul Gortmaker, Arve Hjønnevåg,
	Riley Andrews, devel

The Kconfig currently controlling compilation of this code is:

drivers/staging/android/ion/Kconfig:menuconfig ION
drivers/staging/android/ion/Kconfig:    bool "Ion Memory Manager"

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

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Arve Hjønnevåg" <arve@android.com>
Cc: Riley Andrews <riandrews@android.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/staging/android/ion/ion_page_pool.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/android/ion/ion_page_pool.c b/drivers/staging/android/ion/ion_page_pool.c
index 19ad3aba499a..fd7e23e0c06e 100644
--- a/drivers/staging/android/ion/ion_page_pool.c
+++ b/drivers/staging/android/ion/ion_page_pool.c
@@ -19,7 +19,7 @@
 #include <linux/err.h>
 #include <linux/fs.h>
 #include <linux/list.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/swap.h>
 #include "ion_priv.h"
@@ -174,10 +174,4 @@ static int __init ion_page_pool_init(void)
 {
 	return 0;
 }
-
-static void __exit ion_page_pool_exit(void)
-{
-}
-
-module_init(ion_page_pool_init);
-module_exit(ion_page_pool_exit);
+device_initcall(ion_page_pool_init);
-- 
2.6.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/7] drivers/staging: make android tegra_ion.c properly tristate
  2015-10-11 23:03 [PATCH 0/7] staging: make non-modular code explicitly non-modular Paul Gortmaker
  2015-10-11 23:03 ` [PATCH 1/7] drivers/staging: make android ashmem.c " Paul Gortmaker
  2015-10-11 23:03 ` [PATCH 2/7] drivers/staging: make android ion_page_pool.c " Paul Gortmaker
@ 2015-10-11 23:03 ` Paul Gortmaker
  2015-10-11 23:03 ` [PATCH 4/7] drivers/staging: make android sw_sync.c explicitly non-modular Paul Gortmaker
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Paul Gortmaker @ 2015-10-11 23:03 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Paul Gortmaker, Arve Hjønnevåg,
	Riley Andrews, Stephen Warren, Thierry Reding, Alexandre Courbot,
	Markus Elfring, devel, linux-tegra

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 <gregkh@linuxfoundation.org>
Cc: "Arve Hjønnevåg" <arve@android.com>
Cc: Riley Andrews <riandrews@android.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Markus Elfring <elfring@users.sourceforge.net>
Cc: devel@driverdev.osuosl.org
Cc: linux-tegra@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/staging/android/ion/tegra/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/tegra/Makefile b/drivers/staging/android/ion/tegra/Makefile
index 11cd003fb08f..808f1f53f11a 100644
--- a/drivers/staging/android/ion/tegra/Makefile
+++ b/drivers/staging/android/ion/tegra/Makefile
@@ -1 +1 @@
-obj-y += tegra_ion.o
+obj-$(CONFIG_ION_TEGRA) += tegra_ion.o
-- 
2.6.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/7] drivers/staging: make android sw_sync.c explicitly non-modular
  2015-10-11 23:03 [PATCH 0/7] staging: make non-modular code explicitly non-modular Paul Gortmaker
                   ` (2 preceding siblings ...)
  2015-10-11 23:03 ` [PATCH 3/7] drivers/staging: make android tegra_ion.c properly tristate Paul Gortmaker
@ 2015-10-11 23:03 ` Paul Gortmaker
  2015-10-11 23:03 ` [PATCH 5/7] drivers/staging: make android lowmemorykiller.c " Paul Gortmaker
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Paul Gortmaker @ 2015-10-11 23:03 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Paul Gortmaker, Arve Hjønnevåg,
	Riley Andrews, devel

The Kconfig currently controlling compilation of this code is:

staging/android/Kconfig:config SW_SYNC
staging/android/Kconfig:        bool "Software synchronization objects"

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

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Arve Hjønnevåg" <arve@android.com>
Cc: Riley Andrews <riandrews@android.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/staging/android/sw_sync.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c
index 29b5c3567180..c4ff1679ebbc 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -15,11 +15,11 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <linux/export.h>
 #include <linux/file.h>
 #include <linux/fs.h>
 #include <linux/miscdevice.h>
-#include <linux/module.h>
 #include <linux/syscalls.h>
 #include <linux/uaccess.h>
 
@@ -255,13 +255,6 @@ static int __init sw_sync_device_init(void)
 {
 	return misc_register(&sw_sync_dev);
 }
-
-static void __exit sw_sync_device_remove(void)
-{
-	misc_deregister(&sw_sync_dev);
-}
-
-module_init(sw_sync_device_init);
-module_exit(sw_sync_device_remove);
+device_initcall(sw_sync_device_init);
 
 #endif /* CONFIG_SW_SYNC_USER */
-- 
2.6.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/7] drivers/staging: make android lowmemorykiller.c explicitly non-modular
  2015-10-11 23:03 [PATCH 0/7] staging: make non-modular code explicitly non-modular Paul Gortmaker
                   ` (3 preceding siblings ...)
  2015-10-11 23:03 ` [PATCH 4/7] drivers/staging: make android sw_sync.c explicitly non-modular Paul Gortmaker
@ 2015-10-11 23:03 ` Paul Gortmaker
  2015-10-11 23:03 ` [PATCH 6/7] drivers/staging: make android timed_output.c " Paul Gortmaker
  2015-10-11 23:03 ` [PATCH 7/7] drivers/staging: make emxx_udc.c " Paul Gortmaker
  6 siblings, 0 replies; 8+ messages in thread
From: Paul Gortmaker @ 2015-10-11 23:03 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Paul Gortmaker, Arve Hjønnevåg,
	Riley Andrews, devel

The Kconfig currently controlling compilation of this code is:

drivers/staging/android/Kconfig:config ANDROID_LOW_MEMORY_KILLER
drivers/staging/android/Kconfig:        bool "Android Low Memory Killer"

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

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.

We replace module.h with init.h and moduleparam.h ; the latter since
this file was previously implicitly relying on getting that header.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Arve Hjønnevåg" <arve@android.com>
Cc: Riley Andrews <riandrews@android.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/staging/android/lowmemorykiller.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
index 569d12c02877..e679d8432810 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -32,7 +32,8 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
-#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/moduleparam.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/oom.h>
@@ -190,12 +191,12 @@ static int __init lowmem_init(void)
 	register_shrinker(&lowmem_shrinker);
 	return 0;
 }
+device_initcall(lowmem_init);
 
-static void __exit lowmem_exit(void)
-{
-	unregister_shrinker(&lowmem_shrinker);
-}
-
+/*
+ * not really modular, but the easiest way to keep compat with existing
+ * bootargs behaviour is to continue using module_param here.
+ */
 module_param_named(cost, lowmem_shrinker.seeks, int, S_IRUGO | S_IWUSR);
 module_param_array_named(adj, lowmem_adj, short, &lowmem_adj_size,
 			 S_IRUGO | S_IWUSR);
@@ -203,8 +204,3 @@ module_param_array_named(minfree, lowmem_minfree, uint, &lowmem_minfree_size,
 			 S_IRUGO | S_IWUSR);
 module_param_named(debug_level, lowmem_debug_level, uint, S_IRUGO | S_IWUSR);
 
-module_init(lowmem_init);
-module_exit(lowmem_exit);
-
-MODULE_LICENSE("GPL");
-
-- 
2.6.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 6/7] drivers/staging: make android timed_output.c explicitly non-modular
  2015-10-11 23:03 [PATCH 0/7] staging: make non-modular code explicitly non-modular Paul Gortmaker
                   ` (4 preceding siblings ...)
  2015-10-11 23:03 ` [PATCH 5/7] drivers/staging: make android lowmemorykiller.c " Paul Gortmaker
@ 2015-10-11 23:03 ` Paul Gortmaker
  2015-10-11 23:03 ` [PATCH 7/7] drivers/staging: make emxx_udc.c " Paul Gortmaker
  6 siblings, 0 replies; 8+ messages in thread
From: Paul Gortmaker @ 2015-10-11 23:03 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Paul Gortmaker, Arve Hjønnevåg,
	Riley Andrews, devel

The Kconfig currently controlling compilation of this code is:

drivers/staging/android/Kconfig:config ANDROID_TIMED_OUTPUT
drivers/staging/android/Kconfig:        bool "Timed output class driver"

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

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.

We replace module.h with init.h and export.h ; the latter since this
file does actually export some symbols.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Arve Hjønnevåg" <arve@android.com>
Cc: Riley Andrews <riandrews@android.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/staging/android/timed_output.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/android/timed_output.c b/drivers/staging/android/timed_output.c
index b41429f379fe..aff9cdb007e5 100644
--- a/drivers/staging/android/timed_output.c
+++ b/drivers/staging/android/timed_output.c
@@ -16,7 +16,8 @@
 
 #define pr_fmt(fmt) "timed_output: " fmt
 
-#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/export.h>
 #include <linux/types.h>
 #include <linux/device.h>
 #include <linux/fs.h>
@@ -106,15 +107,4 @@ static int __init timed_output_init(void)
 {
 	return create_timed_output_class();
 }
-
-static void __exit timed_output_exit(void)
-{
-	class_destroy(timed_output_class);
-}
-
-module_init(timed_output_init);
-module_exit(timed_output_exit);
-
-MODULE_AUTHOR("Mike Lockwood <lockwood@android.com>");
-MODULE_DESCRIPTION("timed output class driver");
-MODULE_LICENSE("GPL");
+device_initcall(timed_output_init);
-- 
2.6.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 7/7] drivers/staging: make emxx_udc.c explicitly non-modular
  2015-10-11 23:03 [PATCH 0/7] staging: make non-modular code explicitly non-modular Paul Gortmaker
                   ` (5 preceding siblings ...)
  2015-10-11 23:03 ` [PATCH 6/7] drivers/staging: make android timed_output.c " Paul Gortmaker
@ 2015-10-11 23:03 ` Paul Gortmaker
  6 siblings, 0 replies; 8+ messages in thread
From: Paul Gortmaker @ 2015-10-11 23:03 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Paul Gortmaker, Vincenzo Scotti, Haneen Mohammed,
	Felipe Balbi, Roberta Dobrescu, Tapasweni Pathak, Peter Chen,
	Robert Baldyga, Chris Rorvick, Gujulan Elango, Hari Prasath (H.),
	devel

The Kconfig currently controlling compilation of this code is:

drivers/staging/emxx_udc/Kconfig:config USB_EMXX
drivers/staging/emxx_udc/Kconfig:       bool "EMXX USB Function Device Controller"

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

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

The .remove function was declared __exit, so it wouldn't have been
available for a sysfs bind/unbind anyway, so lets be explicit here and
use ".suppress_bind_attrs = true" to prevent root from doing something
silly.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Vincenzo Scotti <vinc94@gmail.com>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Roberta Dobrescu <roberta.dobrescu@gmail.com>
Cc: Tapasweni Pathak <tapaswenipathak@gmail.com>
Cc: Peter Chen <peter.chen@freescale.com>
Cc: Robert Baldyga <r.baldyga@samsung.com>
Cc: Chris Rorvick <chris@rorvick.com>
Cc: "Gujulan Elango, Hari Prasath (H.)" <hgujulan@visteon.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/staging/emxx_udc/emxx_udc.c | 37 ++++---------------------------------
 1 file changed, 4 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
index f62636462fe4..049274738a2e 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -15,7 +15,7 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/delay.h>
 #include <linux/ioport.h>
@@ -40,11 +40,9 @@
 
 #include "emxx_udc.h"
 
-#define	DRIVER_DESC	"EMXX UDC driver"
 #define	DMA_ADDR_INVALID	(~(dma_addr_t)0)
 
 static const char	driver_name[] = "emxx_udc";
-static const char	driver_desc[] = DRIVER_DESC;
 
 /*===========================================================================*/
 /* Prototype */
@@ -3321,28 +3319,6 @@ static void nbu2ss_drv_shutdown(struct platform_device *pdev)
 }
 
 /*-------------------------------------------------------------------------*/
-static int __exit nbu2ss_drv_remove(struct platform_device *pdev)
-{
-	struct nbu2ss_udc	*udc;
-	struct nbu2ss_ep	*ep;
-	int	i;
-
-	udc = &udc_controller;
-
-	for (i = 0; i < NUM_ENDPOINTS; i++) {
-		ep = &udc->ep[i];
-		if (ep->virt_buf)
-			dma_free_coherent(NULL, PAGE_SIZE,
-				(void *)ep->virt_buf, ep->phys_buf);
-	}
-
-	/* Interrupt Handler - Release */
-	free_irq(INT_VBUS, udc);
-
-	return 0;
-}
-
-/*-------------------------------------------------------------------------*/
 static int nbu2ss_drv_suspend(struct platform_device *pdev, pm_message_t state)
 {
 	struct nbu2ss_udc	*udc;
@@ -3394,17 +3370,12 @@ static int nbu2ss_drv_resume(struct platform_device *pdev)
 static struct platform_driver udc_driver = {
 	.probe		= nbu2ss_drv_probe,
 	.shutdown	= nbu2ss_drv_shutdown,
-	.remove		= __exit_p(nbu2ss_drv_remove),
 	.suspend	= nbu2ss_drv_suspend,
 	.resume		= nbu2ss_drv_resume,
 	.driver		= {
-		.name	= driver_name,
+		.name			= driver_name,
+		.suppress_bind_attrs	= true,
 	},
 };
 
-module_platform_driver(udc_driver);
-
-MODULE_DESCRIPTION(DRIVER_DESC);
-MODULE_AUTHOR("Renesas Electronics Corporation");
-MODULE_LICENSE("GPL");
-
+builtin_platform_driver(udc_driver);
-- 
2.6.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-10-11 23:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-11 23:03 [PATCH 0/7] staging: make non-modular code explicitly non-modular Paul Gortmaker
2015-10-11 23:03 ` [PATCH 1/7] drivers/staging: make android ashmem.c " Paul Gortmaker
2015-10-11 23:03 ` [PATCH 2/7] drivers/staging: make android ion_page_pool.c " Paul Gortmaker
2015-10-11 23:03 ` [PATCH 3/7] drivers/staging: make android tegra_ion.c properly tristate Paul Gortmaker
2015-10-11 23:03 ` [PATCH 4/7] drivers/staging: make android sw_sync.c explicitly non-modular Paul Gortmaker
2015-10-11 23:03 ` [PATCH 5/7] drivers/staging: make android lowmemorykiller.c " Paul Gortmaker
2015-10-11 23:03 ` [PATCH 6/7] drivers/staging: make android timed_output.c " Paul Gortmaker
2015-10-11 23:03 ` [PATCH 7/7] drivers/staging: make emxx_udc.c " Paul Gortmaker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox