Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

of: reserved-memory: Add stub for RESERVEDMEM_OF_DECLARE()

The reserved-memory Kconfig could be disabled when drivers are
compile-tested. In this case RESERVEDMEM_OF_DECLARE() produces a
noisy warning about the orphaned __reservedmem_of_table section.
Add the missing stub that fixes the warning. In particular this is
needed for compile-testing of NVIDIA Tegra210 memory driver which
uses reserved-memory.

Reported-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Link: https://lore.kernel.org/r/20210610162313.20942-1-digetx@gmail.com
Signed-off-by: Rob Herring <robh@kernel.org>

authored by

Dmitry Osipenko and committed by
Rob Herring
67a066b3 89f8a707

+13 -6
+7 -4
include/linux/of.h
··· 1329 1329 return num; 1330 1330 } 1331 1331 1332 + #define _OF_DECLARE_STUB(table, name, compat, fn, fn_type) \ 1333 + static const struct of_device_id __of_table_##name \ 1334 + __attribute__((unused)) \ 1335 + = { .compatible = compat, \ 1336 + .data = (fn == (fn_type)NULL) ? fn : fn } 1337 + 1332 1338 #if defined(CONFIG_OF) && !defined(MODULE) 1333 1339 #define _OF_DECLARE(table, name, compat, fn, fn_type) \ 1334 1340 static const struct of_device_id __of_table_##name \ ··· 1344 1338 .data = (fn == (fn_type)NULL) ? fn : fn } 1345 1339 #else 1346 1340 #define _OF_DECLARE(table, name, compat, fn, fn_type) \ 1347 - static const struct of_device_id __of_table_##name \ 1348 - __attribute__((unused)) \ 1349 - = { .compatible = compat, \ 1350 - .data = (fn == (fn_type)NULL) ? fn : fn } 1341 + _OF_DECLARE_STUB(table, name, compat, fn, fn_type) 1351 1342 #endif 1352 1343 1353 1344 typedef int (*of_init_fn_2)(struct device_node *, struct device_node *);
+6 -2
include/linux/of_reserved_mem.h
··· 27 27 28 28 typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem); 29 29 30 + #ifdef CONFIG_OF_RESERVED_MEM 31 + 30 32 #define RESERVEDMEM_OF_DECLARE(name, compat, init) \ 31 33 _OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn) 32 - 33 - #ifdef CONFIG_OF_RESERVED_MEM 34 34 35 35 int of_reserved_mem_device_init_by_idx(struct device *dev, 36 36 struct device_node *np, int idx); ··· 41 41 42 42 struct reserved_mem *of_reserved_mem_lookup(struct device_node *np); 43 43 #else 44 + 45 + #define RESERVEDMEM_OF_DECLARE(name, compat, init) \ 46 + _OF_DECLARE_STUB(reservedmem, name, compat, init, reservedmem_of_init_fn) 47 + 44 48 static inline int of_reserved_mem_device_init_by_idx(struct device *dev, 45 49 struct device_node *np, int idx) 46 50 {