RE: [PATCH 06/30] usb/gadget: add some infracture to register/unregister functions

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

 



Hello Sebastian,

Please see below

On Thursday, January 03, 2013 4:38 PM I wrote:
> Subject: RE: [PATCH 06/30] usb/gadget: add some infracture to
> register/unregister functions
> 

<snip>

> > +#define DECLARE_USB_FUNCTION(_name, _inst_alloc, _func_alloc)		\
> > +	static struct usb_function_driver _name ## usb_func = {		\
> > +		.name = __stringify(_name),				\
> > +		.mod  = THIS_MODULE,					\
> > +		.alloc_inst = _inst_alloc,				\
> > +		.alloc_func = _func_alloc,				\
> > +	};								\
> > +	MODULE_ALIAS("usbfunc:"__stringify(_name));
> > +
> > +#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)			\
> > +	{								\
> > +		return usb_function_register(&_name ## usb_func);	\
> > +	}								\
> > +	static void __exit _name ## mod_exit(void)			\
> > +	{								\
> > +		usb_function_unregister(&_name ## usb_func);		\
> > +	}								\
> > +	module_init(_name ## mod_init);					\
> > +	module_exit(_name ## mod_exit)
> > +
> 
> I don't understand splitting the macro in two. The latter macro is
> to be used in modules and this is what you recommend, and it calls
> the first macro. So the first macro should be used in places other
> than modules, but the very reason of this patch is to make f_xxxx.c
> files modules. Code clarity improvements because of this are
> disputable; I find this split rather confusing.
> Can you give an example situation where the first macro
> must be called without the second macro?
> 

Don't bother. I found it in the next patch in the series.

AP


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

  Powered by Linux