[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <HE1PR0401MB242509FE2B60674CAF306A4AE6D20@HE1PR0401MB2425.eurprd04.prod.outlook.com>
Date: Tue, 13 Mar 2018 15:59:58 +0000
From: Nipun Gupta <nipun.gupta@....com>
To: Christoph Hellwig <hch@....de>
CC: "robin.murphy@....com" <robin.murphy@....com>,
"linux@...linux.org.uk" <linux@...linux.org.uk>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"m.szyprowski@...sung.com" <m.szyprowski@...sung.com>,
"bhelgaas@...gle.com" <bhelgaas@...gle.com>,
"dmitry.torokhov@...il.com" <dmitry.torokhov@...il.com>,
"rafael.j.wysocki@...el.com" <rafael.j.wysocki@...el.com>,
"jarkko.sakkinen@...ux.intel.com" <jarkko.sakkinen@...ux.intel.com>,
"linus.walleij@...aro.org" <linus.walleij@...aro.org>,
"johan@...nel.org" <johan@...nel.org>,
"msuchanek@...e.de" <msuchanek@...e.de>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>
Subject: RE: [PATCH] dma-mapping: move dma configuration to bus infrastructure
> -----Original Message-----
> From: Christoph Hellwig [mailto:hch@....de]
> Sent: Tuesday, March 13, 2018 13:05
> > +int amba_dma_configure(struct device *dev)
> > +{
> > + enum dev_dma_attr attr;
> > + int ret = 0;
> > +
> > + if (dev->of_node) {
> > + ret = of_dma_configure(dev, dev->of_node);
> > + } else if (has_acpi_companion(dev)) {
> > + attr = acpi_get_dma_attr(to_acpi_device_node(dev->fwnode));
> > + if (attr != DEV_DMA_NOT_SUPPORTED)
> > + ret = acpi_dma_configure(dev, attr);
> > + }
> > +
> > + return ret;
>
> This code sniplet is duplicated so many times that I think we should
> just have some sort of dma_common_configure() for it that the various
> busses can use.
Agree. There is no good point in duplicating the code.
So this new API will be part of 'drivers/base/dma-mapping.c' file?
>
> > +void amba_dma_deconfigure(struct device *dev)
> > +{
> > + of_dma_deconfigure(dev);
> > + acpi_dma_deconfigure(dev);
> > +}
>
> As mention in my previous reply I think we don't even need a deconfigure
> callback at this point - just remove the ACPI and OF wrappers and
> clear the dma ops.
>
> Also in this series we should replace the force_dma flag by use of the
> proper method, e.g. give a force parameter to of_dma_configure and the
> new dma_common_configure helper that the busses that want it can set.
I am more inclined to what Robin states in other mail to keep symmetry.
i.e. to keep dma_configure() and dma_deconfigure() and call
dev->bus->dma_configure from dma_configure(). Is this okay?
Thanks,
Nipun
Powered by blists - more mailing lists