Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 091fe0c2 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: gadget: core: unmap request from DMA only if previously mapped"

parents aea1a6cb e92b17c3
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -857,6 +857,8 @@ int usb_gadget_map_request_by_dev(struct device *dev,
			dev_err(dev, "failed to map buffer\n");
			return -EFAULT;
		}

		req->dma_mapped = 1;
	}

	return 0;
@@ -881,9 +883,10 @@ void usb_gadget_unmap_request_by_dev(struct device *dev,
				is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);

		req->num_mapped_sgs = 0;
	} else if (req->dma != DMA_ERROR_CODE) {
	} else if (req->dma_mapped) {
		dma_unmap_single(dev, req->dma, req->length,
				is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
		req->dma_mapped = 0;
	}
}
EXPORT_SYMBOL_GPL(usb_gadget_unmap_request_by_dev);
+2 −0
Original line number Diff line number Diff line
@@ -148,6 +148,7 @@ struct gsi_channel_info {
 *     by adding a zero length packet as needed;
 * @short_not_ok: When reading data, makes short packets be
 *     treated as errors (queue stops advancing till cleanup).
 * @dma_mapped: Indicates if request has been mapped to DMA (internal)
 * @complete: Function called when request completes, so this request and
 *	its buffer may be re-used.  The function will always be called with
 *	interrupts disabled, and it must not sleep.
@@ -204,6 +205,7 @@ struct usb_request {
	unsigned		no_interrupt:1;
	unsigned		zero:1;
	unsigned		short_not_ok:1;
	unsigned		dma_mapped:1;

	void			(*complete)(struct usb_ep *ep,
					struct usb_request *req);