[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1364317922.6652.34.camel@smile>
Date: Tue, 26 Mar 2013 19:12:02 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Viresh Kumar <viresh.kumar@...aro.org>
Cc: Vinod Koul <vinod.koul@...el.com>, Arnd Bergmann <arnd@...db.de>,
linux-kernel@...r.kernel.org,
spear-devel <spear-devel@...t.st.com>,
Lars-Peter Clausen <lars@...afoo.de>
Subject: Re: [PATCH v2.1] dw_dmac: make wrapper on
of_dma_controller_register()
On Tue, 2013-03-26 at 22:37 +0530, Viresh Kumar wrote:
> On 26 March 2013 22:34, Andy Shevchenko
> <andriy.shevchenko@...ux.intel.com> wrote:
> > This patch introduces new method dw_dma_of_controller_register(). The wrapper
> > is called only when of_node is present.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> > Acked-by: Arnd Bergmann <arnd@...db.de>
> > ---
> > drivers/dma/dw_dmac.c | 19 ++++++++++++-------
> > 1 file changed, 12 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
> > index 274fd7d..12657d7 100644
> > --- a/drivers/dma/dw_dmac.c
> > +++ b/drivers/dma/dw_dmac.c
> > @@ -1303,6 +1303,16 @@ static struct dma_chan *dw_dma_of_xlate(struct of_phandle_args *dma_spec,
> > return dma_request_channel(cap, dw_dma_of_filter, &fargs);
> > }
> >
> > +static void dw_dma_of_controller_register(struct dw_dma *dw)
> > +{
> > + struct device *dev = dw->dma.dev;
> > + int err;
> > +
> > + err = of_dma_controller_register(dev->of_node, dw_dma_of_xlate, dw);
> > + if (err)
> > + dev_err(dev, "could not register of_dma_controller\n");
> > +}
> > +
> > /* --------------------- Cyclic DMA API extensions -------------------- */
> >
> > /**
> > @@ -1843,13 +1853,8 @@ static int dw_probe(struct platform_device *pdev)
> >
> > dma_async_device_register(&dw->dma);
> >
> > - if (pdev->dev.of_node) {
> > - err = of_dma_controller_register(pdev->dev.of_node,
> > - dw_dma_of_xlate, dw);
> > - if (err && err != -ENODEV)
> > - dev_err(&pdev->dev,
> > - "could not register of_dma_controller\n");
> > - }
> > + if (pdev->dev.of_node)
> > + dw_dma_of_controller_register(dw);
>
> I forgot where we started from, but what's the need of this patch?
Nowadays, besides removal of the -ENODEV checking, it makes probe
function looks tidier.
Think about upcoming stuff (e.g. ACPI), if we put everything inside
probe it will look overloaded.
--
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Intel Finland Oy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists