]> git.baikalelectronics.ru Git - kernel.git/commitdiff
usb: remove third argument of usb_maxpacket()
authorVincent Mailhol <mailhol.vincent@wanadoo.fr>
Thu, 17 Mar 2022 03:55:11 +0000 (12:55 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Apr 2022 08:33:53 +0000 (10:33 +0200)
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.

CC: Duncan Sands <duncan.sands@free.fr>
CC: Alan Stern <stern@rowland.harvard.edu>
CC: Olav Kongas <ok@artecdesign.ee>
CC: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://lore.kernel.org/r/20220317035514.6378-7-mailhol.vincent@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18 files changed:
drivers/usb/atm/usbatm.c
drivers/usb/c67x00/c67x00-sched.c
drivers/usb/core/hub.c
drivers/usb/host/ehci-q.c
drivers/usb/host/fhci-hcd.c
drivers/usb/host/fotg210-hcd.c
drivers/usb/host/isp116x-hcd.c
drivers/usb/host/isp1362-hcd.c
drivers/usb/host/max3421-hcd.c
drivers/usb/host/ohci-hcd.c
drivers/usb/host/oxu210hp-hcd.c
drivers/usb/host/r8a66597-hcd.c
drivers/usb/host/sl811-hcd.c
drivers/usb/isp1760/isp1760-hcd.c
drivers/usb/misc/ftdi-elan.c
drivers/usb/misc/lvstest.c
drivers/usb/storage/onetouch.c
drivers/usb/storage/transport.c

index e3a49d837609dd0bf5cbe6a512375eda0122fcc8..362217189ef315654cc6b8f245954c4d42740302 100644 (file)
@@ -1091,7 +1091,7 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id,
                        snd_buf_bytes - (snd_buf_bytes % instance->tx_channel.stride));
 
        /* rx buffer size must be a positive multiple of the endpoint maxpacket */
-       maxpacket = usb_maxpacket(usb_dev, instance->rx_channel.endpoint, 0);
+       maxpacket = usb_maxpacket(usb_dev, instance->rx_channel.endpoint);
 
        if ((maxpacket < 1) || (maxpacket > UDSL_MAX_BUF_SIZE)) {
                dev_err(dev, "%s: invalid endpoint %02x!\n", __func__,
index c7d3e907be814a1b4bb75dac6aaa90a827676be8..a09fa68a6ce7480909a06ab770775c195c590891 100644 (file)
@@ -655,7 +655,7 @@ static int c67x00_add_data_urb(struct c67x00_hcd *c67x00, struct urb *urb)
                               usb_pipeout(urb->pipe));
        remaining = urb->transfer_buffer_length - urb->actual_length;
 
-       maxps = usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe));
+       maxps = usb_maxpacket(urb->dev, urb->pipe);
 
        need_empty = (urb->transfer_flags & URB_ZERO_PACKET) &&
            usb_pipeout(urb->pipe) && !(remaining % maxps);
@@ -866,7 +866,7 @@ static inline int c67x00_end_of_data(struct c67x00_td *td)
        if (unlikely(!act_bytes))
                return 1;       /* This was an empty packet */
 
-       maxps = usb_maxpacket(td_udev(td), td->pipe, usb_pipeout(td->pipe));
+       maxps = usb_maxpacket(td_udev(td), td->pipe);
 
        if (unlikely(act_bytes < maxps))
                return 1;       /* Smaller then full packet */
index 1460857026e069b1949a85882e4ed74cb86c55f0..7781b2d31473c8e722d35a730f5ce9420a4eda56 100644 (file)
@@ -1635,7 +1635,7 @@ static int hub_configure(struct usb_hub *hub,
         * maxpktsize is defined in hcd.c's fake endpoint descriptors
         * to be big enough for at least USB_MAXCHILDREN ports. */
        pipe = usb_rcvintpipe(hdev, endpoint->bEndpointAddress);
-       maxp = usb_maxpacket(hdev, pipe, usb_pipeout(pipe));
+       maxp = usb_maxpacket(hdev, pipe);
 
        if (maxp > sizeof(*hub->buffer))
                maxp = sizeof(*hub->buffer);
index a2a5c299635015f2b5dd4e416b221c2a8d009f84..1163af6fad77137e67860f607225aa21279519d7 100644 (file)
@@ -645,7 +645,7 @@ qh_urb_transaction (
                token |= (1 /* "in" */ << 8);
        /* else it's already initted to "out" pid (0 << 8) */
 
-       maxpacket = usb_maxpacket(urb->dev, urb->pipe, !is_input);
+       maxpacket = usb_maxpacket(urb->dev, urb->pipe);
 
        /*
         * buffer gets wrapped in one or more qtds;
@@ -1218,7 +1218,7 @@ static int ehci_submit_single_step_set_feature(
 
        token |= (1 /* "in" */ << 8);  /*This is IN stage*/
 
-       maxpacket = usb_maxpacket(urb->dev, urb->pipe, 0);
+       maxpacket = usb_maxpacket(urb->dev, urb->pipe);
 
        qtd_fill(ehci, qtd, buf, len, token, maxpacket);
 
index a8e1048278d0c3bbf147c74154328473d06649df..2ba09c3fbc2f2d5a74879771f1e95aff57b0f5ec 100644 (file)
@@ -408,8 +408,7 @@ static int fhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
                        size++;
                else if ((urb->transfer_flags & URB_ZERO_PACKET) != 0
                         && (urb->transfer_buffer_length
-                            % usb_maxpacket(urb->dev, pipe,
-                                            usb_pipeout(pipe))) != 0)
+                            % usb_maxpacket(urb->dev, pipe)) != 0)
                        size++;
                break;
        case PIPE_ISOCHRONOUS:
index c3fd375b4778d44701a6728502c9af3457fba777..f8c111e08a0d5fc11e57dbc55a3022c012b4a68d 100644 (file)
@@ -2596,7 +2596,7 @@ static struct list_head *qh_urb_transaction(struct fotg210_hcd *fotg210,
                token |= (1 /* "in" */ << 8);
        /* else it's already initted to "out" pid (0 << 8) */
 
-       maxpacket = usb_maxpacket(urb->dev, urb->pipe, !is_input);
+       maxpacket = usb_maxpacket(urb->dev, urb->pipe);
 
        /*
         * buffer gets wrapped in one or more qtds;
index 8c7f0991c21b58c54e899115eb7c5189f6d836a9..4f564d71bb0bcc774e714c943c0f2a786b415cb9 100644 (file)
@@ -726,7 +726,7 @@ static int isp116x_urb_enqueue(struct usb_hcd *hcd,
                INIT_LIST_HEAD(&ep->schedule);
                ep->udev = udev;
                ep->epnum = epnum;
-               ep->maxpacket = usb_maxpacket(udev, urb->pipe, is_out);
+               ep->maxpacket = usb_maxpacket(udev, urb->pipe);
                usb_settoggle(udev, epnum, is_out, 0);
 
                if (type == PIPE_CONTROL) {
@@ -757,8 +757,7 @@ static int isp116x_urb_enqueue(struct usb_hcd *hcd,
                        ep->load = usb_calc_bus_time(udev->speed,
                                                     !is_out,
                                                     (type == PIPE_ISOCHRONOUS),
-                                                    usb_maxpacket(udev, pipe,
-                                                                  is_out)) /
+                                                    usb_maxpacket(udev, pipe)) /
                            1000;
                }
                hep->hcpriv = ep;
index d8610ce8f2ecd4f87eb3034b8ee6681806c6941f..0e14d1d07709daa51a48753f1adf26582cc9920c 100644 (file)
@@ -1279,7 +1279,7 @@ static int isp1362_urb_enqueue(struct usb_hcd *hcd,
                ep->udev = usb_get_dev(udev);
                ep->hep = hep;
                ep->epnum = epnum;
-               ep->maxpacket = usb_maxpacket(udev, urb->pipe, is_out);
+               ep->maxpacket = usb_maxpacket(udev, urb->pipe);
                ep->ptd_offset = -EINVAL;
                ep->ptd_index = -EINVAL;
                usb_settoggle(udev, epnum, is_out, 0);
@@ -1299,8 +1299,8 @@ static int isp1362_urb_enqueue(struct usb_hcd *hcd,
                        ep->interval = urb->interval;
                        ep->branch = PERIODIC_SIZE;
                        ep->load = usb_calc_bus_time(udev->speed, !is_out,
-                                                    (type == PIPE_ISOCHRONOUS),
-                                                    usb_maxpacket(udev, pipe, is_out)) / 1000;
+                                                    type == PIPE_ISOCHRONOUS,
+                                                    usb_maxpacket(udev, pipe)) / 1000;
                        break;
                }
                hep->hcpriv = ep;
index 99a5523a79fb9a3afe1224fd4ceac9ad05d9a20d..502a3ac5e35b3a1c28eef25355dcc4863140c92c 100644 (file)
@@ -546,7 +546,7 @@ max3421_transfer_out(struct usb_hcd *hcd, struct urb *urb, int fast_retransmit)
                return MAX3421_HXFR_BULK_OUT(epnum);
        }
 
-       max_packet = usb_maxpacket(urb->dev, urb->pipe, 1);
+       max_packet = usb_maxpacket(urb->dev, urb->pipe);
 
        if (max_packet > MAX3421_FIFO_SIZE) {
                /*
@@ -952,7 +952,7 @@ max3421_transfer_in_done(struct usb_hcd *hcd, struct urb *urb)
         * USB 2.0 Section 5.3.2 Pipes: packets must be full size
         * except for last one.
         */
-       max_packet = usb_maxpacket(urb->dev, urb->pipe, 0);
+       max_packet = usb_maxpacket(urb->dev, urb->pipe);
        if (max_packet > MAX3421_FIFO_SIZE) {
                /*
                 * We do not support isochronous transfers at this
@@ -998,7 +998,7 @@ max3421_transfer_out_done(struct usb_hcd *hcd, struct urb *urb)
                 * max_packet as an indicator that the end of the
                 * packet has been reached).
                 */
-               u32 max_packet = usb_maxpacket(urb->dev, urb->pipe, 1);
+               u32 max_packet = usb_maxpacket(urb->dev, urb->pipe);
 
                if (max3421_hcd->curr_len == max_packet)
                        return 0;
index 666b1c6651881f5ff68b60c8f05a80ceae40f1c1..c4c821c2288c262d88aa2864bb6a252937011a5f 100644 (file)
@@ -181,8 +181,7 @@ static int ohci_urb_enqueue (
                                size++;
                        else if ((urb->transfer_flags & URB_ZERO_PACKET) != 0
                                && (urb->transfer_buffer_length
-                                       % usb_maxpacket (urb->dev, pipe,
-                                               usb_pipeout (pipe))) == 0)
+                                       % usb_maxpacket(urb->dev, pipe)) == 0)
                                size++;
                        break;
                case PIPE_ISOCHRONOUS: /* number of packets from URB */
index 8b73c61f86c90e014550ce1aae7c6453a499cdce..3a441310c713280b7158af165adf9de765007216 100644 (file)
@@ -1685,7 +1685,7 @@ static struct list_head *qh_urb_transaction(struct oxu_hcd *oxu,
                token |= (1 /* "in" */ << 8);
        /* else it's already initted to "out" pid (0 << 8) */
 
-       maxpacket = usb_maxpacket(urb->dev, urb->pipe, !is_input);
+       maxpacket = usb_maxpacket(urb->dev, urb->pipe);
 
        /*
         * buffer gets wrapped in one or more qtds;
@@ -1796,7 +1796,7 @@ static struct ehci_qh *qh_make(struct oxu_hcd *oxu,
 
        is_input = usb_pipein(urb->pipe);
        type = usb_pipetype(urb->pipe);
-       maxp = usb_maxpacket(urb->dev, urb->pipe, !is_input);
+       maxp = usb_maxpacket(urb->dev, urb->pipe);
 
        /* Compute interrupt scheduling parameters just once, and save.
         * - allowing for high bandwidth, how many nsec/uframe are used?
index 63719cdf6a4e61f85fd9c0546950d41a490ad054..abb88dd40d4eb93581c1cf12836ac12b784d1940 100644 (file)
@@ -1867,8 +1867,7 @@ static struct r8a66597_td *r8a66597_make_td(struct r8a66597 *r8a66597,
        td->pipe = hep->hcpriv;
        td->urb = urb;
        td->address = get_urb_to_r8a66597_addr(r8a66597, urb);
-       td->maxpacket = usb_maxpacket(urb->dev, urb->pipe,
-                                     !usb_pipein(urb->pipe));
+       td->maxpacket = usb_maxpacket(urb->dev, urb->pipe);
        if (usb_pipecontrol(urb->pipe))
                td->type = USB_PID_SETUP;
        else if (usb_pipein(urb->pipe))
index 85623731a51626daa004eed6f2830abb77ddbfa3..d206bd95c7bbc2a10a4ebf15c5814a1c6600697a 100644 (file)
@@ -842,7 +842,7 @@ static int sl811h_urb_enqueue(
                INIT_LIST_HEAD(&ep->schedule);
                ep->udev = udev;
                ep->epnum = epnum;
-               ep->maxpacket = usb_maxpacket(udev, urb->pipe, is_out);
+               ep->maxpacket = usb_maxpacket(udev, urb->pipe);
                ep->defctrl = SL11H_HCTLMASK_ARM | SL11H_HCTLMASK_ENABLE;
                usb_settoggle(udev, epnum, is_out, 0);
 
@@ -878,8 +878,8 @@ static int sl811h_urb_enqueue(
                        if (type == PIPE_ISOCHRONOUS)
                                ep->defctrl |= SL11H_HCTLMASK_ISOCH;
                        ep->load = usb_calc_bus_time(udev->speed, !is_out,
-                               (type == PIPE_ISOCHRONOUS),
-                               usb_maxpacket(udev, pipe, is_out))
+                                                    type == PIPE_ISOCHRONOUS,
+                                                    usb_maxpacket(udev, pipe))
                                        / 1000;
                        break;
                }
index 893becb077d3b3f0be8a87c0fa5604e5bab076ee..76862ba40f35700d46a8416f138d650a8422502c 100644 (file)
@@ -825,8 +825,7 @@ static void create_ptd_atl(struct isp1760_qh *qh,
        memset(ptd, 0, sizeof(*ptd));
 
        /* according to 3.6.2, max packet len can not be > 0x400 */
-       maxpacket = usb_maxpacket(qtd->urb->dev, qtd->urb->pipe,
-                                               usb_pipeout(qtd->urb->pipe));
+       maxpacket = usb_maxpacket(qtd->urb->dev, qtd->urb->pipe);
        multi =  1 + ((maxpacket >> 11) & 0x3);
        maxpacket &= 0x7ff;
 
@@ -1808,8 +1807,7 @@ static void packetize_urb(struct usb_hcd *hcd,
                        packet_type = IN_PID;
        }
 
-       maxpacketsize = usb_maxpacket(urb->dev, urb->pipe,
-                                     usb_pipeout(urb->pipe));
+       maxpacketsize = usb_maxpacket(urb->dev, urb->pipe);
 
        /*
         * buffer gets wrapped in one or more qtds;
index 6c38c62d29b26f51afd66544993cd801de901f9d..b2f980409d0b5ead3161e29234e267e38a4416fd 100644 (file)
@@ -1449,8 +1449,7 @@ wait:if (ftdi->disconnected > 0) {
                        command->length = 0x8007;
                        command->address = (toggle_bits << 6) | (ep_number << 2)
                                | (address << 0);
-                       command->width = usb_maxpacket(urb->dev, urb->pipe,
-                                                      usb_pipeout(urb->pipe));
+                       command->width = usb_maxpacket(urb->dev, urb->pipe);
                        command->follows = 8;
                        command->value = 0;
                        command->buffer = urb->setup_packet;
@@ -1514,8 +1513,7 @@ wait:if (ftdi->disconnected > 0) {
                                                            1);
                        command->address = (toggle_bits << 6) | (ep_number << 2)
                                | (address << 0);
-                       command->width = usb_maxpacket(urb->dev, urb->pipe,
-                                                      usb_pipeout(urb->pipe));
+                       command->width = usb_maxpacket(urb->dev, urb->pipe);
                        command->follows = 0;
                        command->value = 0;
                        command->buffer = NULL;
@@ -1571,8 +1569,7 @@ wait:if (ftdi->disconnected > 0) {
                        command->length = 0x0000;
                        command->address = (toggle_bits << 6) | (ep_number << 2)
                                | (address << 0);
-                       command->width = usb_maxpacket(urb->dev, urb->pipe,
-                                                      usb_pipeout(urb->pipe));
+                       command->width = usb_maxpacket(urb->dev, urb->pipe);
                        command->follows = 0;
                        command->value = 0;
                        command->buffer = NULL;
@@ -1634,8 +1631,7 @@ wait:if (ftdi->disconnected > 0) {
                        command->header = 0x81 | (ed << 5);
                        command->address = (toggle_bits << 6) | (ep_number << 2)
                                | (address << 0);
-                       command->width = usb_maxpacket(urb->dev, urb->pipe,
-                                                      usb_pipeout(urb->pipe));
+                       command->width = usb_maxpacket(urb->dev, urb->pipe);
                        command->follows = min_t(u32, 1024,
                                                 urb->transfer_buffer_length -
                                                 urb->actual_length);
@@ -1715,8 +1711,7 @@ wait:if (ftdi->disconnected > 0) {
                                                            1);
                        command->address = (toggle_bits << 6) | (ep_number << 2)
                                | (address << 0);
-                       command->width = usb_maxpacket(urb->dev, urb->pipe,
-                                                      usb_pipeout(urb->pipe));
+                       command->width = usb_maxpacket(urb->dev, urb->pipe);
                        command->follows = 0;
                        command->value = 0;
                        command->buffer = NULL;
index f8686139d6f392bd51ee59309faaf466514eb043..25ec5666a75e90558e13d7572a146d260faecd56 100644 (file)
@@ -437,7 +437,7 @@ static int lvs_rh_probe(struct usb_interface *intf,
        INIT_WORK(&lvs->rh_work, lvs_rh_work);
 
        pipe = usb_rcvintpipe(hdev, endpoint->bEndpointAddress);
-       maxp = usb_maxpacket(hdev, pipe, usb_pipeout(pipe));
+       maxp = usb_maxpacket(hdev, pipe);
        usb_fill_int_urb(lvs->urb, hdev, pipe, &lvs->buffer[0], maxp,
                        lvs_rh_irq, lvs, endpoint->bInterval);
 
index a989fe930e21108b6863bdf99ce3572b2417f0eb..1db2eefeea22f0bb3528dc413dbf76c97989414a 100644 (file)
@@ -180,7 +180,7 @@ static int onetouch_connect_input(struct us_data *ss)
                return -ENODEV;
 
        pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress);
-       maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe));
+       maxp = usb_maxpacket(udev, pipe);
        maxp = min(maxp, ONETOUCH_PKT_LEN);
 
        onetouch = kzalloc(sizeof(struct usb_onetouch), GFP_KERNEL);
index 1928b391824258e534eb12d79835e73e47fdaf5d..64d96d210e02c4477d3d900f96914ffea822f70d 100644 (file)
@@ -363,7 +363,7 @@ static int usb_stor_intr_transfer(struct us_data *us, void *buf,
        usb_stor_dbg(us, "xfer %u bytes\n", length);
 
        /* calculate the max packet size */
-       maxp = usb_maxpacket(us->pusb_dev, pipe, usb_pipeout(pipe));
+       maxp = usb_maxpacket(us->pusb_dev, pipe);
        if (maxp > length)
                maxp = length;