dtoc: Drop use of DECL() macros

We can use extern instead, so let's drop these macros. It adds one more
thing to learn about and doesn't make the code any clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2021-03-15 17:25:11 +13:00
parent 929e9940b0
commit cff7dcf3fd
2 changed files with 36 additions and 36 deletions

View file

@ -902,14 +902,14 @@ class DtbPlatdata():
self.buf(
'/* driver declarations - these allow DM_DRIVER_GET() to be used */\n')
for node in nodes_to_output:
self.buf('DM_DRIVER_DECL(%s);\n' % node.struct_name);
self.buf('extern U_BOOT_DRIVER(%s);\n' % node.struct_name);
self.buf('\n')
if self._instantiate:
self.buf(
'/* device declarations - these allow DM_DEVICE_REF() to be used */\n')
for node in nodes_to_output:
self.buf('DM_DEVICE_DECL(%s);\n' % node.var_name)
self.buf('extern DM_DEVICE_INST(%s);\n' % node.var_name)
self.buf('\n')
uclass_list = self._valid_uclasses
@ -917,13 +917,13 @@ class DtbPlatdata():
self.buf(
'/* uclass driver declarations - needed for DM_UCLASS_DRIVER_REF() */\n')
for uclass in uclass_list:
self.buf('DM_UCLASS_DRIVER_DECL(%s);\n' % uclass.name)
self.buf('extern UCLASS_DRIVER(%s);\n' % uclass.name)
if self._instantiate:
self.buf('\n')
self.buf('/* uclass declarations - needed for DM_UCLASS_REF() */\n')
for uclass in uclass_list:
self.buf('DM_UCLASS_DECL(%s);\n' % uclass.name)
self.buf('extern DM_UCLASS_INST(%s);\n' % uclass.name)
self.out(''.join(self.get_buf()))
def assign_seqs(self):

View file

@ -241,52 +241,52 @@ class TestDtoc(unittest.TestCase):
#include <dm/uclass-internal.h>
/* driver declarations - these allow DM_DRIVER_GET() to be used */
DM_DRIVER_DECL(sandbox_i2c);
DM_DRIVER_DECL(sandbox_pmic);
DM_DRIVER_DECL(sandbox_spl_test);
DM_DRIVER_DECL(sandbox_spl_test);
DM_DRIVER_DECL(sandbox_spl_test);
extern U_BOOT_DRIVER(sandbox_i2c);
extern U_BOOT_DRIVER(sandbox_pmic);
extern U_BOOT_DRIVER(sandbox_spl_test);
extern U_BOOT_DRIVER(sandbox_spl_test);
extern U_BOOT_DRIVER(sandbox_spl_test);
/* uclass driver declarations - needed for DM_UCLASS_DRIVER_REF() */
DM_UCLASS_DRIVER_DECL(i2c);
DM_UCLASS_DRIVER_DECL(misc);
DM_UCLASS_DRIVER_DECL(pmic);
extern UCLASS_DRIVER(i2c);
extern UCLASS_DRIVER(misc);
extern UCLASS_DRIVER(pmic);
'''
decl_text_inst = DECL_HEADER + '''
#include <dm/device-internal.h>
#include <dm/uclass-internal.h>
/* driver declarations - these allow DM_DRIVER_GET() to be used */
DM_DRIVER_DECL(sandbox_i2c);
DM_DRIVER_DECL(root_driver);
DM_DRIVER_DECL(denx_u_boot_test_bus);
DM_DRIVER_DECL(sandbox_spl_test);
DM_DRIVER_DECL(sandbox_spl_test);
DM_DRIVER_DECL(denx_u_boot_fdt_test);
DM_DRIVER_DECL(denx_u_boot_fdt_test);
extern U_BOOT_DRIVER(sandbox_i2c);
extern U_BOOT_DRIVER(root_driver);
extern U_BOOT_DRIVER(denx_u_boot_test_bus);
extern U_BOOT_DRIVER(sandbox_spl_test);
extern U_BOOT_DRIVER(sandbox_spl_test);
extern U_BOOT_DRIVER(denx_u_boot_fdt_test);
extern U_BOOT_DRIVER(denx_u_boot_fdt_test);
/* device declarations - these allow DM_DEVICE_REF() to be used */
DM_DEVICE_DECL(i2c);
DM_DEVICE_DECL(root);
DM_DEVICE_DECL(some_bus);
DM_DEVICE_DECL(spl_test);
DM_DEVICE_DECL(spl_test3);
DM_DEVICE_DECL(test);
DM_DEVICE_DECL(test0);
extern DM_DEVICE_INST(i2c);
extern DM_DEVICE_INST(root);
extern DM_DEVICE_INST(some_bus);
extern DM_DEVICE_INST(spl_test);
extern DM_DEVICE_INST(spl_test3);
extern DM_DEVICE_INST(test);
extern DM_DEVICE_INST(test0);
/* uclass driver declarations - needed for DM_UCLASS_DRIVER_REF() */
DM_UCLASS_DRIVER_DECL(i2c);
DM_UCLASS_DRIVER_DECL(misc);
DM_UCLASS_DRIVER_DECL(root);
DM_UCLASS_DRIVER_DECL(testbus);
DM_UCLASS_DRIVER_DECL(testfdt);
extern UCLASS_DRIVER(i2c);
extern UCLASS_DRIVER(misc);
extern UCLASS_DRIVER(root);
extern UCLASS_DRIVER(testbus);
extern UCLASS_DRIVER(testfdt);
/* uclass declarations - needed for DM_UCLASS_REF() */
DM_UCLASS_DECL(i2c);
DM_UCLASS_DECL(misc);
DM_UCLASS_DECL(root);
DM_UCLASS_DECL(testbus);
DM_UCLASS_DECL(testfdt);
extern DM_UCLASS_INST(i2c);
extern DM_UCLASS_INST(misc);
extern DM_UCLASS_INST(root);
extern DM_UCLASS_INST(testbus);
extern DM_UCLASS_INST(testfdt);
'''
struct_text = HEADER + '''
struct dtd_sandbox_i2c {