Commit dcd2e49b authored by Vincent Mailhol's avatar Vincent Mailhol Committed by Greg Kroah-Hartman
Browse files

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.

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: default avatarVincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://lore.kernel.org/r/20220317035514.6378-7-mailhol.vincent@wanadoo.fr


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e13adbfa
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -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));
			snd_buf_bytes - (snd_buf_bytes % instance->tx_channel.stride));


	/* rx buffer size must be a positive multiple of the endpoint maxpacket */
	/* 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)) {
	if ((maxpacket < 1) || (maxpacket > UDSL_MAX_BUF_SIZE)) {
		dev_err(dev, "%s: invalid endpoint %02x!\n", __func__,
		dev_err(dev, "%s: invalid endpoint %02x!\n", __func__,
+2 −2
Original line number Original line Diff line number Diff line
@@ -655,7 +655,7 @@ static int c67x00_add_data_urb(struct c67x00_hcd *c67x00, struct urb *urb)
			       usb_pipeout(urb->pipe));
			       usb_pipeout(urb->pipe));
	remaining = urb->transfer_buffer_length - urb->actual_length;
	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) &&
	need_empty = (urb->transfer_flags & URB_ZERO_PACKET) &&
	    usb_pipeout(urb->pipe) && !(remaining % maxps);
	    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))
	if (unlikely(!act_bytes))
		return 1;	/* This was an empty packet */
		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))
	if (unlikely(act_bytes < maxps))
		return 1;	/* Smaller then full packet */
		return 1;	/* Smaller then full packet */
+1 −1
Original line number Original line Diff line number Diff line
@@ -1635,7 +1635,7 @@ static int hub_configure(struct usb_hub *hub,
	 * maxpktsize is defined in hcd.c's fake endpoint descriptors
	 * maxpktsize is defined in hcd.c's fake endpoint descriptors
	 * to be big enough for at least USB_MAXCHILDREN ports. */
	 * to be big enough for at least USB_MAXCHILDREN ports. */
	pipe = usb_rcvintpipe(hdev, endpoint->bEndpointAddress);
	pipe = usb_rcvintpipe(hdev, endpoint->bEndpointAddress);
	maxp = usb_maxpacket(hdev, pipe, usb_pipeout(pipe));
	maxp = usb_maxpacket(hdev, pipe);


	if (maxp > sizeof(*hub->buffer))
	if (maxp > sizeof(*hub->buffer))
		maxp = sizeof(*hub->buffer);
		maxp = sizeof(*hub->buffer);
+2 −2
Original line number Original line Diff line number Diff line
@@ -645,7 +645,7 @@ qh_urb_transaction (
		token |= (1 /* "in" */ << 8);
		token |= (1 /* "in" */ << 8);
	/* else it's already initted to "out" pid (0 << 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;
	 * 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*/
	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);
	qtd_fill(ehci, qtd, buf, len, token, maxpacket);


+1 −2
Original line number Original line Diff line number Diff line
@@ -408,8 +408,7 @@ static int fhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
			size++;
			size++;
		else if ((urb->transfer_flags & URB_ZERO_PACKET) != 0
		else if ((urb->transfer_flags & URB_ZERO_PACKET) != 0
			 && (urb->transfer_buffer_length
			 && (urb->transfer_buffer_length
			     % usb_maxpacket(urb->dev, pipe,
			     % usb_maxpacket(urb->dev, pipe)) != 0)
					     usb_pipeout(pipe))) != 0)
			size++;
			size++;
		break;
		break;
	case PIPE_ISOCHRONOUS:
	case PIPE_ISOCHRONOUS:
Loading