[PATCH] USB: remove 8 bytes of padding from usb_host_interface on 64 bit builds

2012-07-10 Thread Richard Kennedy
Reorder elements in the usb_host_interface structure to remove 8 bytes
of padding on 64 bit builds , and so shrink it's size to 40 bytes.

usb_interface_descriptor is a odd size which leaves a gap that is not
big enough to hold a pointer, so moving extralen into that gap removes
the need for more padding.


Signed-off-by: Richard Kennedy rich...@rsk.demon.co.uk

---
patch against v3.5-rc6
compiled and tested on x86_64
I've been running this patch for several weeks with no obvious problems.
This will allow the usb_host_interface array to be a bit smaller and should
better align with the cachelines.

regards
Richard 




diff --git a/include/linux/usb.h b/include/linux/usb.h
index dea39dc..2abec02 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -77,14 +77,14 @@ struct usb_host_endpoint {
 struct usb_host_interface {
struct usb_interface_descriptor desc;
 
+   int extralen;
+   unsigned char *extra;   /* Extra descriptors */
/* array of desc.bNumEndpoint endpoints associated with this
 * interface setting.  these will be in no particular order.
 */
struct usb_host_endpoint *endpoint;
 
char *string;   /* iInterface string, if present */
-   unsigned char *extra;   /* Extra descriptors */
-   int extralen;
 };
 
 enum usb_interface_condition {



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


Re: ubs_skeleton how does unanchor_urb get called in write path?

2008-02-18 Thread Richard Kennedy

On Sun, 2008-02-17 at 12:33 -0500, Alan Stern wrote:
 On Sun, 17 Feb 2008, Richard Kennedy wrote:
 
  Sorry if this a dumb question but I've been trying to figure out how to
  use usb_anchor_urb by looking at usb_skeleton.c.
  
  skel_write calls usb_anchor_urb, but how does usb_unanchor_urb get
  called when the urb is processed successfully? I see it gets called on
  the error path but nowhere else.
 
 When an URB completes (successfully or unsuccessfully), it 
 automatically is unanchored.
 
  Should skel_write_bulk_callback call usb_unanchor_urb, or does it get
  done automatically by the framework?
 
 It is done automatically.  Look at usb_hcd_giveback_urb() in 
 drivers/usb/core/hcd.c.
 
 Alan Stern
Alan,
Thanks for the pointer.
I wonder if it's worth adding a note to the documentation for
usb_anchor_urb just to say that they are automatically unlinked on
completion ?

Richard

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


ubs_skeleton how does unanchor_urb get called in write path?

2008-02-17 Thread Richard Kennedy
Sorry if this a dumb question but I've been trying to figure out how to
use usb_anchor_urb by looking at usb_skeleton.c.

skel_write calls usb_anchor_urb, but how does usb_unanchor_urb get
called when the urb is processed successfully? I see it gets called on
the error path but nowhere else.

Should skel_write_bulk_callback call usb_unanchor_urb, or does it get
done automatically by the framework?

thanks
Richard





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