ChangeSet 1.1508.1.6, 2003/06/30 10:59:49-07:00, mdharm-usb@one-eyed-alien.net

[PATCH] USB storage: Cosmetic cleanups

This is some cosmetic cleanups.  Things like changing dr to cr (they used
to stand for usb_devrequest, which is now usb_ctrlrequest), using strlcpy
instead of strncpy, and modifying some comments.


 drivers/usb/storage/transport.c |   24 ++++++++++++------------
 drivers/usb/storage/usb.c       |   16 ++++++++--------
 drivers/usb/storage/usb.h       |   14 +++++++-------
 3 files changed, 27 insertions(+), 27 deletions(-)


diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c	Tue Jul  1 14:23:59 2003
+++ b/drivers/usb/storage/transport.c	Tue Jul  1 14:23:59 2003
@@ -207,15 +207,15 @@
 			value, index, size);
 
 	/* fill in the devrequest structure */
-	us->dr->bRequestType = requesttype;
-	us->dr->bRequest = request;
-	us->dr->wValue = cpu_to_le16(value);
-	us->dr->wIndex = cpu_to_le16(index);
-	us->dr->wLength = cpu_to_le16(size);
+	us->cr->bRequestType = requesttype;
+	us->cr->bRequest = request;
+	us->cr->wValue = cpu_to_le16(value);
+	us->cr->wIndex = cpu_to_le16(index);
+	us->cr->wLength = cpu_to_le16(size);
 
 	/* fill and submit the URB */
 	usb_fill_control_urb(us->current_urb, us->pusb_dev, pipe, 
-			 (unsigned char*) us->dr, data, size, 
+			 (unsigned char*) us->cr, data, size, 
 			 usb_stor_blocking_completion, NULL);
 	status = usb_stor_msg_common(us, timeout);
 
@@ -346,15 +346,15 @@
 			value, index, size);
 
 	/* fill in the devrequest structure */
-	us->dr->bRequestType = requesttype;
-	us->dr->bRequest = request;
-	us->dr->wValue = cpu_to_le16(value);
-	us->dr->wIndex = cpu_to_le16(index);
-	us->dr->wLength = cpu_to_le16(size);
+	us->cr->bRequestType = requesttype;
+	us->cr->bRequest = request;
+	us->cr->wValue = cpu_to_le16(value);
+	us->cr->wIndex = cpu_to_le16(index);
+	us->cr->wLength = cpu_to_le16(size);
 
 	/* fill and submit the URB */
 	usb_fill_control_urb(us->current_urb, us->pusb_dev, pipe, 
-			 (unsigned char*) us->dr, data, size, 
+			 (unsigned char*) us->cr, data, size, 
 			 usb_stor_blocking_completion, NULL);
 	result = usb_stor_msg_common(us, 0);
 
diff -Nru a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
--- a/drivers/usb/storage/usb.c	Tue Jul  1 14:23:59 2003
+++ b/drivers/usb/storage/usb.c	Tue Jul  1 14:23:59 2003
@@ -513,15 +513,15 @@
 	/* Use the unusual_dev strings if the device didn't provide them */
 	if (strlen(us->vendor) == 0) {
 		if (unusual_dev->vendorName)
-			strncpy(us->vendor, unusual_dev->vendorName,
-				sizeof(us->vendor) - 1);
+			strlcpy(us->vendor, unusual_dev->vendorName,
+				sizeof(us->vendor));
 		else
 			strcpy(us->vendor, "Unknown");
 	}
 	if (strlen(us->product) == 0) {
 		if (unusual_dev->productName)
-			strncpy(us->product, unusual_dev->productName,
-				sizeof(us->product) - 1);
+			strlcpy(us->product, unusual_dev->productName,
+				sizeof(us->product));
 		else
 			strcpy(us->product, "Unknown");
 	}
@@ -743,8 +743,8 @@
 	int p;
 
 	/* Allocate the USB control blocks */
-	us->dr = kmalloc(sizeof(*us->dr), GFP_KERNEL);
-	if (!us->dr) {
+	us->cr = kmalloc(sizeof(*us->cr), GFP_KERNEL);
+	if (!us->cr) {
 		US_DEBUGP("usb_ctrlrequest allocation failed\n");
 		return -ENOMEM;
 	}
@@ -860,8 +860,8 @@
 		kfree(us->iobuf);
 	if (us->current_urb)
 		usb_free_urb(us->current_urb);
-	if (us->dr)
-		kfree(us->dr);
+	if (us->cr)
+		kfree(us->cr);
 
 	/* Free the structure itself */
 	kfree(us);
diff -Nru a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
--- a/drivers/usb/storage/usb.h	Tue Jul  1 14:23:59 2003
+++ b/drivers/usb/storage/usb.h	Tue Jul  1 14:23:59 2003
@@ -108,6 +108,7 @@
 	struct semaphore	dev_semaphore;	 /* protect pusb_dev */
 	struct usb_device	*pusb_dev;	 /* this usb_device */
 	struct usb_interface	*pusb_intf;	 /* this interface */
+	struct us_unusual_dev   *unusual_dev;	 /* device-filter entry     */
 	unsigned long		flags;		 /* from filter initially */
 	unsigned int		send_bulk_pipe;	 /* cached pipe values */
 	unsigned int		recv_bulk_pipe;
@@ -142,17 +143,16 @@
 	int			sm_state;	 /* what we are doing	 */
 
 	/* control and bulk communications data */
-	struct urb		*current_urb;	 /* non-int USB requests */
-	struct usb_ctrlrequest	*dr;		 /* control requests	 */
-	struct usb_sg_request	current_sg;	 /* scatter-gather USB   */
+	struct urb		*current_urb;	 /* USB requests	 */
+	struct usb_ctrlrequest	*cr;		 /* control requests	 */
+	struct usb_sg_request	current_sg;	 /* scatter-gather req.  */
 	unsigned char		*iobuf;		 /* I/O buffer		 */
 
-	/* the semaphore for sleeping the control thread */
-	struct semaphore	sema;		 /* to sleep thread on   */
-
 	/* mutual exclusion structures */
+	struct semaphore	sema;		 /* to sleep thread on   */
 	struct completion	notify;		 /* thread begin/end	    */
-	struct us_unusual_dev   *unusual_dev;	 /* If unusual device       */
+
+	/* subdriver information */
 	void			*extra;		 /* Any extra data          */
 	extra_data_destructor	extra_destructor;/* extra data destructor   */
 };
