Skip to content

Commit 9c2b85f

Browse files
Andrzej PietrasiewiczFelipe Balbi
authored andcommitted
usb: gadget: rndis: merge u_rndis.ko with usb_f_rndis.ko
The rndis function's users use only the new interface, so the two modules can be merged. Signed-off-by: Andrzej Pietrasiewicz <[email protected]> Signed-off-by: Kyungmin Park <[email protected]> Acked-by: Michal Nazarewicz <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent 31f89db commit 9c2b85f

File tree

5 files changed

+26
-16
lines changed

5 files changed

+26
-16
lines changed

drivers/usb/gadget/Kconfig

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -512,9 +512,6 @@ config USB_U_SERIAL
512512
config USB_U_ETHER
513513
tristate
514514

515-
config USB_U_RNDIS
516-
tristate
517-
518515
config USB_F_SERIAL
519516
tristate
520517

@@ -642,7 +639,6 @@ config USB_CONFIGFS_RNDIS
642639
depends on USB_CONFIGFS
643640
depends on NET
644641
select USB_U_ETHER
645-
select USB_U_RNDIS
646642
select USB_F_RNDIS
647643
help
648644
Microsoft Windows XP bundles the "Remote NDIS" (RNDIS) protocol,
@@ -772,7 +768,6 @@ config USB_ETH
772768
depends on NET
773769
select USB_LIBCOMPOSITE
774770
select USB_U_ETHER
775-
select USB_U_RNDIS
776771
select USB_F_ECM
777772
select USB_F_SUBSET
778773
select CRC32
@@ -905,7 +900,6 @@ config USB_FUNCTIONFS_RNDIS
905900
bool "Include configuration with RNDIS (Ethernet)"
906901
depends on USB_FUNCTIONFS && NET
907902
select USB_U_ETHER
908-
select USB_U_RNDIS
909903
select USB_F_RNDIS
910904
help
911905
Include a configuration with RNDIS function (Ethernet) and the Filesystem.
@@ -1080,7 +1074,6 @@ config USB_G_MULTI
10801074
config USB_G_MULTI_RNDIS
10811075
bool "RNDIS + CDC Serial + Storage configuration"
10821076
depends on USB_G_MULTI
1083-
select USB_U_RNDIS
10841077
select USB_F_RNDIS
10851078
default y
10861079
help

drivers/usb/gadget/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ obj-$(CONFIG_USB_F_SERIAL) += usb_f_serial.o
4747
usb_f_obex-y := f_obex.o
4848
obj-$(CONFIG_USB_F_OBEX) += usb_f_obex.o
4949
obj-$(CONFIG_USB_U_ETHER) += u_ether.o
50-
u_rndis-y := rndis.o
51-
obj-$(CONFIG_USB_U_RNDIS) += u_rndis.o
5250
usb_f_ncm-y := f_ncm.o
5351
obj-$(CONFIG_USB_F_NCM) += usb_f_ncm.o
5452
usb_f_ecm-y := f_ecm.o
@@ -59,7 +57,7 @@ usb_f_eem-y := f_eem.o
5957
obj-$(CONFIG_USB_F_EEM) += usb_f_eem.o
6058
usb_f_ecm_subset-y := f_subset.o
6159
obj-$(CONFIG_USB_F_SUBSET) += usb_f_ecm_subset.o
62-
usb_f_rndis-y := f_rndis.o
60+
usb_f_rndis-y := f_rndis.o rndis.o
6361
obj-$(CONFIG_USB_F_RNDIS) += usb_f_rndis.o
6462
usb_f_mass_storage-y := f_mass_storage.o storage_common.o
6563
obj-$(CONFIG_USB_F_MASS_STORAGE)+= usb_f_mass_storage.o

drivers/usb/gadget/f_rndis.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,26 @@ static struct usb_function *rndis_alloc(struct usb_function_instance *fi)
979979
return &rndis->port.func;
980980
}
981981

982-
DECLARE_USB_FUNCTION_INIT(rndis, rndis_alloc_inst, rndis_alloc);
982+
DECLARE_USB_FUNCTION(rndis, rndis_alloc_inst, rndis_alloc);
983+
984+
static int __init rndis_mod_init(void)
985+
{
986+
int ret;
987+
988+
ret = rndis_init();
989+
if (ret)
990+
return ret;
991+
992+
return usb_function_register(&rndisusb_func);
993+
}
994+
module_init(rndis_mod_init);
995+
996+
static void __exit rndis_mod_exit(void)
997+
{
998+
usb_function_unregister(&rndisusb_func);
999+
rndis_exit();
1000+
}
1001+
module_exit(rndis_mod_exit);
1002+
9831003
MODULE_LICENSE("GPL");
9841004
MODULE_AUTHOR("David Brownell");

drivers/usb/gadget/rndis.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,7 @@ static struct proc_dir_entry *rndis_connect_state [RNDIS_MAX_CONFIGS];
11421142
#endif /* CONFIG_USB_GADGET_DEBUG_FILES */
11431143

11441144

1145-
static int rndis_init(void)
1145+
int rndis_init(void)
11461146
{
11471147
u8 i;
11481148

@@ -1174,9 +1174,8 @@ static int rndis_init(void)
11741174

11751175
return 0;
11761176
}
1177-
module_init(rndis_init);
11781177

1179-
static void rndis_exit(void)
1178+
void rndis_exit(void)
11801179
{
11811180
#ifdef CONFIG_USB_GADGET_DEBUG_FILES
11821181
u8 i;
@@ -1188,6 +1187,4 @@ static void rndis_exit(void)
11881187
}
11891188
#endif
11901189
}
1191-
module_exit(rndis_exit);
11921190

1193-
MODULE_LICENSE("GPL");

drivers/usb/gadget/u_rndis.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ struct f_rndis_opts {
3636
int refcnt;
3737
};
3838

39+
int rndis_init(void);
40+
void rndis_exit(void);
3941
void rndis_borrow_net(struct usb_function_instance *f, struct net_device *net);
4042

4143
#endif /* U_RNDIS_H */

0 commit comments

Comments
 (0)