Commit 7f93e683 authored by Piyush Mehta's avatar Piyush Mehta Committed by Greg Kroah-Hartman
Browse files

usb: gadget: udc-xilinx: fix restricted __le16 degrades to integer warning



usb_ctrlrequest members wValue and wIndex are of type __le16, so to fix
this warnings we are using le16_to_cpu() macros.

Reported-by: default avatarkernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/all/202209020044.CX2PfZzM-lkp@intel.com/


Signed-off-by: default avatarPiyush Mehta <piyush.mehta@amd.com>
Link: https://lore.kernel.org/r/20230822063201.16929-2-piyush.mehta@amd.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2ccbe854
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -1615,13 +1615,13 @@ static void xudc_getstatus(struct xusb_udc *udc)
	case USB_RECIP_INTERFACE:
		break;
	case USB_RECIP_ENDPOINT:
		epnum = udc->setup.wIndex & USB_ENDPOINT_NUMBER_MASK;
		epnum = le16_to_cpu(udc->setup.wIndex) & USB_ENDPOINT_NUMBER_MASK;
		if (epnum >= XUSB_MAX_ENDPOINTS)
			goto stall;
		target_ep = &udc->ep[epnum];
		epcfgreg = udc->read_fn(udc->addr + target_ep->offset);
		halt = epcfgreg & XUSB_EP_CFG_STALL_MASK;
		if (udc->setup.wIndex & USB_DIR_IN) {
		if (le16_to_cpu(udc->setup.wIndex) & USB_DIR_IN) {
			if (!target_ep->is_in)
				goto stall;
		} else {
@@ -1664,7 +1664,7 @@ static void xudc_set_clear_feature(struct xusb_udc *udc)

	switch (udc->setup.bRequestType) {
	case USB_RECIP_DEVICE:
		switch (udc->setup.wValue) {
		switch (le16_to_cpu(udc->setup.wValue)) {
		case USB_DEVICE_TEST_MODE:
			/*
			 * The Test Mode will be executed
@@ -1684,13 +1684,15 @@ static void xudc_set_clear_feature(struct xusb_udc *udc)
		break;
	case USB_RECIP_ENDPOINT:
		if (!udc->setup.wValue) {
			endpoint = udc->setup.wIndex & USB_ENDPOINT_NUMBER_MASK;
			endpoint = le16_to_cpu(udc->setup.wIndex) &
					       USB_ENDPOINT_NUMBER_MASK;
			if (endpoint >= XUSB_MAX_ENDPOINTS) {
				xudc_ep0_stall(udc);
				return;
			}
			target_ep = &udc->ep[endpoint];
			outinbit = udc->setup.wIndex & USB_ENDPOINT_DIR_MASK;
			outinbit = le16_to_cpu(udc->setup.wIndex) &
					       USB_ENDPOINT_DIR_MASK;
			outinbit = outinbit >> 7;

			/* Make sure direction matches.*/
@@ -1867,7 +1869,7 @@ static void xudc_ep0_in(struct xusb_udc *udc)
	u16 count = 0;
	u16 length;
	u8 *ep0rambase;
	u8 test_mode = udc->setup.wIndex >> 8;
	u8 test_mode = le16_to_cpu(udc->setup.wIndex) >> 8;

	req = list_first_entry(&ep0->queue, struct xusb_req, queue);
	bytes_to_tx = req->usb_req.length - req->usb_req.actual;
@@ -1878,12 +1880,12 @@ static void xudc_ep0_in(struct xusb_udc *udc)
		case USB_REQ_SET_ADDRESS:
			/* Set the address of the device.*/
			udc->write_fn(udc->addr, XUSB_ADDRESS_OFFSET,
				      udc->setup.wValue);
				      le16_to_cpu(udc->setup.wValue));
			break;
		case USB_REQ_SET_FEATURE:
			if (udc->setup.bRequestType ==
					USB_RECIP_DEVICE) {
				if (udc->setup.wValue ==
				if (le16_to_cpu(udc->setup.wValue) ==
						USB_DEVICE_TEST_MODE)
					udc->write_fn(udc->addr,
						      XUSB_TESTMODE_OFFSET,