binderfs: remove separate device_initcall()
Subsystems (2)
Christian Brauner
maintainerPATCH 1/1 binderfs: remove separate device_initcall()
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.
---
/* 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(-)
drivers/android/binder.c +6 -1
@@ -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:
drivers/android/binder_internal.h +9 -0
@@ -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 */
drivers/android/binderfs.c +1 -3
@@ -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);
Signature · 1 line
2.20.1
Quoted 10 lines · Christian Brauner
binderfs should not have a separate
device_initcall(). When a kernel is compiled withCONFIG_ANDROID_BINDERFSregister the filesystem alongsideCONFIG_ANDROID_IPC. This use-case is especially sensible when users specifyCONFIG_ANDROID_IPC=y,CONFIG_ANDROID_BINDERFS=yand ANDROID_BINDER_DEVICES="".
WhenCONFIG_ANDROID_BINDERFS=nthen this always succeeds so there's no regression potential for legacy workloads.Signed-off-by Christian Brauner <[email protected]>
Quoted 77 lines
---
/* Changelog */
- ensure thatdevice_nameis set to NULL sokfree()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(-)drivers/android/binder.c +6
-1@@ -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:drivers/android/binder_internal.h +9
-0@@ -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 */ drivers/android/binderfs.c +1
-4@@ -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