Here's one minor fix for your last patch, and documentation for the
FILL_*_URB macros.  Comments?

No one is using the FILL_BULK_URB_TO and FILL_INT_URB_TO macros, should
they just be deleted?

thanks,

greg k-h
diff -Nru a/include/linux/usb.h b/include/linux/usb.h
--- a/include/linux/usb.h       Tue Nov 27 15:02:06 2001
+++ b/include/linux/usb.h       Tue Nov 27 15:02:06 2001
@@ -377,7 +377,7 @@
  *     device flags.
  *
  * In most cases, drivers will create a table of device IDs by using
- * the macros designed for that purpose.
+ * the USB_DEVICE() macros designed for that purpose.
  * They will then export it to userspace using MODULE_DEVICE_TABLE(),
  * and provide it to the USB core through their usb_driver structure.
  *
@@ -670,40 +670,81 @@
 
 typedef struct urb urb_t, *purb_t;
 
-#define FILL_CONTROL_URB(a,aa,b,c,d,e,f,g) \
+/**
+ * FILL_CONTROL_URB - macro to help initialize a control urb
+ * @URB: pointer to the urb to initialize.
+ * @DEV: pointer to the struct usb_device for this urb.
+ * @PIPE: the endpoint pipe
+ * @SETUP_PACKET: pointer to the setup_packet buffer
+ * @TRANSFER_BUFFER: pointer to the transfer buffer
+ * @BUFFER_LENGTH: length of the transfer buffer
+ * @COMPLETE: pointer to the usb_complete_t function
+ * @CONTEXT: what to set the urb context to.
+ *
+ * Initializes a control urb with the proper information needed to submit it to
+ * a device.
+ */
+#define 
+FILL_CONTROL_URB(URB,DEV,PIPE,SETUP_PACKET,TRANSFER_BUFFER,BUFFER_LENGTH,COMPLETE,CONTEXT)
+ \
     do {\
-       spin_lock_init(&(a)->lock);\
-       (a)->dev=aa;\
-       (a)->pipe=b;\
-       (a)->setup_packet=c;\
-       (a)->transfer_buffer=d;\
-       (a)->transfer_buffer_length=e;\
-       (a)->complete=f;\
-       (a)->context=g;\
+       spin_lock_init(&(URB)->lock);\
+       (URB)->dev=DEV;\
+       (URB)->pipe=PIPE;\
+       (URB)->setup_packet=SETUP_PACKET;\
+       (URB)->transfer_buffer=TRANSFER_BUFFER;\
+       (URB)->transfer_buffer_length=BUFFER_LENGTH;\
+       (URB)->complete=COMPLETE;\
+       (URB)->context=CONTEXT;\
     } while (0)
 
-#define FILL_BULK_URB(a,aa,b,c,d,e,f) \
+/**
+ * FILL_BULK_URB - macro to help initialize a bulk urb
+ * @URB: pointer to the urb to initialize.
+ * @DEV: pointer to the struct usb_device for this urb.
+ * @PIPE: the endpoint pipe
+ * @TRANSFER_BUFFER: pointer to the transfer buffer
+ * @BUFFER_LENGTH: length of the transfer buffer
+ * @COMPLETE: pointer to the usb_complete_t function
+ * @CONTEXT: what to set the urb context to.
+ *
+ * Initializes a bulk urb with the proper information needed to submit it to
+ * a device.
+ */
+#define FILL_BULK_URB(URB,DEV,PIPE,TRANSFER_BUFFER,BUFFER_LENGTH,COMPLETE,CONTEXT) \
     do {\
-       spin_lock_init(&(a)->lock);\
-       (a)->dev=aa;\
-       (a)->pipe=b;\
-       (a)->transfer_buffer=c;\
-       (a)->transfer_buffer_length=d;\
-       (a)->complete=e;\
-       (a)->context=f;\
+       spin_lock_init(&(URB)->lock);\
+       (URB)->dev=DEV;\
+       (URB)->pipe=PIPE;\
+       (URB)->transfer_buffer=TRANSFER_BUFFER;\
+       (URB)->transfer_buffer_length=BUFFER_LENGTH;\
+       (URB)->complete=COMPLETE;\
+       (URB)->context=CONTEXT;\
     } while (0)
     
-#define FILL_INT_URB(a,aa,b,c,d,e,f,g) \
+/**
+ * FILL_INT_URB - macro to help initialize a interrupt urb
+ * @URB: pointer to the urb to initialize.
+ * @DEV: pointer to the struct usb_device for this urb.
+ * @PIPE: the endpoint pipe
+ * @TRANSFER_BUFFER: pointer to the transfer buffer
+ * @BUFFER_LENGTH: length of the transfer buffer
+ * @COMPLETE: pointer to the usb_complete_t function
+ * @CONTEXT: what to set the urb context to.
+ * @INTERVAL: what to set the urb interval to.
+ *
+ * Initializes a interrupt urb with the proper information needed to submit it to
+ * a device.
+ */
+#define 
+FILL_INT_URB(URB,DEV,PIPE,TRANSFER_BUFFER,BUFFER_LENGTH,COMPLETE,CONTEXT,INTERVAL) \
     do {\
-       spin_lock_init(&(a)->lock);\
-       (a)->dev=aa;\
-       (a)->pipe=b;\
-       (a)->transfer_buffer=c;\
-       (a)->transfer_buffer_length=d;\
-       (a)->complete=e;\
-       (a)->context=f;\
-       (a)->interval=g;\
-       (a)->start_frame=-1;\
+       spin_lock_init(&(URB)->lock);\
+       (URB)->dev=DEV;\
+       (URB)->pipe=PIPE;\
+       (URB)->transfer_buffer=TRANSFER_BUFFER;\
+       (URB)->transfer_buffer_length=BUFFER_LENGTH;\
+       (URB)->complete=COMPLETE;\
+       (URB)->context=CONTEXT;\
+       (URB)->interval=INTERVAL;\
+       (URB)->start_frame=-1;\
     } while (0)
 
 #define FILL_CONTROL_URB_TO(a,aa,b,c,d,e,f,g,h) \

Reply via email to