lkml.org 
[lkml]   [2021]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v3 04/18] driver core: platform: Add driver dma ownership management
    On Tue, Dec 07, 2021 at 10:57:25AM +0800, Lu Baolu wrote:
    > On 12/6/21 11:06 PM, Jason Gunthorpe wrote:
    > > On Mon, Dec 06, 2021 at 06:36:27AM -0800, Christoph Hellwig wrote:
    > > > I really hate the amount of boilerplate code that having this in each
    > > > bus type causes.
    > > +1
    > >
    > > I liked the first version of this series better with the code near
    > > really_probe().
    > >
    > > Can we go back to that with some device_configure_dma() wrapper
    > > condtionally called by really_probe as we discussed?
    > >
    >
    > Are you talking about below change?
    >
    > diff --git a/drivers/base/dd.c b/drivers/base/dd.c
    > index 68ea1f949daa..368f9e530515 100644
    > +++ b/drivers/base/dd.c
    > @@ -577,7 +577,13 @@ static int really_probe(struct device *dev, struct
    > device_driver *drv)
    > if (dev->bus->dma_configure) {
    > ret = dev->bus->dma_configure(dev);
    > if (ret)
    > - goto probe_failed;
    > + goto pinctrl_bind_failed;
    > +
    > + if (!drv->no_kernel_dma) {
    > + ret = iommu_device_set_dma_owner(dev, DMA_OWNER_DMA_API, NULL);
    > + if (ret)
    > + goto pinctrl_bind_failed;
    > + }
    > }

    Yes, the suggestion was to put everything that 'if' inside a function
    and then of course a matching undo function.

    Jason

    \
     
     \ /
      Last update: 2021-12-07 14:16    [W:3.224 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site