Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8b3b01c898a44c2fc7217eb579982b9d132113f5 Commit: 8b3b01c898a44c2fc7217eb579982b9d132113f5 Parent: 300871cd963e24a68aaa9b762f4a10403697d9be Author: Marcel Holtmann <[EMAIL PROTECTED]> AuthorDate: Wed Jun 13 08:02:11 2007 +0200 Committer: Greg Kroah-Hartman <[EMAIL PROTECTED]> CommitDate: Thu Jul 12 16:34:38 2007 -0700
USB: Add URB_FREE_BUFFER flag and the logic behind it USB: Add URB_FREE_BUFFER flag for freeing the transfer buffer In some cases it is not needed that the driver keeps track of the transfer buffer of an URB. It can be simply freed along with the URB itself when the reference count goes down to zero. The new flag URB_FREE_BUFFER enables this behavior. Signed-off-by: Marcel Holtmann <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/usb/core/urb.c | 3 +++ include/linux/usb.h | 1 + 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index ac4273d..52ec44b 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c @@ -13,6 +13,9 @@ static void urb_destroy(struct kref *kref) { struct urb *urb = to_urb(kref); + if (urb->transfer_flags & URB_FREE_BUFFER) + kfree(urb->transfer_buffer); + kfree(urb); } diff --git a/include/linux/usb.h b/include/linux/usb.h index efce9a4..533c323 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -994,6 +994,7 @@ extern int usb_disabled(void); #define URB_ZERO_PACKET 0x0040 /* Finish bulk OUT with short packet */ #define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt * needed */ +#define URB_FREE_BUFFER 0x0100 /* Free transfer buffer with the URB */ struct usb_iso_packet_descriptor { unsigned int offset; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html