> -----Original Message-----
> From: Christoph Hellwig [mailto:h...@lst.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
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to