Skip to contentSkip to conversation

staging: android: allow building some drivers as a module

PATCH In review Mike Rapoport 4 participants 16 messages Aug 10, 2015 – Aug 12, 2015

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

cover staging: android: allow building some drivers as a module

Hi,

These patches enable building of timed_gpio, sync* and ashmem as a module

Mike Rapoport (6):
staging: android: allow building timed_gpio as a module
staging: android: sync_debug.c: add include for linux/module.h
staging: android: combine sync.o and sync_debug.o into sync-core.o
staging: android: allow building sync and sw_sync as a module
mm: export shmem_zero_setup for modules
staging: android: allow building ashmem as a module

 drivers/staging/android/Kconfig      | 8 ++++----
 drivers/staging/android/Makefile     | 4 +++-
 drivers/staging/android/sync_debug.c | 1 +
 mm/shmem.c                           | 1 +
 4 files changed, 9 insertions(+), 5 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/6 staging: android: allow building timed_gpio as a module

---
 drivers/staging/android/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/Kconfig +1 -1
index 6830712..00f7894 100644
@@ -15,7 +15,7 @@ config ASHMEM
 	  because it can discard shared memory units when under memory pressure.
 
 config ANDROID_TIMED_OUTPUT
-	bool "Timed output class driver"
+	tristate "Timed output class driver"
 	default y
 
 config ANDROID_TIMED_GPIO
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 2/6 staging: android: sync_debug.c: add include for linux/module.h

In reply to Mike Rapoport

Otherwise an apptempt to build sync_debug.o as modules results in
compiler errors:
CC [M] drivers/staging/android/sync_debug.o
drivers/staging/android/sync_debug.c:226:1: warning: data definition has no type or storage class [enabled by default] late_initcall(sync_debugfs_init); drivers/staging/android/sync_debug.c:226:1: error: type defaults to ‘int’ in declaration of ‘late_initcall’ [-Werror=implicit-int] drivers/staging/android/sync_debug.c:226:1: warning: parameter names (without types) in function declaration [enabled by default] drivers/staging/android/sync_debug.c:221:19: warning: ‘sync_debugfs_init’ defined but not used [-Wunused-function] static __init int sync_debugfs_init(void)

---
 drivers/staging/android/sync_debug.c | 1 +
 1 file changed, 1 insertion(+)
drivers/staging/android/sync_debug.c +1 -0
index 91ed2c4..a452975 100644
@@ -26,6 +26,7 @@
 #include <linux/uaccess.h>
 #include <linux/anon_inodes.h>
 #include <linux/time64.h>
+#include <linux/module.h>
 #include "sync.h"
 
 #ifdef CONFIG_DEBUG_FS
Signature · 1 line
1.8.3.1
#3 lore raw

PATCH 3/6 staging: android: combine sync.o and sync_debug.o into sync-core.o

In reply to Mike Rapoport

to avoid cross dependencies when building sync as module

---
 drivers/staging/android/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/android/Makefile +3 -1
index c7b6c99..d9ebca6 100644
@@ -6,5 +6,7 @@ obj-$(CONFIG_ASHMEM)			+= ashmem.o
 obj-$(CONFIG_ANDROID_TIMED_OUTPUT)	+= timed_output.o
 obj-$(CONFIG_ANDROID_TIMED_GPIO)	+= timed_gpio.o
 obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER)	+= lowmemorykiller.o
-obj-$(CONFIG_SYNC)			+= sync.o sync_debug.o
+obj-$(CONFIG_SYNC)			+= sync-core.o
 obj-$(CONFIG_SW_SYNC)			+= sw_sync.o
+
+sync-core-y := sync.o sync_debug.o
Signature · 1 line
1.8.3.1
#4 lore raw

PATCH 4/6 staging: android: allow building sync and sw_sync as a module

In reply to Mike Rapoport
---
 drivers/staging/android/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/android/Kconfig +2 -2
index 00f7894..93b65bd 100644
@@ -39,7 +39,7 @@ config ANDROID_LOW_MEMORY_KILLER
 	  for each priority.
 
 config SYNC
-	bool "Synchronization framework"
+	tristate "Synchronization framework"
 	default n
 	select ANON_INODES
 	select DMA_SHARED_BUFFER
@@ -49,7 +49,7 @@ config SYNC
 	  synchronization built into devices like GPUs.
 
 config SW_SYNC
-	bool "Software synchronization objects"
+	tristate "Software synchronization objects"
 	default n
 	depends on SYNC
 	---help---
Signature · 1 line
1.8.3.1
#5 lore raw

PATCH 5/6 mm: export shmem_zero_setup for modules

In reply to Mike Rapoport

to allow building Android ASHMEM as module

---
 mm/shmem.c | 1 +
 1 file changed, 1 insertion(+)
mm/shmem.c +1 -0
index 4caf8ed..80b4098 100644
@@ -3411,6 +3411,7 @@ int shmem_zero_setup(struct vm_area_struct *vma)
 	vma->vm_ops = &shmem_vm_ops;
 	return 0;
 }
+EXPORT_SYMBOL_GPL(shmem_zero_setup);
 
 /**
  * shmem_read_mapping_page_gfp - read into page cache, using specified page allocation flags.
Signature · 1 line
1.8.3.1
#6 lore raw

Re: [PATCH 5/6] mm: export shmem_zero_setup for modules

Quoted 1 line · Mike Rapoport

to allow building Android ASHMEM as module

NAK. This is not functionality that should be used by a module to start, and even if it was exporting functionality is only acceptable for proper mainline modules, not code in the staging tree.

#7 lore raw

PATCH 6/6 staging: android: allow building ashmem as a module

In reply to Mike Rapoport
---
 drivers/staging/android/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/Kconfig +1 -1
index 93b65bd..5907e07 100644
@@ -3,7 +3,7 @@ menu "Android"
 if ANDROID
 
 config ASHMEM
-	bool "Enable the Anonymous Shared Memory Subsystem"
+	tristate "Enable the Anonymous Shared Memory Subsystem"
 	default n
 	depends on SHMEM
 	---help---
Signature · 1 line
1.8.3.1
#8 lore raw
In reply to Mike Rapoport
Quoted 3 lines · Mike Rapoport

Hi,

These patches enable building of timed_gpio, sync* and ashmem as a module

Why do you want to do this? Does it ever make sense to do this type of thing for your kernel? What does changing these to modules enable you to do differently?

As it is, I think the code should stay non-modular.

thanks,

greg k-h

#9 lore raw
Quoted 6 lines · Greg Kroah-Hartman
Quoted 3 lines · Mike Rapoport

Hi,

These patches enable building of timed_gpio, sync* and ashmem as a module

Why do you want to do this?

Apparently I've misread "- make sure things build as modules properly" line in drivers/staging/android/TODO...
My bad.

Quoted 9 lines

Does it ever make sense to do this type of
thing for your kernel? What does changing these to modules enable you to do differently?

As it is, I think the code should stay non-modular.

thanks,

greg k-h

Signature · 2 lines
Sincerely yours,
Mike.
#10 lore raw
Quoted 11 lines · Mike Rapoport
Quoted 6 lines · Greg Kroah-Hartman
Quoted 3 lines · Mike Rapoport

Hi,

These patches enable building of timed_gpio, sync* and ashmem as a module

Why do you want to do this?

Apparently I've misread "- make sure things build as modules properly" line in drivers/staging/android/TODO...
My bad.

Nope, not your fault, I forgot about that. We should remove that TODO item, as it doesn't make sense for these "non-discoverable" modules to be built as a module.

Care to make a patch for that?

thanks,

greg k-h

#11 lore raw
Quoted 13 lines · Greg Kroah-Hartman
Quoted 11 lines · Mike Rapoport
Quoted 6 lines · Greg Kroah-Hartman
Quoted 3 lines · Mike Rapoport

Hi,

These patches enable building of timed_gpio, sync* and ashmem as a module

Why do you want to do this?

Apparently I've misread "- make sure things build as modules properly" line in drivers/staging/android/TODO...
My bad.

Quoted 5 lines

Nope, not your fault, I forgot about that. We should remove that TODO item, as it doesn't make sense for these "non-discoverable" modules to be built as a module.

Care to make a patch for that?

I'll make, no problem.
What about other irrelevant parts of that TODO, like, e.g., dead Brian Sweetland address? Remove them as well?

Quoted 3 lines

thanks,

greg k-h

Signature · 2 lines
Sincerely yours,
Mike.
#12 lore raw
Quoted 18 lines · Mike Rapoport
Quoted 17 lines · Greg Kroah-Hartman
Quoted 11 lines · Mike Rapoport
Quoted 6 lines · Greg Kroah-Hartman
Quoted 3 lines · Mike Rapoport

Hi,

These patches enable building of timed_gpio, sync* and ashmem as a module

Why do you want to do this?

Apparently I've misread "- make sure things build as modules properly" line in drivers/staging/android/TODO...
My bad.

Nope, not your fault, I forgot about that. We should remove that TODO item, as it doesn't make sense for these "non-discoverable" modules to be built as a module.

Quoted 5 lines
Quoted 1 line

Care to make a patch for that?

I'll make, no problem.
What about other irrelevant parts of that TODO, like, e.g., dead Brian Sweetland address? Remove them as well?

Yes, please remove that as well, good catch.

greg k-h

#13 lore raw

PATCH 1/1 staging: android: TODO: remove irrelevant parts

- remove "make sure things build as modules properly"
- remove kuid_t related remarks, they were relevant for logger, but it is gone half year ago
- remove dead e-mail address of Brian Swetland

---
 drivers/staging/android/TODO | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/staging/android/TODO +1 -10
index 06954cd..37c90aa 100644
@@ -2,16 +2,7 @@ TODO:
 	- checkpatch.pl cleanups
 	- sparse fixes
 	- rename files to be not so "generic"
-	- make sure things build as modules properly
 	- add proper arch dependencies as needed
 	- audit userspace interfaces to make sure they are sane
-	- kuid_t should never be exposed to user space as it is
-          kernel internal type. Data structure for this kuid_t is:
-          typedef struct {
-          	uid_t val;
-          } kuid_t;
-	- This bug is introduced by Xiong Zhou in the patch bd471258f2e09
-	- ("staging: android: logger: use kuid_t instead of uid_t")
 
-Please send patches to Greg Kroah-Hartman <[email protected]> and Cc:
-Brian Swetland <[email protected]>
+Please send patches to Greg Kroah-Hartman <[email protected]>
Signature · 1 line
1.8.3.1
#14 lore raw

Re: [PATCH] staging: android: TODO: remove irrelevant parts

Quoted 1 line · Mike Rapoport

- remove dead e-mail address of Brian Swetland

[]

drivers/staging/android/TODO

Quoted 1 line
drivers/staging/android/TODO +0 -0

[]

drivers/staging/android/TODO TODO:

Quoted 1 line
drivers/staging/android/TODO +0 -0
@@ -2,16 +2,7 @@ TODO:

[]

drivers/staging/android/TODO TODO: · line 8

Quoted 3 lines
drivers/staging/android/TODO +1 -2
-Please send patches to Greg Kroah-Hartman <[email protected]> and Cc:
-Brian Swetland <[email protected]>
+Please send patches to Greg Kroah-Hartman <[email protected]>

What about adding these two?

MAINTAINERS:M: Arve Hjønnevåg <[email protected]> MAINTAINERS:M: Riley Andrews <[email protected]>

#15 lore raw

PATCH v2 1/1 staging: android: update TODO

- remove "make sure things build as modules properly"
- remove kuid_t related remarks, they were relevant for logger, but it is gone half year ago
- remove dead e-mail address of Brian Swetland
- add e-mail addresses of Arve Hjønnevåg and Riley Andrews

---
v2 changes:
* added e-mail addresses of Arve Hjønnevåg and Riley Andrews

 drivers/staging/android/TODO | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/staging/android/TODO +1 -9
index 06954cd..20288fc 100644
@@ -2,16 +2,8 @@ TODO:
 	- checkpatch.pl cleanups
 	- sparse fixes
 	- rename files to be not so "generic"
-	- make sure things build as modules properly
 	- add proper arch dependencies as needed
 	- audit userspace interfaces to make sure they are sane
-	- kuid_t should never be exposed to user space as it is
-          kernel internal type. Data structure for this kuid_t is:
-          typedef struct {
-          	uid_t val;
-          } kuid_t;
-	- This bug is introduced by Xiong Zhou in the patch bd471258f2e09
-	- ("staging: android: logger: use kuid_t instead of uid_t")
 
 Please send patches to Greg Kroah-Hartman <[email protected]> and Cc:
-Brian Swetland <[email protected]>
+Arve Hjønnevåg <[email protected]> and Riley Andrews <[email protected]>
Signature · 1 line
1.8.3.1