Commit 0681fb47 authored by Matthew Dharm's avatar Matthew Dharm Committed by Greg Kroah-Hartman

[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.
parent 808ba4b3
......@@ -207,15 +207,15 @@ int usb_stor_control_msg(struct us_data *us, unsigned int pipe,
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 @@ int usb_stor_ctrl_transfer(struct us_data *us, unsigned int pipe,
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);
......
......@@ -513,15 +513,15 @@ static void get_device_info(struct us_data *us, int id_index)
/* 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 @@ static int usb_stor_acquire_resources(struct us_data *us)
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 @@ void usb_stor_release_resources(struct us_data *us)
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);
......
......@@ -108,6 +108,7 @@ struct us_data {
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 @@ struct us_data {
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 */
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment