[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9452408.uEOOA4q1YW@wuerfel>
Date: Wed, 27 Apr 2016 16:11:17 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Catalin Marinas <catalin.marinas@....com>
Cc: Felipe Balbi <balbi@...nel.org>,
Grygorii Strashko <grygorii.strashko@...com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
linux-usb@...r.kernel.org, Sekhar Nori <nsekhar@...com>,
linux-kernel@...r.kernel.org,
David Fisher <david.fisher1@...opsys.com>,
"Thang Q. Nguyen" <tqnguyen@....com>,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev
On Wednesday 27 April 2016 14:59:00 Catalin Marinas wrote:
>
> I would be in favour of a dma_inherit() function as well. We could hack
> something up in the arch code (like below) but I would rather prefer an
> explicit dma_inherit() call by drivers creating such devices.
>
> diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h
> index ba437f090a74..ea6fb9b0e8fa 100644
> --- a/arch/arm64/include/asm/dma-mapping.h
> +++ b/arch/arm64/include/asm/dma-mapping.h
> @@ -29,8 +29,11 @@ extern struct dma_map_ops dummy_dma_ops;
>
> static inline struct dma_map_ops *__generic_dma_ops(struct device *dev)
> {
> - if (dev && dev->archdata.dma_ops)
> - return dev->archdata.dma_ops;
> + while (dev) {
> + if (dev->archdata.dma_ops)
> + return dev->archdata.dma_ops;
> + dev = dev->parent;
> + }
I think this would be a very bad idea: we don't want to have random
devices be able to perform DMA just because their parent devices
have been set up that way.
Arnd
Powered by blists - more mailing lists