Skip to content

Commit 5b9633a

Browse files
braunergregkh
authored andcommitted
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. Signed-off-by: Christian Brauner <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 32a6637 commit 5b9633a

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

drivers/android/binder.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5854,9 +5854,10 @@ static int __init init_binder_device(const char *name)
58545854
static int __init binder_init(void)
58555855
{
58565856
int ret;
5857-
char *device_name, *device_names, *device_tmp;
5857+
char *device_name, *device_tmp;
58585858
struct binder_device *device;
58595859
struct hlist_node *tmp;
5860+
char *device_names = NULL;
58605861

58615862
ret = binder_alloc_shrinker_init();
58625863
if (ret)
@@ -5917,6 +5918,10 @@ static int __init binder_init(void)
59175918
}
59185919
}
59195920

5921+
ret = init_binderfs();
5922+
if (ret)
5923+
goto err_init_binder_device_failed;
5924+
59205925
return ret;
59215926

59225927
err_init_binder_device_failed:

drivers/android/binder_internal.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,13 @@ static inline bool is_binderfs_device(const struct inode *inode)
4646
}
4747
#endif
4848

49+
#ifdef CONFIG_ANDROID_BINDERFS
50+
extern int __init init_binderfs(void);
51+
#else
52+
static inline int __init init_binderfs(void)
53+
{
54+
return 0;
55+
}
56+
#endif
57+
4958
#endif /* _LINUX_BINDER_INTERNAL_H */

drivers/android/binderfs.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ static struct file_system_type binder_fs_type = {
550550
.fs_flags = FS_USERNS_MOUNT,
551551
};
552552

553-
static int __init init_binderfs(void)
553+
int __init init_binderfs(void)
554554
{
555555
int ret;
556556

@@ -568,5 +568,3 @@ static int __init init_binderfs(void)
568568

569569
return ret;
570570
}
571-
572-
device_initcall(init_binderfs);

0 commit comments

Comments
 (0)