History

usb: remove third argument of usb_maxpacket()

The third argument of usb_maxpacket(): in_out has been deprecated because it could be derived from the second argument (e.g. using usb_pipeout(pipe)). N.B. function usb_maxpacket() was made variadic to accommodate the transition from the old prototype with three arguments to the new one with only two arguments (so that no renaming is needed). The variadic argument is to be removed once all users of usb_maxpacket() get migrated.

Vincent Mailhol committed 4 years ago

Commit dcd2e491 parent e13adbf18 files · +33 −44Browse files

Unified · Split

18 files
  1. drivers/usb/atm/usbatm.c +1 −1
  2. drivers/usb/c67x00/c67x00-sched.c +2 −2
  3. drivers/usb/core/hub.c +1 −1
  4. drivers/usb/host/ehci-q.c +2 −2
  5. drivers/usb/host/fhci-hcd.c +1 −2
  6. drivers/usb/host/fotg210-hcd.c +1 −1
  7. drivers/usb/host/isp116x-hcd.c +2 −3
  8. drivers/usb/host/isp1362-hcd.c +3 −3
  9. drivers/usb/host/max3421-hcd.c +3 −3
  10. drivers/usb/host/ohci-hcd.c +1 −2
  11. drivers/usb/host/oxu210hp-hcd.c +2 −2
  12. drivers/usb/host/r8a66597-hcd.c +1 −2
  13. drivers/usb/host/sl811-hcd.c +3 −3
  14. drivers/usb/isp1760/isp1760-hcd.c +2 −4
  15. drivers/usb/misc/ftdi-elan.c +5 −10
  16. drivers/usb/misc/lvstest.c +1 −1
  17. drivers/usb/storage/onetouch.c +1 −1
  18. drivers/usb/storage/transport.c +1 −1
drivers/usb/atm/usbatm.c+1−1
@@ -1091,7 +1091,7 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id, · 1090 unmodified lines
10911091 snd_buf_bytes - (snd_buf_bytes % instance->tx_channel.stride));
10921092
10931093 /* rx buffer size must be a positive multiple of the endpoint maxpacket */
1094− maxpacket = usb_maxpacket(usb_dev, instance->rx_channel.endpoint, 0);
1094+ maxpacket = usb_maxpacket(usb_dev, instance->rx_channel.endpoint);
10951095
10961096 if ((maxpacket < 1) || (maxpacket > UDSL_MAX_BUF_SIZE)) {
10971097 dev_err(dev, "%s: invalid endpoint %02x!\n", __func__,
drivers/usb/c67x00/c67x00-sched.c+2−2
@@ -655,7 +655,7 @@ static int c67x00_add_data_urb(struct c67x00_hcd *c67x00, struct urb *urb) · 654 unmodified lines
655655 usb_pipeout(urb->pipe));
656656 remaining = urb->transfer_buffer_length - urb->actual_length;
657657
658− maxps = usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe));
658+ maxps = usb_maxpacket(urb->dev, urb->pipe);
659659
660660 need_empty = (urb->transfer_flags & URB_ZERO_PACKET) &&
661661 usb_pipeout(urb->pipe) && !(remaining % maxps);
@@ -866,7 +866,7 @@ static inline int c67x00_end_of_data(struct c67x00_td *td) · 204 unmodified lines
866866 if (unlikely(!act_bytes))
867867 return 1; /* This was an empty packet */
868868
869− maxps = usb_maxpacket(td_udev(td), td->pipe, usb_pipeout(td->pipe));
869+ maxps = usb_maxpacket(td_udev(td), td->pipe);
870870
871871 if (unlikely(act_bytes < maxps))
872872 return 1; /* Smaller then full packet */
drivers/usb/core/hub.c+1−1
@@ -1635,7 +1635,7 @@ static int hub_configure(struct usb_hub *hub, · 1634 unmodified lines
16351635 * maxpktsize is defined in hcd.c's fake endpoint descriptors
16361636 * to be big enough for at least USB_MAXCHILDREN ports. */
16371637 pipe = usb_rcvintpipe(hdev, endpoint->bEndpointAddress);
1638− maxp = usb_maxpacket(hdev, pipe, usb_pipeout(pipe));
1638+ maxp = usb_maxpacket(hdev, pipe);
16391639
16401640 if (maxp > sizeof(*hub->buffer))
16411641 maxp = sizeof(*hub->buffer);
drivers/usb/host/ehci-q.c+2−2
@@ -645,7 +645,7 @@ qh_urb_transaction ( · 644 unmodified lines
645645 token |= (1 /* "in" */ << 8);
646646 /* else it's already initted to "out" pid (0 << 8) */
647647
648− maxpacket = usb_maxpacket(urb->dev, urb->pipe, !is_input);
648+ maxpacket = usb_maxpacket(urb->dev, urb->pipe);
649649
650650 /*
651651 * buffer gets wrapped in one or more qtds;
@@ -1218,7 +1218,7 @@ static int ehci_submit_single_step_set_feature( · 566 unmodified lines
12181218
12191219 token |= (1 /* "in" */ << 8); /*This is IN stage*/
12201220
1221− maxpacket = usb_maxpacket(urb->dev, urb->pipe, 0);
1221+ maxpacket = usb_maxpacket(urb->dev, urb->pipe);
12221222
12231223 qtd_fill(ehci, qtd, buf, len, token, maxpacket);
12241224
drivers/usb/host/fhci-hcd.c+1−2
@@ -408,8 +408,7 @@ static int fhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, · 407 unmodified lines
408408 size++;
409409 else if ((urb->transfer_flags & URB_ZERO_PACKET) != 0
410410 && (urb->transfer_buffer_length
411− % usb_maxpacket(urb->dev, pipe,
412− usb_pipeout(pipe))) != 0)
411+ % usb_maxpacket(urb->dev, pipe)) != 0)
413412 size++;
414413 break;
415414 case PIPE_ISOCHRONOUS:
drivers/usb/host/fotg210-hcd.c+1−1
@@ -2596,7 +2596,7 @@ static struct list_head *qh_urb_transaction(struct fotg210_hcd *fotg210, · 2595 unmodified lines
25962596 token |= (1 /* "in" */ << 8);
25972597 /* else it's already initted to "out" pid (0 << 8) */
25982598
2599− maxpacket = usb_maxpacket(urb->dev, urb->pipe, !is_input);
2599+ maxpacket = usb_maxpacket(urb->dev, urb->pipe);
26002600
26012601 /*
26022602 * buffer gets wrapped in one or more qtds;
drivers/usb/host/isp116x-hcd.c+2−3
@@ -726,7 +726,7 @@ static int isp116x_urb_enqueue(struct usb_hcd *hcd, · 725 unmodified lines
726726 INIT_LIST_HEAD(&ep->schedule);
727727 ep->udev = udev;
728728 ep->epnum = epnum;
729− ep->maxpacket = usb_maxpacket(udev, urb->pipe, is_out);
729+ ep->maxpacket = usb_maxpacket(udev, urb->pipe);
730730 usb_settoggle(udev, epnum, is_out, 0);
731731
732732 if (type == PIPE_CONTROL) {
@@ -757,8 +757,7 @@ static int isp116x_urb_enqueue(struct usb_hcd *hcd, · 24 unmodified lines
757757 ep->load = usb_calc_bus_time(udev->speed,
758758 !is_out,
759759 (type == PIPE_ISOCHRONOUS),
760− usb_maxpacket(udev, pipe,
761− is_out)) /
760+ usb_maxpacket(udev, pipe)) /
762761 1000;
763762 }
764763 hep->hcpriv = ep;
drivers/usb/host/isp1362-hcd.c+3−3
@@ -1279,7 +1279,7 @@ static int isp1362_urb_enqueue(struct usb_hcd *hcd, · 1278 unmodified lines
12791279 ep->udev = usb_get_dev(udev);
12801280 ep->hep = hep;
12811281 ep->epnum = epnum;
1282− ep->maxpacket = usb_maxpacket(udev, urb->pipe, is_out);
1282+ ep->maxpacket = usb_maxpacket(udev, urb->pipe);
12831283 ep->ptd_offset = -EINVAL;
12841284 ep->ptd_index = -EINVAL;
12851285 usb_settoggle(udev, epnum, is_out, 0);
@@ -1299,8 +1299,8 @@ static int isp1362_urb_enqueue(struct usb_hcd *hcd, · 13 unmodified lines
12991299 ep->interval = urb->interval;
13001300 ep->branch = PERIODIC_SIZE;
13011301 ep->load = usb_calc_bus_time(udev->speed, !is_out,
1302− (type == PIPE_ISOCHRONOUS),
1303− usb_maxpacket(udev, pipe, is_out)) / 1000;
1302+ type == PIPE_ISOCHRONOUS,
1303+ usb_maxpacket(udev, pipe)) / 1000;
13041304 break;
13051305 }
13061306 hep->hcpriv = ep;
drivers/usb/host/max3421-hcd.c+3−3
@@ -546,7 +546,7 @@ max3421_transfer_out(struct usb_hcd *hcd, struct urb *urb, int fast_retransmit) · 545 unmodified lines
546546 return MAX3421_HXFR_BULK_OUT(epnum);
547547 }
548548
549− max_packet = usb_maxpacket(urb->dev, urb->pipe, 1);
549+ max_packet = usb_maxpacket(urb->dev, urb->pipe);
550550
551551 if (max_packet > MAX3421_FIFO_SIZE) {
552552 /*
@@ -952,7 +952,7 @@ max3421_transfer_in_done(struct usb_hcd *hcd, struct urb *urb) · 399 unmodified lines
952952 * USB 2.0 Section 5.3.2 Pipes: packets must be full size
953953 * except for last one.
954954 */
955− max_packet = usb_maxpacket(urb->dev, urb->pipe, 0);
955+ max_packet = usb_maxpacket(urb->dev, urb->pipe);
956956 if (max_packet > MAX3421_FIFO_SIZE) {
957957 /*
958958 * We do not support isochronous transfers at this
@@ -998,7 +998,7 @@ max3421_transfer_out_done(struct usb_hcd *hcd, struct urb *urb) · 39 unmodified lines
998998 * max_packet as an indicator that the end of the
999999 * packet has been reached).
10001000 */
1001− u32 max_packet = usb_maxpacket(urb->dev, urb->pipe, 1);
1001+ u32 max_packet = usb_maxpacket(urb->dev, urb->pipe);
10021002
10031003 if (max3421_hcd->curr_len == max_packet)
10041004 return 0;
drivers/usb/host/ohci-hcd.c+1−2
@@ -181,8 +181,7 @@ static int ohci_urb_enqueue ( · 180 unmodified lines
181181 size++;
182182 else if ((urb->transfer_flags & URB_ZERO_PACKET) != 0
183183 && (urb->transfer_buffer_length
184− % usb_maxpacket (urb->dev, pipe,
185− usb_pipeout (pipe))) == 0)
184+ % usb_maxpacket(urb->dev, pipe)) == 0)
186185 size++;
187186 break;
188187 case PIPE_ISOCHRONOUS: /* number of packets from URB */
drivers/usb/host/oxu210hp-hcd.c+2−2
@@ -1685,7 +1685,7 @@ static struct list_head *qh_urb_transaction(struct oxu_hcd *oxu, · 1684 unmodified lines
16851685 token |= (1 /* "in" */ << 8);
16861686 /* else it's already initted to "out" pid (0 << 8) */
16871687
1688− maxpacket = usb_maxpacket(urb->dev, urb->pipe, !is_input);
1688+ maxpacket = usb_maxpacket(urb->dev, urb->pipe);
16891689
16901690 /*
16911691 * buffer gets wrapped in one or more qtds;
@@ -1796,7 +1796,7 @@ static struct ehci_qh *qh_make(struct oxu_hcd *oxu, · 104 unmodified lines
17961796
17971797 is_input = usb_pipein(urb->pipe);
17981798 type = usb_pipetype(urb->pipe);
1799− maxp = usb_maxpacket(urb->dev, urb->pipe, !is_input);
1799+ maxp = usb_maxpacket(urb->dev, urb->pipe);
18001800
18011801 /* Compute interrupt scheduling parameters just once, and save.
18021802 * - allowing for high bandwidth, how many nsec/uframe are used?
drivers/usb/host/r8a66597-hcd.c+1−2
@@ -1867,8 +1867,7 @@ static struct r8a66597_td *r8a66597_make_td(struct r8a66597 *r8a66597, · 1866 unmodified lines
18671867 td->pipe = hep->hcpriv;
18681868 td->urb = urb;
18691869 td->address = get_urb_to_r8a66597_addr(r8a66597, urb);
1870− td->maxpacket = usb_maxpacket(urb->dev, urb->pipe,
1871− !usb_pipein(urb->pipe));
1870+ td->maxpacket = usb_maxpacket(urb->dev, urb->pipe);
18721871 if (usb_pipecontrol(urb->pipe))
18731872 td->type = USB_PID_SETUP;
18741873 else if (usb_pipein(urb->pipe))
drivers/usb/host/sl811-hcd.c+3−3
@@ -842,7 +842,7 @@ static int sl811h_urb_enqueue( · 841 unmodified lines
842842 INIT_LIST_HEAD(&ep->schedule);
843843 ep->udev = udev;
844844 ep->epnum = epnum;
845− ep->maxpacket = usb_maxpacket(udev, urb->pipe, is_out);
845+ ep->maxpacket = usb_maxpacket(udev, urb->pipe);
846846 ep->defctrl = SL11H_HCTLMASK_ARM | SL11H_HCTLMASK_ENABLE;
847847 usb_settoggle(udev, epnum, is_out, 0);
848848
@@ -878,8 +878,8 @@ static int sl811h_urb_enqueue( · 29 unmodified lines
878878 if (type == PIPE_ISOCHRONOUS)
879879 ep->defctrl |= SL11H_HCTLMASK_ISOCH;
880880 ep->load = usb_calc_bus_time(udev->speed, !is_out,
881− (type == PIPE_ISOCHRONOUS),
882− usb_maxpacket(udev, pipe, is_out))
881+ type == PIPE_ISOCHRONOUS,
882+ usb_maxpacket(udev, pipe))
883883 / 1000;
884884 break;
885885 }
drivers/usb/isp1760/isp1760-hcd.c+2−4
@@ -825,8 +825,7 @@ static void create_ptd_atl(struct isp1760_qh *qh, · 824 unmodified lines
825825 memset(ptd, 0, sizeof(*ptd));
826826
827827 /* according to 3.6.2, max packet len can not be > 0x400 */
828− maxpacket = usb_maxpacket(qtd->urb->dev, qtd->urb->pipe,
829− usb_pipeout(qtd->urb->pipe));
828+ maxpacket = usb_maxpacket(qtd->urb->dev, qtd->urb->pipe);
830829 multi = 1 + ((maxpacket >> 11) & 0x3);
831830 maxpacket &= 0x7ff;
832831
@@ -1808,8 +1807,7 @@ static void packetize_urb(struct usb_hcd *hcd, · 975 unmodified lines
18081807 packet_type = IN_PID;
18091808 }
18101809
1811− maxpacketsize = usb_maxpacket(urb->dev, urb->pipe,
1812− usb_pipeout(urb->pipe));
1810+ maxpacketsize = usb_maxpacket(urb->dev, urb->pipe);
18131811
18141812 /*
18151813 * buffer gets wrapped in one or more qtds;
drivers/usb/misc/ftdi-elan.c+5−10
@@ -1449,8 +1449,7 @@ wait:if (ftdi->disconnected > 0) { · 1448 unmodified lines
14491449 command->length = 0x8007;
14501450 command->address = (toggle_bits << 6) | (ep_number << 2)
14511451 | (address << 0);
1452− command->width = usb_maxpacket(urb->dev, urb->pipe,
1453− usb_pipeout(urb->pipe));
1452+ command->width = usb_maxpacket(urb->dev, urb->pipe);
14541453 command->follows = 8;
14551454 command->value = 0;
14561455 command->buffer = urb->setup_packet;
@@ -1514,8 +1513,7 @@ wait:if (ftdi->disconnected > 0) { · 57 unmodified lines
15141513 1);
15151514 command->address = (toggle_bits << 6) | (ep_number << 2)
15161515 | (address << 0);
1517− command->width = usb_maxpacket(urb->dev, urb->pipe,
1518− usb_pipeout(urb->pipe));
1516+ command->width = usb_maxpacket(urb->dev, urb->pipe);
15191517 command->follows = 0;
15201518 command->value = 0;
15211519 command->buffer = NULL;
@@ -1571,8 +1569,7 @@ wait:if (ftdi->disconnected > 0) { · 49 unmodified lines
15711569 command->length = 0x0000;
15721570 command->address = (toggle_bits << 6) | (ep_number << 2)
15731571 | (address << 0);
1574− command->width = usb_maxpacket(urb->dev, urb->pipe,
1575− usb_pipeout(urb->pipe));
1572+ command->width = usb_maxpacket(urb->dev, urb->pipe);
15761573 command->follows = 0;
15771574 command->value = 0;
15781575 command->buffer = NULL;
@@ -1634,8 +1631,7 @@ wait:if (ftdi->disconnected > 0) { · 55 unmodified lines
16341631 command->header = 0x81 | (ed << 5);
16351632 command->address = (toggle_bits << 6) | (ep_number << 2)
16361633 | (address << 0);
1637− command->width = usb_maxpacket(urb->dev, urb->pipe,
1638− usb_pipeout(urb->pipe));
1634+ command->width = usb_maxpacket(urb->dev, urb->pipe);
16391635 command->follows = min_t(u32, 1024,
16401636 urb->transfer_buffer_length -
16411637 urb->actual_length);
@@ -1715,8 +1711,7 @@ wait:if (ftdi->disconnected > 0) { · 73 unmodified lines
17151711 1);
17161712 command->address = (toggle_bits << 6) | (ep_number << 2)
17171713 | (address << 0);
1718− command->width = usb_maxpacket(urb->dev, urb->pipe,
1719− usb_pipeout(urb->pipe));
1714+ command->width = usb_maxpacket(urb->dev, urb->pipe);
17201715 command->follows = 0;
17211716 command->value = 0;
17221717 command->buffer = NULL;
drivers/usb/misc/lvstest.c+1−1
@@ -437,7 +437,7 @@ static int lvs_rh_probe(struct usb_interface *intf, · 436 unmodified lines
437437 INIT_WORK(&lvs->rh_work, lvs_rh_work);
438438
439439 pipe = usb_rcvintpipe(hdev, endpoint->bEndpointAddress);
440− maxp = usb_maxpacket(hdev, pipe, usb_pipeout(pipe));
440+ maxp = usb_maxpacket(hdev, pipe);
441441 usb_fill_int_urb(lvs->urb, hdev, pipe, &lvs->buffer[0], maxp,
442442 lvs_rh_irq, lvs, endpoint->bInterval);
443443
drivers/usb/storage/onetouch.c+1−1
@@ -180,7 +180,7 @@ static int onetouch_connect_input(struct us_data *ss) · 179 unmodified lines
180180 return -ENODEV;
181181
182182 pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress);
183− maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe));
183+ maxp = usb_maxpacket(udev, pipe);
184184 maxp = min(maxp, ONETOUCH_PKT_LEN);
185185
186186 onetouch = kzalloc(sizeof(struct usb_onetouch), GFP_KERNEL);
drivers/usb/storage/transport.c+1−1
@@ -363,7 +363,7 @@ static int usb_stor_intr_transfer(struct us_data *us, void *buf, · 362 unmodified lines
363363 usb_stor_dbg(us, "xfer %u bytes\n", length);
364364
365365 /* calculate the max packet size */
366− maxp = usb_maxpacket(us->pusb_dev, pipe, usb_pipeout(pipe));
366+ maxp = usb_maxpacket(us->pusb_dev, pipe);
367367 if (maxp > length)
368368 maxp = length;
369369

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t