* [PATCH/RFC] usb: gadget: udc: core: Fix argument of dma_map_single for IOMMU
@ 2015-07-13 9:10 Yoshihiro Shimoda
2015-07-13 16:19 ` Greg KH
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2015-07-13 9:10 UTC (permalink / raw)
To: linux-sh
The dma_map_single and dma_unmap_single should set "gadget->dev.parent"
instead of "&gadget->dev" in the first argument because the parent has
a udc controller's device pointer.
Otherwise, iommu functions are not called in ARM environment.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
This patch is based on the Felipe's usb.git / testing/next branch.
commit id = 298623983e74d935fc241d0eb1d0740cf4c32599
drivers/usb/gadget/udc/udc-core.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c
index d69c355..362ee8a 100644
--- a/drivers/usb/gadget/udc/udc-core.c
+++ b/drivers/usb/gadget/udc/udc-core.c
@@ -60,13 +60,15 @@ static DEFINE_MUTEX(udc_lock);
int usb_gadget_map_request(struct usb_gadget *gadget,
struct usb_request *req, int is_in)
{
+ struct device *dev = gadget->dev.parent;
+
if (req->length = 0)
return 0;
if (req->num_sgs) {
int mapped;
- mapped = dma_map_sg(&gadget->dev, req->sg, req->num_sgs,
+ mapped = dma_map_sg(dev, req->sg, req->num_sgs,
is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
if (mapped = 0) {
dev_err(&gadget->dev, "failed to map SGs\n");
@@ -75,11 +77,11 @@ int usb_gadget_map_request(struct usb_gadget *gadget,
req->num_mapped_sgs = mapped;
} else {
- req->dma = dma_map_single(&gadget->dev, req->buf, req->length,
+ req->dma = dma_map_single(dev, req->buf, req->length,
is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
- if (dma_mapping_error(&gadget->dev, req->dma)) {
- dev_err(&gadget->dev, "failed to map buffer\n");
+ if (dma_mapping_error(dev, req->dma)) {
+ dev_err(dev, "failed to map buffer\n");
return -EFAULT;
}
}
@@ -95,12 +97,12 @@ void usb_gadget_unmap_request(struct usb_gadget *gadget,
return;
if (req->num_mapped_sgs) {
- dma_unmap_sg(&gadget->dev, req->sg, req->num_mapped_sgs,
+ dma_unmap_sg(gadget->dev.parent, req->sg, req->num_mapped_sgs,
is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
req->num_mapped_sgs = 0;
} else {
- dma_unmap_single(&gadget->dev, req->dma, req->length,
+ dma_unmap_single(gadget->dev.parent, req->dma, req->length,
is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
}
}
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH/RFC] usb: gadget: udc: core: Fix argument of dma_map_single for IOMMU
2015-07-13 9:10 [PATCH/RFC] usb: gadget: udc: core: Fix argument of dma_map_single for IOMMU Yoshihiro Shimoda
@ 2015-07-13 16:19 ` Greg KH
2015-07-13 16:51 ` Geert Uytterhoeven
2015-07-14 0:59 ` Yoshihiro Shimoda
2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2015-07-13 16:19 UTC (permalink / raw)
To: linux-sh
On Mon, Jul 13, 2015 at 06:10:05PM +0900, Yoshihiro Shimoda wrote:
> The dma_map_single and dma_unmap_single should set "gadget->dev.parent"
> instead of "&gadget->dev" in the first argument because the parent has
> a udc controller's device pointer.
> Otherwise, iommu functions are not called in ARM environment.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
> This patch is based on the Felipe's usb.git / testing/next branch.
> commit id = 298623983e74d935fc241d0eb1d0740cf4c32599
Why send something that has already been accepted into Felipe's tree?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH/RFC] usb: gadget: udc: core: Fix argument of dma_map_single for IOMMU
2015-07-13 9:10 [PATCH/RFC] usb: gadget: udc: core: Fix argument of dma_map_single for IOMMU Yoshihiro Shimoda
2015-07-13 16:19 ` Greg KH
@ 2015-07-13 16:51 ` Geert Uytterhoeven
2015-07-14 0:59 ` Yoshihiro Shimoda
2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2015-07-13 16:51 UTC (permalink / raw)
To: linux-sh
Hi Greg,
On Mon, Jul 13, 2015 at 6:19 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Mon, Jul 13, 2015 at 06:10:05PM +0900, Yoshihiro Shimoda wrote:
>> The dma_map_single and dma_unmap_single should set "gadget->dev.parent"
>> instead of "&gadget->dev" in the first argument because the parent has
>> a udc controller's device pointer.
>> Otherwise, iommu functions are not called in ARM environment.
>>
>> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
>> ---
>> This patch is based on the Felipe's usb.git / testing/next branch.
>> commit id = 298623983e74d935fc241d0eb1d0740cf4c32599
>
> Why send something that has already been accepted into Felipe's tree?
That commit ID does not refer to Shimoda-san's patch, but to the HEAD of
Felipe's testing/next branch.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH/RFC] usb: gadget: udc: core: Fix argument of dma_map_single for IOMMU
2015-07-13 9:10 [PATCH/RFC] usb: gadget: udc: core: Fix argument of dma_map_single for IOMMU Yoshihiro Shimoda
2015-07-13 16:19 ` Greg KH
2015-07-13 16:51 ` Geert Uytterhoeven
@ 2015-07-14 0:59 ` Yoshihiro Shimoda
2 siblings, 0 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2015-07-14 0:59 UTC (permalink / raw)
To: linux-sh
SGkgR2VlcnQtc2FuLA0KDQo+IFNlbnQ6IFR1ZXNkYXksIEp1bHkgMTQsIDIwMTUgMTo1MiBBTQ0K
PiANCj4gSGkgR3JlZywNCj4gDQo+IE9uIE1vbiwgSnVsIDEz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gb2YNCj4gRmVsaXBlJ3MgdGVzdGluZy9uZXh0IGJyYW5jaC4NCg0K
VGhhbmsgeW91IGZvciB5b3VyIGNvbW1lbnQhIEkgbWVhbnQgdGhhdC4NCihJJ20gc29ycnkgZm9y
IG15IGxhY2sgZXhwbGFuYXRpb24uKQ0KDQpCZXN0IHJlZ2FyZHMsDQpZb3NoaWhpcm8gU2hpbW9k
YQ0KDQo+IEdye29ldGplLGVldGluZ31zLA0KPiANCj4gICAgICAgICAgICAgICAgICAgICAgICAg
R2VlcnQNCj4gDQo+IC0tDQo+IEdlZXJ0IFV5dHRlcmhvZXZlbiAtLSBUaGVyZSdzIGxvdHMgb2Yg
TGludXggYmV5b25kIGlhMzIgLS0gZ2VlcnRAbGludXgtbTY4ay5vcmcNCj4gDQo+IEluIHBlcnNv
bmFsIGNvbnZlcnNhdGlvbnMgd2l0aCB0ZWNobmljYWwgcGVvcGxlLCBJIGNhbGwgbXlzZWxmIGEg
aGFja2VyLiBCdXQNCj4gd2hlbiBJJ20gdGFsa2luZyB0byBqb3VybmFsaXN0cyBJIGp1c3Qgc2F5
ICJwcm9ncmFtbWVyIiBvciBzb21ldGhpbmcgbGlrZSB0aGF0Lg0KPiAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgIC0tIExpbnVzIFRvcnZhbGRzDQo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-07-14 0:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-13 9:10 [PATCH/RFC] usb: gadget: udc: core: Fix argument of dma_map_single for IOMMU Yoshihiro Shimoda
2015-07-13 16:19 ` Greg KH
2015-07-13 16:51 ` Geert Uytterhoeven
2015-07-14 0:59 ` Yoshihiro Shimoda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox