Re: [PATCH 1/8] USB: composite: allow optional removal of __init and __exit tags

Previous thread: [PATCH 2/8] sched: __wake_up_locked() exported by Michal Nazarewicz on Wednesday, April 7, 2010 - 6:41 am. (22 messages)

Next thread: [PATCH 0/7] The FunctionFS composite function by Michal Nazarewicz on Wednesday, April 7, 2010 - 6:41 am. (1 message)
From: Michal Nazarewicz
Date: Wednesday, April 7, 2010 - 6:41 am

The composite framework has been written using __init and __exit tags
to mark init and exit functions as such.  This works with most of the
composite gadgets however some may need to call init/exit functions
during normal operations.  One example is mass storage gadget which
needs to call exit functions.

This patch allows gadgets to define USB_NO_INIT_SEGMENT or
USB_NO_EXIT_SEGMENT to remove the __init and __exit declarations
from composite framework.

For example see mass_storage.c.

Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/usb/gadget/composite.c     |   25 +++++++++++++------------
 drivers/usb/gadget/config.c        |    6 ++++--
 drivers/usb/gadget/epautoconf.c    |   13 +++++++------
 drivers/usb/gadget/mass_storage.c  |    4 ++++
 drivers/usb/gadget/usb-init-exit.h |   23 +++++++++++++++++++++++
 5 files changed, 51 insertions(+), 20 deletions(-)
 create mode 100644 drivers/usb/gadget/usb-init-exit.h

diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 09289bb..0039aba 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -27,6 +27,8 @@
 
 #include <linux/usb/composite.h>
 
+#include "usb-init-exit.h"
+
 
 /*
  * The code in this file is utility code, used to build a gadget driver
@@ -85,7 +87,7 @@ MODULE_PARM_DESC(iSerialNumber, "SerialNumber string");
  * This function returns the value of the function's bind(), which is
  * zero for success else a negative errno value.
  */
-int __init usb_add_function(struct usb_configuration *config,
+int __usb_init usb_add_function(struct usb_configuration *config,
 		struct usb_function *function)
 {
 	int	value = -EINVAL;
@@ -215,7 +217,7 @@ int usb_function_activate(struct usb_function *function)
  * Returns the interface ID which was allocated; or -ENODEV if no
  * more interface IDs can be allocated.
  */
-int __init ...
From: Greg KH
Date: Wednesday, April 7, 2010 - 8:28 am

Ick ick ick.

How about we just drop the __init and __exit tags completly and then
we don't have to propagate this mess any further?

How much memory do they really save anyway?

I don't like this at all...

thanks,

greg k-h
--

From: =?utf-8?B?TWljaGHFgiBOYXphcmV3aWN6?=
Date: Wednesday, April 7, 2010 - 8:39 am

Personally, I don't care, ;) so if you think it's better to drop it all
together I can change it in a future patch.

-- 
Best regards,                                           _     _
  .o. | Liege of Serenely Enlightened Majesty of       o' \,=./ `o
  ..o | Computer Science,  Michał "mina86" Nazarewicz     (o o)
  ooo +---[mina86@mina86.com]---[mina86@jabber.org]---ooO--(_)--Ooo--
--

From: Greg KH
Date: Wednesday, April 7, 2010 - 5:26 pm

That would be great.

thanks,

greg k-h
--

Previous thread: [PATCH 2/8] sched: __wake_up_locked() exported by Michal Nazarewicz on Wednesday, April 7, 2010 - 6:41 am. (22 messages)

Next thread: [PATCH 0/7] The FunctionFS composite function by Michal Nazarewicz on Wednesday, April 7, 2010 - 6:41 am. (1 message)