Skip to content

Commit

Permalink
command: Remove the cmd_tbl_t typedef
Browse files Browse the repository at this point in the history
We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <[email protected]>
  • Loading branch information
sjg20 authored and trini committed May 18, 2020
1 parent 691d719 commit 0914011
Show file tree
Hide file tree
Showing 465 changed files with 1,988 additions and 1,528 deletions.
1 change: 1 addition & 0 deletions arch/arc/lib/bootm.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <common.h>
#include <bootstage.h>
#include <env.h>
#include <image.h>
#include <irq_func.h>
#include <lmb.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arc/lib/reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ __weak void reset_cpu(ulong addr)
__builtin_arc_brk();
}

int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
printf("Resetting the board...\n");

Expand Down
5 changes: 3 additions & 2 deletions arch/arm/cpu/arm1136/mx35/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <common.h>
#include <clock_legacy.h>
#include <command.h>
#include <div64.h>
#include <init.h>
#include <net.h>
Expand Down Expand Up @@ -379,8 +380,8 @@ u32 imx_get_fecclk(void)
}
#endif

int do_mx35_showclocks(cmd_tbl_t *cmdtp,
int flag, int argc, char * const argv[])
int do_mx35_showclocks(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
u32 cpufreq = get_mcu_main_clk();
printf("mx35 cpu clock: %dMHz\n", cpufreq / 1000000);
Expand Down
4 changes: 3 additions & 1 deletion arch/arm/cpu/arm926ejs/mxs/mxs.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/

#include <common.h>
#include <command.h>
#include <cpu_func.h>
#include <hang.h>
#include <init.h>
Expand Down Expand Up @@ -187,7 +188,8 @@ int print_cpuinfo(void)
}
#endif

int do_mx28_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
int do_mx28_showclocks(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
printf("CPU: %3d MHz\n", mxc_get_clock(MXC_ARM_CLK) / 1000000);
printf("BUS: %3d MHz\n", mxc_get_clock(MXC_AHB_CLK) / 1000000);
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/cpu/arm926ejs/spear/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

#include <common.h>
#include <command.h>
#include <init.h>
#include <asm/io.h>
#include <asm/arch/hardware.h>
Expand Down Expand Up @@ -81,7 +82,7 @@ int print_cpuinfo(void)
#endif

#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_NAND_ECC_BCH) && defined(CONFIG_NAND_FSMC)
static int do_switch_ecc(cmd_tbl_t *cmdtp, int flag, int argc,
static int do_switch_ecc(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
if (argc != 2)
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/cpu/arm926ejs/spear/spr_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ static int write_mac(uchar *mac)
}
#endif

int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int do_chip_config(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
void (*sram_setfreq) (unsigned int, unsigned int);
unsigned int frequency;
Expand Down
5 changes: 3 additions & 2 deletions arch/arm/cpu/armv7/vf610/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <common.h>
#include <clock_legacy.h>
#include <command.h>
#include <cpu_func.h>
#include <init.h>
#include <net.h>
Expand Down Expand Up @@ -240,8 +241,8 @@ unsigned int mxc_get_clock(enum mxc_clock clk)
}

/* Dump some core clocks */
int do_vf610_showclocks(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
int do_vf610_showclocks(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
printf("\n");
printf("cpu clock : %8d MHz\n", mxc_get_clock(MXC_ARM_CLK) / 1000000);
Expand Down
1 change: 1 addition & 0 deletions arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

#include <common.h>
#include <env.h>
#include <asm/io.h>
#include <linux/errno.h>
#include <asm/arch/fsl_serdes.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/cpu/armv8/fsl-layerscape/mp.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ int cpu_status(u32 nr)
return 0;
}

int cpu_release(u32 nr, int argc, char * const argv[])
int cpu_release(u32 nr, int argc, char *const argv[])
{
u64 boot_addr;
u64 *table = (u64 *)get_spin_tbl_addr();
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/include/asm/arch-mx6/clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#define MXC_CLK32 32768
#endif

struct cmd_tbl_s;
struct cmd_tbl;

enum mxc_clock {
MXC_ARM_CLK = 0,
Expand Down Expand Up @@ -82,6 +82,6 @@ void enable_thermal_clk(void);
void mxs_set_lcdclk(u32 base_addr, u32 freq);
void select_ldb_di_clock_source(enum ldb_di_clock clk);
void enable_eim_clk(unsigned char enable);
int do_mx6_showclocks(struct cmd_tbl_s *cmdtp, int flag, int argc,
int do_mx6_showclocks(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[]);
#endif /* __ASM_ARCH_CLOCK_H */
2 changes: 1 addition & 1 deletion arch/arm/lib/bootm.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)
* DIFFERENCE: Instead of calling prep and go at the end
* they are called if subcommand is equal 0.
*/
int do_bootm_linux(int flag, int argc, char * const argv[],
int do_bootm_linux(int flag, int argc, char *const argv[],
bootm_headers_t *images)
{
/* No need for those on ARM */
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/lib/cmd_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* instructions, otherwise a fault occurs."
*/
unsigned long do_go_exec(ulong (*entry)(int, char * const []),
int argc, char * const argv[])
int argc, char *const argv[])
{
ulong addr = (ulong)entry | 1;
entry = (void *)addr;
Expand Down
5 changes: 3 additions & 2 deletions arch/arm/lib/reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,19 @@
*/

#include <common.h>
#include <command.h>
#include <cpu_func.h>
#include <irq_func.h>

__weak void reset_misc(void)
{
}

int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
puts ("resetting ...\n");

udelay (50000); /* wait 50 ms */
mdelay(50); /* wait 50 ms */

disable_interrupts();

Expand Down
4 changes: 3 additions & 1 deletion arch/arm/lib/semihosting.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/
#include <common.h>
#include <command.h>
#include <env.h>

#define SYSOPEN 0x01
#define SYSCLOSE 0x02
Expand Down Expand Up @@ -180,7 +181,8 @@ static int smh_load_file(const char * const name, ulong load_addr,
return 0;
}

static int do_smhload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
static int do_smhload(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
if (argc == 3 || argc == 4) {
ulong load_addr;
Expand Down
6 changes: 3 additions & 3 deletions arch/arm/mach-imx/cmd_bmode.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ static int create_usage(char *dest)
return size;
}

static int do_boot_mode(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
static int do_boot_mode(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
const struct boot_mode *p;
int reset_requested = 1;
Expand Down Expand Up @@ -87,7 +87,7 @@ void add_board_boot_modes(const struct boot_mode *p)
int size;
char *dest;

cmd_tbl_t *entry = ll_entry_get(cmd_tbl_t, bmode, cmd);
struct cmd_tbl *entry = ll_entry_get(struct cmd_tbl, bmode, cmd);

if (entry->usage) {
free(entry->usage);
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/mach-imx/cmd_dek.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ static int blob_encap_dek(const u8 *src, u8 *dst, u32 len)
* Returns zero on success, CMD_RET_USAGE in case of misuse and negative
* on error.
*/
static int do_dek_blob(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
static int do_dek_blob(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
uint32_t src_addr, dst_addr, len;
uint8_t *src_ptr, *dst_ptr;
Expand Down
4 changes: 3 additions & 1 deletion arch/arm/mach-imx/cmd_hdmidet.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
* Copyright (C) 2012 Boundary Devices Inc.
*/
#include <common.h>
#include <command.h>
#include <asm/arch/imx-regs.h>
#include <asm/arch/mxc_hdmi.h>
#include <asm/io.h>

static int do_hdmidet(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
static int do_hdmidet(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
struct hdmi_regs *hdmi = (struct hdmi_regs *)HDMI_ARB_BASE_ADDR;
return (readb(&hdmi->phy_stat0) & HDMI_DVI_STAT) ? 0 : 1;
Expand Down
7 changes: 4 additions & 3 deletions arch/arm/mach-imx/cmd_nandbcb.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/

#include <common.h>
#include <command.h>
#include <malloc.h>
#include <nand.h>
#include <dm/devres.h>
Expand Down Expand Up @@ -1048,7 +1049,7 @@ static int nandbcb_init(struct boot_config *boot_cfg, u_char *buf)
return ret;
}

static int do_nandbcb_bcbonly(int argc, char * const argv[])
static int do_nandbcb_bcbonly(int argc, char *const argv[])
{
struct fcb_block *fcb;
struct dbbt_block *dbbt;
Expand Down Expand Up @@ -1458,8 +1459,8 @@ static int do_nandbcb_init(int argc, char * const argv[])
return ret == 0 ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
}

static int do_nandbcb(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
static int do_nandbcb(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
const char *cmd;
int ret = 0;
Expand Down
21 changes: 11 additions & 10 deletions arch/arm/mach-imx/hab.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

#include <common.h>
#include <command.h>
#include <config.h>
#include <fuse.h>
#include <mapmem.h>
Expand Down Expand Up @@ -291,8 +292,8 @@ static int get_hab_status(void)
return 0;
}

static int do_hab_status(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
static int do_hab_status(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
if ((argc != 1)) {
cmd_usage(cmdtp);
Expand Down Expand Up @@ -324,8 +325,8 @@ static ulong get_image_ivt_offset(ulong img_addr)
}
}

static int do_authenticate_image(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
static int do_authenticate_image(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
ulong addr, length, ivt_offset;
int rcode = 0;
Expand All @@ -349,8 +350,8 @@ static int do_authenticate_image(cmd_tbl_t *cmdtp, int flag, int argc,
return rcode;
}

static int do_hab_failsafe(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
static int do_hab_failsafe(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
hab_rvt_failsafe_t *hab_rvt_failsafe;

Expand All @@ -365,8 +366,8 @@ static int do_hab_failsafe(cmd_tbl_t *cmdtp, int flag, int argc,
return 0;
}

static int do_hab_version(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
static int do_hab_version(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
struct hab_hdr *hdr = (struct hab_hdr *)HAB_RVT_BASE;

Expand All @@ -380,8 +381,8 @@ static int do_hab_version(cmd_tbl_t *cmdtp, int flag, int argc,
return 0;
}

static int do_authenticate_image_or_failover(cmd_tbl_t *cmdtp, int flag,
int argc, char * const argv[])
static int do_authenticate_image_or_failover(struct cmd_tbl *cmdtp, int flag,
int argc, char *const argv[])
{
int ret = CMD_RET_FAILURE;

Expand Down
13 changes: 7 additions & 6 deletions arch/arm/mach-imx/imx8/ahab.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

#include <common.h>
#include <command.h>
#include <errno.h>
#include <asm/io.h>
#include <asm/arch/sci/sci.h>
Expand Down Expand Up @@ -149,8 +150,8 @@ int authenticate_os_container(ulong addr)
return ret;
}

static int do_authenticate(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
static int do_authenticate(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
ulong addr;

Expand Down Expand Up @@ -250,8 +251,8 @@ static void display_ahab_auth_event(u32 event)
}
}

static int do_ahab_status(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
static int do_ahab_status(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
int err;
u8 idx = 0U;
Expand Down Expand Up @@ -297,8 +298,8 @@ static int confirm_close(void)
return 0;
}

static int do_ahab_close(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
static int do_ahab_close(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
int err;
u16 lc;
Expand Down
Loading

0 comments on commit 0914011

Please sign in to comment.