Commit 4e1f80b6 authored by Matthew Dharm's avatar Matthew Dharm Committed by Greg Kroah-Hartman

[PATCH] PATCH: usb-storage: make internal structs more consistent

This patch makes ss->ep_int just like ep_in and ep_out for improved code
symmetry and readability.  It may (on some architectures) also shrink the
size of the per-device data structure.
parent 05f184c0
...@@ -507,7 +507,7 @@ int usb_stor_bulk_msg(struct us_data *us, void *data, unsigned int pipe, ...@@ -507,7 +507,7 @@ int usb_stor_bulk_msg(struct us_data *us, void *data, unsigned int pipe,
* to make aborts/resets/timeouts work * to make aborts/resets/timeouts work
* *
* This routine always uses us->recv_intr_pipe as the pipe and * This routine always uses us->recv_intr_pipe as the pipe and
* us->ep_int->bInterval as the interrupt interval. * us->ep_bInterval as the interrupt interval.
*/ */
int usb_stor_interrupt_msg(struct us_data *us, void *data, int usb_stor_interrupt_msg(struct us_data *us, void *data,
unsigned int len, unsigned int *act_len) unsigned int len, unsigned int *act_len)
...@@ -524,7 +524,7 @@ int usb_stor_interrupt_msg(struct us_data *us, void *data, ...@@ -524,7 +524,7 @@ int usb_stor_interrupt_msg(struct us_data *us, void *data,
/* fill and submit the URB */ /* fill and submit the URB */
usb_fill_int_urb(us->current_urb, us->pusb_dev, pipe, data, usb_fill_int_urb(us->current_urb, us->pusb_dev, pipe, data,
maxp, usb_stor_blocking_completion, NULL, maxp, usb_stor_blocking_completion, NULL,
us->ep_int->bInterval); us->ep_bInterval);
status = usb_stor_msg_common(us); status = usb_stor_msg_common(us);
/* store the actual length of the data transferred */ /* store the actual length of the data transferred */
......
...@@ -486,12 +486,11 @@ static int usb_stor_control_thread(void * __us) ...@@ -486,12 +486,11 @@ static int usb_stor_control_thread(void * __us)
static int usb_stor_allocate_urbs(struct us_data *ss) static int usb_stor_allocate_urbs(struct us_data *ss)
{ {
/* calculate and store the pipe values */ /* calculate and store the pipe values */
ss->send_bulk_pipe = usb_sndbulkpipe(ss->pusb_dev, ss->ep_out);
ss->recv_bulk_pipe = usb_rcvbulkpipe(ss->pusb_dev, ss->ep_in);
ss->send_ctrl_pipe = usb_sndctrlpipe(ss->pusb_dev, 0); ss->send_ctrl_pipe = usb_sndctrlpipe(ss->pusb_dev, 0);
ss->recv_ctrl_pipe = usb_rcvctrlpipe(ss->pusb_dev, 0); ss->recv_ctrl_pipe = usb_rcvctrlpipe(ss->pusb_dev, 0);
ss->recv_intr_pipe = usb_rcvintpipe(ss->pusb_dev, ss->send_bulk_pipe = usb_sndbulkpipe(ss->pusb_dev, ss->ep_out);
ss->ep_int->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); ss->recv_bulk_pipe = usb_rcvbulkpipe(ss->pusb_dev, ss->ep_in);
ss->recv_intr_pipe = usb_rcvintpipe(ss->pusb_dev, ss->ep_int);
/* allocate the usb_ctrlrequest for control packets */ /* allocate the usb_ctrlrequest for control packets */
US_DEBUGP("Allocating usb_ctrlrequest\n"); US_DEBUGP("Allocating usb_ctrlrequest\n");
...@@ -729,7 +728,9 @@ static int storage_probe(struct usb_interface *intf, ...@@ -729,7 +728,9 @@ static int storage_probe(struct usb_interface *intf,
USB_ENDPOINT_NUMBER_MASK; USB_ENDPOINT_NUMBER_MASK;
ss->ep_out = ep_out->bEndpointAddress & ss->ep_out = ep_out->bEndpointAddress &
USB_ENDPOINT_NUMBER_MASK; USB_ENDPOINT_NUMBER_MASK;
ss->ep_int = ep_int; ss->ep_int = ep_int->bEndpointAddress &
USB_ENDPOINT_NUMBER_MASK;
ss->ep_bInterval = ep_int->bInterval;
/* allocate the URB, the usb_ctrlrequest, and the IRQ URB */ /* allocate the URB, the usb_ctrlrequest, and the IRQ URB */
if (usb_stor_allocate_urbs(ss)) if (usb_stor_allocate_urbs(ss))
...@@ -770,7 +771,9 @@ static int storage_probe(struct usb_interface *intf, ...@@ -770,7 +771,9 @@ static int storage_probe(struct usb_interface *intf,
USB_ENDPOINT_NUMBER_MASK; USB_ENDPOINT_NUMBER_MASK;
ss->ep_out = ep_out->bEndpointAddress & ss->ep_out = ep_out->bEndpointAddress &
USB_ENDPOINT_NUMBER_MASK; USB_ENDPOINT_NUMBER_MASK;
ss->ep_int = ep_int; ss->ep_int = ep_int->bEndpointAddress &
USB_ENDPOINT_NUMBER_MASK;
ss->ep_bInterval = ep_int->bInterval;
/* establish the connection to the new device */ /* establish the connection to the new device */
ss->ifnum = ifnum; ss->ifnum = ifnum;
......
...@@ -154,7 +154,8 @@ struct us_data { ...@@ -154,7 +154,8 @@ struct us_data {
u8 ifnum; /* interface number */ u8 ifnum; /* interface number */
u8 ep_in; /* bulk in endpoint */ u8 ep_in; /* bulk in endpoint */
u8 ep_out; /* bulk out endpoint */ u8 ep_out; /* bulk out endpoint */
struct usb_endpoint_descriptor *ep_int; /* interrupt endpoint */ u8 ep_int; /* interrupt endpoint */
u8 ep_bInterval; /* interrupt interval */
/* function pointers for this device */ /* function pointers for this device */
trans_cmnd transport; /* transport function */ trans_cmnd transport; /* transport function */
......
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