ChangeSet 1.831.15.15, 2002/12/09 11:00:37-08:00, mdharm-usb@one-eyed-alien.net [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. diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c --- a/drivers/usb/storage/transport.c Mon Dec 9 11:40:58 2002 +++ b/drivers/usb/storage/transport.c Mon Dec 9 11:40:58 2002 @@ -507,7 +507,7 @@ * to make aborts/resets/timeouts work * * 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, unsigned int len, unsigned int *act_len) @@ -524,7 +524,7 @@ /* fill and submit the URB */ usb_fill_int_urb(us->current_urb, us->pusb_dev, pipe, data, maxp, usb_stor_blocking_completion, NULL, - us->ep_int->bInterval); + us->ep_bInterval); status = usb_stor_msg_common(us); /* store the actual length of the data transferred */ diff -Nru a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c --- a/drivers/usb/storage/usb.c Mon Dec 9 11:40:58 2002 +++ b/drivers/usb/storage/usb.c Mon Dec 9 11:40:58 2002 @@ -486,12 +486,11 @@ static int usb_stor_allocate_urbs(struct us_data *ss) { /* 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->recv_ctrl_pipe = usb_rcvctrlpipe(ss->pusb_dev, 0); - ss->recv_intr_pipe = usb_rcvintpipe(ss->pusb_dev, - ss->ep_int->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); + 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->recv_intr_pipe = usb_rcvintpipe(ss->pusb_dev, ss->ep_int); /* allocate the usb_ctrlrequest for control packets */ US_DEBUGP("Allocating usb_ctrlrequest\n"); @@ -729,7 +728,9 @@ USB_ENDPOINT_NUMBER_MASK; ss->ep_out = ep_out->bEndpointAddress & 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 */ if (usb_stor_allocate_urbs(ss)) @@ -770,7 +771,9 @@ USB_ENDPOINT_NUMBER_MASK; ss->ep_out = ep_out->bEndpointAddress & 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 */ ss->ifnum = ifnum; diff -Nru a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h --- a/drivers/usb/storage/usb.h Mon Dec 9 11:40:58 2002 +++ b/drivers/usb/storage/usb.h Mon Dec 9 11:40:58 2002 @@ -154,7 +154,8 @@ u8 ifnum; /* interface number */ u8 ep_in; /* bulk in 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 */ trans_cmnd transport; /* transport function */