[Sony Xperia ZL] suleymanovemil8:
Device Drivers->USB support->USB Gadget Support->USB Gadget Drivers->Serial Gadget (with CDC ACM and CDC OBEX support) gives error :D

CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
CALL scripts/checksyscalls.sh
CHK kernel/config_data.h
CC drivers/usb/gadget/serial.o
CHK include/generated/compile.h
CC drivers/usb/usb-common.o
In file included from drivers/usb/gadget/serial.c:45:0:
drivers/usb/gadget/f_acm.c:90:14: error: 'GSERIAL_NO_PORTS' undeclared here (not in a function)
drivers/usb/gadget/f_acm.c:90:3: warning: 'gacm_ports' defined but not used [-Wunused-variable]
drivers/usb/gadget/f_acm.c:102:12: warning: 'acm_port_setup' defined but not used [-Wunused-function]
drivers/usb/gadget/f_acm.c:989:12: warning: 'acm_init_port' defined but not used [-Wunused-function]
In file included from drivers/usb/gadget/serial.c:47:0:
drivers/usb/gadget/f_serial.c:273:12: warning: 'gport_setup' defined but not used [-Wunused-function]
drivers/usb/gadget/f_serial.c:951:12: warning: 'gserial_init_port' defined but not used [-Wunused-function]
make[3]: *** [drivers/usb/gadget/serial.o] Error 1
make[2]: *** [drivers/usb/gadget] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [drivers/usb] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [drivers] Error 2

after adding

#define GSERIAL_NO_PORTS 3

to drivers/usb/gadget/f_acm.c gives this errors:

CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CHK kernel/config_data.h
CC drivers/usb/gadget/serial.o
In file included from drivers/usb/gadget/serial.c:45:0:
drivers/usb/gadget/f_acm.c:104:12: warning: 'acm_port_setup' defined but not used [-Wunused-function]
drivers/usb/gadget/f_acm.c:991:12: warning: 'acm_init_port' defined but not used [-Wunused-function]
In file included from drivers/usb/gadget/serial.c:47:0:
drivers/usb/gadget/f_serial.c:273:12: warning: 'gport_setup' defined but not used [-Wunused-function]
drivers/usb/gadget/f_serial.c:951:12: warning: 'gserial_init_port' defined but not used [-Wunused-function]
LD drivers/usb/gadget/g_serial.o
LD drivers/usb/gadget/built-in.o
LD drivers/usb/built-in.o
LD drivers/built-in.o
LD vmlinux.o
MODPOST vmlinux.o
GEN .version
CHK include/generated/compile.h
UPD include/generated/compile.h
CC init/version.o
LD init/built-in.o
LD .tmp_vmlinux1
drivers/built-in.o: In function `gport_disconnect':
/home/emil/odin/kernel/sony/apq8064/drivers/usb/gadget/f_serial.c:393: undefined reference to `gsdio_disconnect'
/home/emil/odin/kernel/sony/apq8064/drivers/usb/gadget/f_serial.c:396: undefined reference to `gsmd_disconnect'
/home/emil/odin/kernel/sony/apq8064/drivers/usb/gadget/f_serial.c:399: undefined reference to `ghsic_ctrl_disconnect'
/home/emil/odin/kernel/sony/apq8064/drivers/usb/gadget/f_serial.c:400: undefined reference to `ghsic_data_disconnect'
/home/emil/odin/kernel/sony/apq8064/drivers/usb/gadget/f_serial.c:403: undefined reference to `ghsuart_data_disconnect'
drivers/built-in.o: In function `gport_connect':
/home/emil/odin/kernel/sony/apq8064/drivers/usb/gadget/f_serial.c:341: undefined reference to `gsdio_connect'
/home/emil/odin/kernel/sony/apq8064/drivers/usb/gadget/f_serial.c:344: undefined reference to `gsmd_connect'
/home/emil/odin/kernel/sony/apq8064/drivers/usb/gadget/f_serial.c:347: undefined reference to `ghsic_ctrl_connect'
/home/emil/odin/kernel/sony/apq8064/drivers/usb/gadget/f_serial.c:353: undefined reference to `ghsic_data_connect'
/home/emil/odin/kernel/sony/apq8064/drivers/usb/gadget/f_serial.c:357: undefined reference to `ghsic_ctrl_disconnect'
/home/emil/odin/kernel/sony/apq8064/drivers/usb/gadget/f_serial.c:362: undefined reference to `ghsuart_data_connect'
drivers/built-in.o: In function `acm_port_disconnect':
/home/emil/odin/kernel/sony/apq8064/drivers/usb/gadget/f_acm.c:204: undefined reference to `gsdio_disconnect'
/home/emil/odin/kernel/sony/apq8064/drivers/usb/gadget/f_acm.c:207: undefined reference to `gsmd_disconnect'
/home/emil/odin/kernel/sony/apq8064/drivers/usb/gadget/f_acm.c:210: undefined reference to `ghsic_ctrl_disconnect'
/home/emil/odin/kernel/sony/apq8064/drivers/usb/gadget/f_acm.c:211: undefined reference to `ghsic_data_disconnect'
drivers/built-in.o: In function `acm_port_connect':
/home/emil/odin/kernel/sony/apq8064/drivers/usb/gadget/f_acm.c:160: undefined reference to `gsdio_connect'
/home/emil/odin/kernel/sony/apq8064/drivers/usb/gadget/f_acm.c:163: undefined reference to `gsmd_connect'
/home/emil/odin/kernel/sony/apq8064/drivers/usb/gadget/f_acm.c:166: undefined reference to `ghsic_ctrl_connect'
/home/emil/odin/kernel/sony/apq8064/drivers/usb/gadget/f_acm.c:172: undefined reference to `ghsic_data_connect'
/home/emil/odin/kernel/sony/apq8064/drivers/usb/gadget/f_acm.c:176: undefined reference to `ghsic_ctrl_disconnect'
make: *** [.tmp_vmlinux1] Error 1

Please help)

and source https://github.com/CyanogenMod/android_kernel_sony_apq8064/tree/cm-11.0/drivers/usb/gadget