mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-08-19 08:28:51 +09:00
![Masahiro Yamada](/assets/img/avatar_default.png)
The Linux coding style guide (Documentation/process/coding-style.rst) clearly says: It's a **mistake** to use typedef for structures and pointers. Besides, using typedef for structures is annoying when you try to make headers self-contained. Let's say you have the following function declaration in a header: void foo(bd_t *bd); This is not self-contained since bd_t is not defined. To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h> #include <asm/u-boot.h> void foo(bd_t *bd); Then, the include direcective pulls in more bloat needlessly. If you use 'struct bd_info' instead, it is enough to put a forward declaration as follows: struct bd_info; void foo(struct bd_info *bd); Right, typedef'ing bd_t is a mistake. I used coccinelle to generate this commit. The semantic patch that makes this change is as follows: <smpl> @@ typedef bd_t; @@ -bd_t +struct bd_info </smpl> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
44 lines
1.0 KiB
C
44 lines
1.0 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright 2017 Texas Instruments, Inc.
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <hang.h>
|
|
#include <linux/libfdt.h>
|
|
#include <fdt_support.h>
|
|
#include <malloc.h>
|
|
|
|
#include <asm/omap_common.h>
|
|
#include <asm/arch-am33xx/sys_proto.h>
|
|
|
|
#ifdef CONFIG_TI_SECURE_DEVICE
|
|
|
|
static void ft_hs_fixups(void *fdt, struct bd_info *bd)
|
|
{
|
|
/* Check we are running on an HS/EMU device type */
|
|
if (GP_DEVICE != get_device_type()) {
|
|
if ((ft_hs_disable_rng(fdt, bd) == 0) &&
|
|
(ft_hs_fixup_dram(fdt, bd) == 0) &&
|
|
(ft_hs_add_tee(fdt, bd) == 0))
|
|
return;
|
|
} else {
|
|
printf("ERROR: Incorrect device type (GP) detected!");
|
|
}
|
|
/* Fixup failed or wrong device type */
|
|
hang();
|
|
}
|
|
#else
|
|
static void ft_hs_fixups(void *fdt, struct bd_info *bd) { }
|
|
#endif /* #ifdef CONFIG_TI_SECURE_DEVICE */
|
|
|
|
/*
|
|
* Place for general cpu/SoC FDT fixups. Board specific
|
|
* fixups should remain in the board files which is where
|
|
* this function should be called from.
|
|
*/
|
|
void ft_cpu_setup(void *fdt, struct bd_info *bd)
|
|
{
|
|
ft_hs_fixups(fdt, bd);
|
|
}
|