Linux-Fsdevel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v1] binderfs: remove separate device_initcall()
@ 2019-01-31  0:25 Christian Brauner
  2019-02-06  1:16 ` Todd Kjos
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Brauner @ 2019-01-31  0:25 UTC (permalink / raw)
  To: gregkh, tkjos, devel, linux-kernel, linux-fsdevel
  Cc: arve, maco, joel, tkjos, Christian Brauner

binderfs should not have a separate device_initcall(). When a kernel is
compiled with CONFIG_ANDROID_BINDERFS register the filesystem alongside
CONFIG_ANDROID_IPC. This use-case is especially sensible when users specify
CONFIG_ANDROID_IPC=y, CONFIG_ANDROID_BINDERFS=y and
ANDROID_BINDER_DEVICES="".
When CONFIG_ANDROID_BINDERFS=n then this always succeeds so there's no
regression potential for legacy workloads.

Signed-off-by: Christian Brauner <christian@brauner.io>
---
/* Changelog */
- ensure that device_name is set to NULL so kfree() doesn't freak out
---
 drivers/android/binder.c          | 7 ++++++-
 drivers/android/binder_internal.h | 9 +++++++++
 drivers/android/binderfs.c        | 4 +---
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index 57cf259de600..4d2b2ad1ee0e 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -5854,9 +5854,10 @@ static int __init init_binder_device(const char *name)
 static int __init binder_init(void)
 {
 	int ret;
-	char *device_name, *device_names, *device_tmp;
+	char *device_name, *device_tmp;
 	struct binder_device *device;
 	struct hlist_node *tmp;
+	char *device_names = NULL;
 
 	ret = binder_alloc_shrinker_init();
 	if (ret)
@@ -5917,6 +5918,10 @@ static int __init binder_init(void)
 		}
 	}
 
+	ret = init_binderfs();
+	if (ret)
+		goto err_init_binder_device_failed;
+
 	return ret;
 
 err_init_binder_device_failed:
diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_internal.h
index 7fb97f503ef2..045b3e42d98b 100644
--- a/drivers/android/binder_internal.h
+++ b/drivers/android/binder_internal.h
@@ -46,4 +46,13 @@ static inline bool is_binderfs_device(const struct inode *inode)
 }
 #endif
 
+#ifdef CONFIG_ANDROID_BINDERFS
+extern int __init init_binderfs(void);
+#else
+static inline int __init init_binderfs(void)
+{
+	return 0;
+}
+#endif
+
 #endif /* _LINUX_BINDER_INTERNAL_H */
diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c
index 7a550104a722..e773f45d19d9 100644
--- a/drivers/android/binderfs.c
+++ b/drivers/android/binderfs.c
@@ -550,7 +550,7 @@ static struct file_system_type binder_fs_type = {
 	.fs_flags	= FS_USERNS_MOUNT,
 };
 
-static int __init init_binderfs(void)
+int __init init_binderfs(void)
 {
 	int ret;
 
@@ -568,5 +568,3 @@ static int __init init_binderfs(void)
 
 	return ret;
 }
-
-device_initcall(init_binderfs);
-- 
2.20.1


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

* Re: [PATCH v1] binderfs: remove separate device_initcall()
  2019-01-31  0:25 [PATCH v1] binderfs: remove separate device_initcall() Christian Brauner
@ 2019-02-06  1:16 ` Todd Kjos
  0 siblings, 0 replies; 2+ messages in thread
From: Todd Kjos @ 2019-02-06  1:16 UTC (permalink / raw)
  To: Christian Brauner
  Cc: Greg Kroah-Hartman, Todd Kjos, open list:ANDROID DRIVERS, LKML,
	linux-fsdevel, Arve Hjønnevåg, Martijn Coenen, joel

On Wed, Jan 30, 2019 at 4:25 PM Christian Brauner <christian@brauner.io> wrote:
>
> binderfs should not have a separate device_initcall(). When a kernel is
> compiled with CONFIG_ANDROID_BINDERFS register the filesystem alongside
> CONFIG_ANDROID_IPC. This use-case is especially sensible when users specify
> CONFIG_ANDROID_IPC=y, CONFIG_ANDROID_BINDERFS=y and
> ANDROID_BINDER_DEVICES="".
> When CONFIG_ANDROID_BINDERFS=n then this always succeeds so there's no
> regression potential for legacy workloads.
>
> Signed-off-by: Christian Brauner <christian@brauner.io>

Acked-by: Todd Kjos <tkjos@google.com>

>
> ---
> /* Changelog */
> - ensure that device_name is set to NULL so kfree() doesn't freak out
> ---
>  drivers/android/binder.c          | 7 ++++++-
>  drivers/android/binder_internal.h | 9 +++++++++
>  drivers/android/binderfs.c        | 4 +---
>  3 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/android/binder.c b/drivers/android/binder.c
> index 57cf259de600..4d2b2ad1ee0e 100644
> --- a/drivers/android/binder.c
> +++ b/drivers/android/binder.c
> @@ -5854,9 +5854,10 @@ static int __init init_binder_device(const char *name)
>  static int __init binder_init(void)
>  {
>         int ret;
> -       char *device_name, *device_names, *device_tmp;
> +       char *device_name, *device_tmp;
>         struct binder_device *device;
>         struct hlist_node *tmp;
> +       char *device_names = NULL;
>
>         ret = binder_alloc_shrinker_init();
>         if (ret)
> @@ -5917,6 +5918,10 @@ static int __init binder_init(void)
>                 }
>         }
>
> +       ret = init_binderfs();
> +       if (ret)
> +               goto err_init_binder_device_failed;
> +
>         return ret;
>
>  err_init_binder_device_failed:
> diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_internal.h
> index 7fb97f503ef2..045b3e42d98b 100644
> --- a/drivers/android/binder_internal.h
> +++ b/drivers/android/binder_internal.h
> @@ -46,4 +46,13 @@ static inline bool is_binderfs_device(const struct inode *inode)
>  }
>  #endif
>
> +#ifdef CONFIG_ANDROID_BINDERFS
> +extern int __init init_binderfs(void);
> +#else
> +static inline int __init init_binderfs(void)
> +{
> +       return 0;
> +}
> +#endif
> +
>  #endif /* _LINUX_BINDER_INTERNAL_H */
> diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c
> index 7a550104a722..e773f45d19d9 100644
> --- a/drivers/android/binderfs.c
> +++ b/drivers/android/binderfs.c
> @@ -550,7 +550,7 @@ static struct file_system_type binder_fs_type = {
>         .fs_flags       = FS_USERNS_MOUNT,
>  };
>
> -static int __init init_binderfs(void)
> +int __init init_binderfs(void)
>  {
>         int ret;
>
> @@ -568,5 +568,3 @@ static int __init init_binderfs(void)
>
>         return ret;
>  }
> -
> -device_initcall(init_binderfs);
> --
> 2.20.1
>

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-31  0:25 [PATCH v1] binderfs: remove separate device_initcall() Christian Brauner
2019-02-06  1:16 ` Todd Kjos

Linux-Fsdevel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-fsdevel/0 linux-fsdevel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-fsdevel linux-fsdevel/ https://lore.kernel.org/linux-fsdevel \
		linux-fsdevel@vger.kernel.org linux-fsdevel@archiver.kernel.org
	public-inbox-index linux-fsdevel


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-fsdevel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox