October 2017
Intermediate to advanced
586 pages
14h 8m
English
DT support is enabled in the kernel with the CONFIG_OF option. You would probably want to avoid using the DT API when its support is not enabled in the kernel. The way you can achieve that is to check whether CONFIG_OF is set or not. People used to do something like this:
#ifdef CONFIG_OF
static const struct of_device_id imx_uart_dt_ids[] = {
{ .compatible = "fsl,imx6q-uart", },
{ .compatible = "fsl,imx1-uart", },
{ .compatible = "fsl,imx21-uart", },
{ /* sentinel */ }
};
/* other device tree dependent code */
[...]
#endif
Even if the of_device_id data type is always defined when device tree support is missing, the code wrapped into #ifdef CONFIG_OF ... #endif will be omitted during the build. This ...