[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20171011105502.31931-1-johannes@sipsolutions.net>
Date: Wed, 11 Oct 2017 12:55:02 +0200
From: Johannes Berg <johannes@...solutions.net>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org,
Johannes Berg <johannes.berg@...el.com>
Subject: [PATCH] devtmpfs: remove function prototypes from device.h
From: Johannes Berg <johannes.berg@...el.com>
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 <johannes.berg@...el.com>
---
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
diff --git a/drivers/base/base.h b/drivers/base/base.h
index 539432a14b5c..ffd1e192d556 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -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 */
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index d2fb9c8ed205..dc59fdcfe398 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -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;
diff --git a/include/linux/device.h b/include/linux/device.h
index 66fe271c2544..951338bfd219 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -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);
diff --git a/include/linux/devtmpfs.h b/include/linux/devtmpfs.h
new file mode 100644
index 000000000000..47f7b33bf7f3
--- /dev/null
+++ b/include/linux/devtmpfs.h
@@ -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 */
diff --git a/init/do_mounts.c b/init/do_mounts.c
index f6d4dd764a52..dad7e0232b98 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -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>
--
2.14.2
Powered by blists - more mailing lists