On Thu, Jul 2, 2020 at 8:40 AM Dong Aisheng <donga...@gmail.com> wrote: > On Thu, Jul 2, 2020 at 2:11 PM Anson Huang <anson.hu...@nxp.com> wrote: > > > Subject: Re: [PATCH V4 3/5] clk: imx: Support building i.MX common clock > > > > I am fine of adding the '#ifndef MODULE' to imx_clk_disable_uart() and > > imx_keep_uart_clocks_param() > > as well in next patch series. Others like ' imx_keep_uart_clocks ' and > > imx_register_uart_clocks() need to > > be kept always built, since they are used by each clock driver no matter > > built-in or module build. > > > > So that means I have to add another 'ifndef MODULE' or I need to adjust > > some code sequence to make > > those code can be built-out in same block and just use single 'ifndef > > MODULE', I think adjust the code > > sequence should be better, will go with this way. > > What if we condionally compile it in clk.h? Will that be easiser?
Yes, that's what I expected to see in v4 after the previous discussion. If imx_register_uart_clocks() is an empty inline function, then the arrays passed to it are unused and also get dropped by the compiler. The question is whether the #ifdef check in the header to test for MODULE (only calling it if this particular soc has a built-in clk driver, which is sufficient) or for IS_MODULE(CONFIG_MXC_CLK) (call it if _any_ clk driver is built-in and the function exists, which leaves extra code in the driver but is a more conventional check). Arnd