[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201303221519.14108.arnd@arndb.de>
Date: Fri, 22 Mar 2013 15:19:13 +0000
From: Arnd Bergmann <arnd@...db.de>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Vinod Koul <vinod.koul@...el.com>,
Viresh Kumar <viresh.kumar@...aro.org>,
linux-kernel@...r.kernel.org,
"spear-devel" <spear-devel@...t.st.com>
Subject: Re: [PATCH 3/4] dw_dmac: make build of DT related methods optional
On Friday 22 March 2013, Andy Shevchenko wrote:
> There is no reason to build custom filter function and translation function
> inside the driver in case we have no DT platform.
>
> This patch introduces new method dw_dma_of_controller_register() and moves all
> DT related stuff under #ifdef CONFIG_OF. It also helps to distinguish the real
> -ENODEV return code of fake one when of_dma_controller_register is not
> implemented.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
This should have no impact on the object code at all, since everything
inside of the #ifdef is be dropped by the compiler anyway if
of_dma_controller_register is stubbed out.
I generally prefer to have all driver code be compiled all the time
to catch build regressions independent of the configuration, and leave
the #ifdefs in header files that provide the interfaces.
> - 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);
If you want to remove the "err != -ENODEV" check here, we could rewrite
this as
if (IS_ENABLED(CONFIG_OF)) && pdev->dev.of_node) {
err = of_dma_controller_register(pdev->dev.of_node,
dw_dma_of_xlate, dw);
if (err)
dev_err(&pdev->dev,
"could not register of_dma_controller\n");
}
Or alternatively, we can change the of_dma_controller_register() stub to
return 0 if CONFIG_OF is disabled. That would also take care of similar
code in other dma engine drivers.
Arnd
--
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