devtmpfs: remove function prototypes from device.h
Subsystems (2)
PATCH 1/1 devtmpfs: remove function prototypes from device.h
From: Johannes Berg <[email protected]>
Since device.h gets included practically everywhere, having it depend on Kconfig options is rather annoying.
For two of the functions, there isn't even any reason to be visible outside of drivers/base/, and the mount one can move to a new devtmpfs.h file (we similarly have a very small ramfs.h for example).
Signed-off-by Johannes Berg <[email protected]>
---
I just ran into this because I had to toggle devtmpfs Kconfig... I don't really mind all that much, but figured sending a patch is easier than asking first if you thought this made sense :)
--- drivers/base/base.h | 4 ++++ drivers/base/devtmpfs.c | 1 + include/linux/device.h | 10 ---------- include/linux/devtmpfs.h | 10 ++++++++++ init/do_mounts.c | 1 + 5 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 include/linux/devtmpfs.h
drivers/base/base.h +4 -0
@@ -147,8 +147,12 @@ static inline void module_remove_driver(struct device_driver *drv) { }#ifdef CONFIG_DEVTMPFS extern int devtmpfs_init (void ); +extern int devtmpfs_create_node (struct device *dev); +extern int devtmpfs_delete_node (struct device *dev);#else static inline int devtmpfs_init (void ) {return 0 ; } +static inline int devtmpfs_create_node (struct device *dev) {return 0 ; } +static inline int devtmpfs_delete_node (struct device *dev) {return 0 ; }#endif /* Device links support */
drivers/base/devtmpfs.c +1 -0
@@ -24,6 +24,7 @@#include <linux/sched.h> #include <linux/slab.h> #include <linux/kthread.h> +#include <linux/devtmpfs.h> #include "base.h" static struct task_struct *thread;
include/linux/device.h +0 -10
@@ -1247,16 +1247,6 @@ extern int (*platform_notify_remove)(struct device *dev);extern struct device *get_device (struct device *dev);extern void put_device (struct device *dev); -#ifdef CONFIG_DEVTMPFS -extern int devtmpfs_create_node (struct device *dev); -extern int devtmpfs_delete_node (struct device *dev); -extern int devtmpfs_mount (const char *mntdir); -#else -static inline int devtmpfs_create_node (struct device *dev) {return 0 ; } -static inline int devtmpfs_delete_node (struct device *dev) {return 0 ; } -static inline int devtmpfs_mount (const char *mountpoint) {return 0 ; } -#endif -/* drivers/base/power/shutdown.c */ extern void device_shutdown (void );
include/linux/devtmpfs.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef __DEVTMPFS_H +#define __DEVTMPFS_H + +#ifdef CONFIG_DEVTMPFS +extern int devtmpfs_mount (const char *mntdir); +#else +static inline int devtmpfs_mount (const char *mountpoint) {return 0 ; } +#endif + +#endif /* __DEVTMPFS_H */
init/do_mounts.c +1 -0
@@ -28,6 +28,7 @@#include <linux/slab.h> #include <linux/ramfs.h> #include <linux/shmem_fs.h> +#include <linux/devtmpfs.h> #include <linux/nfs_fs.h> #include <linux/nfs_fs_sb.h>
Signature · 1 line
2.14.2