[PATCH] usb: gadget: update DECLARE_USB_FUNCTION(_INIT) macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Take DECLARE_USB_FUNCTION_INIT(ffs, ffs_alloc_inst, ffs_alloc) as example,
it will generate function ffsmod_init/ffsmod_exit()
and variable ffsusb_func.

Add possible character '_' in the macro which will generate
function/variable name in common format, ffs_mod_init/ffs_mod_exit()
and ffs_usb_func.

It will apply to all gadget functions which use this macro.

Signed-off-by: Linyu Yuan <quic_linyyuan@xxxxxxxxxxx>
---
 include/linux/usb/composite.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 9d27622..0eac583 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -611,7 +611,7 @@ int usb_add_config_only(struct usb_composite_dev *cdev,
 void usb_remove_function(struct usb_configuration *c, struct usb_function *f);
 
 #define DECLARE_USB_FUNCTION(_name, _inst_alloc, _func_alloc)		\
-	static struct usb_function_driver _name ## usb_func = {		\
+	static struct usb_function_driver _name ## _usb_func = {	\
 		.name = __stringify(_name),				\
 		.mod  = THIS_MODULE,					\
 		.alloc_inst = _inst_alloc,				\
@@ -621,16 +621,16 @@ void usb_remove_function(struct usb_configuration *c, struct usb_function *f);
 
 #define DECLARE_USB_FUNCTION_INIT(_name, _inst_alloc, _func_alloc)	\
 	DECLARE_USB_FUNCTION(_name, _inst_alloc, _func_alloc)		\
-	static int __init _name ## mod_init(void)			\
+	static int __init _name ## _mod_init(void)			\
 	{								\
-		return usb_function_register(&_name ## usb_func);	\
+		return usb_function_register(&_name ## _usb_func);	\
 	}								\
-	static void __exit _name ## mod_exit(void)			\
+	static void __exit _name ## _mod_exit(void)			\
 	{								\
-		usb_function_unregister(&_name ## usb_func);		\
+		usb_function_unregister(&_name ## _usb_func);		\
 	}								\
-	module_init(_name ## mod_init);					\
-	module_exit(_name ## mod_exit)
+	module_init(_name ## _mod_init);				\
+	module_exit(_name ## _mod_exit)
 
 /* messaging utils */
 #define DBG(d, fmt, args...) \
-- 
2.7.4




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux