diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2020-06-26 15:13:33 +0900 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-07-17 09:30:13 -0400 |
commit | b75d8dc5642b71eb029e7cd38031a32029e736cc (patch) | |
tree | e13a2c309a27c528a79f7c49b468c0c2d246a499 /drivers/pci | |
parent | 02ff91e8c60f1f48bee8f4bd1c87ea0892cc5dae (diff) |
treewide: convert bd_t to struct bd_info by coccinelle
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>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/pci-uclass.c | 2 | ||||
-rw-r--r-- | drivers/pci/pcie_fsl_fixup.c | 4 | ||||
-rw-r--r-- | drivers/pci/pcie_layerscape_fixup.c | 4 | ||||
-rw-r--r-- | drivers/pci/pcie_layerscape_fixup_common.c | 2 | ||||
-rw-r--r-- | drivers/pci/pcie_layerscape_fixup_common.h | 4 | ||||
-rw-r--r-- | drivers/pci/pcie_layerscape_gen4_fixup.c | 4 |
6 files changed, 10 insertions, 10 deletions
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index 9ab3539a49..834526c5a4 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -939,7 +939,7 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node, /* Add a region for our local memory */ #ifdef CONFIG_NR_DRAM_BANKS - bd_t *bd = gd->bd; + struct bd_info *bd = gd->bd; if (!bd) return; diff --git a/drivers/pci/pcie_fsl_fixup.c b/drivers/pci/pcie_fsl_fixup.c index cbdc0ef291..f4e227895d 100644 --- a/drivers/pci/pcie_fsl_fixup.c +++ b/drivers/pci/pcie_fsl_fixup.c @@ -35,7 +35,7 @@ static void ft_fsl_pcie_setup(void *blob, struct fsl_pcie *pcie) } /* Fixup Kernel DT for PCIe */ -void pci_of_setup(void *blob, bd_t *bd) +void pci_of_setup(void *blob, struct bd_info *bd) { struct fsl_pcie *pcie; @@ -44,7 +44,7 @@ void pci_of_setup(void *blob, bd_t *bd) } #else -void pci_of_setup(void *blob, bd_t *bd) +void pci_of_setup(void *blob, struct bd_info *bd) { } #endif diff --git a/drivers/pci/pcie_layerscape_fixup.c b/drivers/pci/pcie_layerscape_fixup.c index 25a3c3870c..76e680481a 100644 --- a/drivers/pci/pcie_layerscape_fixup.c +++ b/drivers/pci/pcie_layerscape_fixup.c @@ -266,7 +266,7 @@ static void ft_pcie_ls_setup(void *blob, struct ls_pcie *pcie) } /* Fixup Kernel DT for PCIe */ -void ft_pci_setup_ls(void *blob, bd_t *bd) +void ft_pci_setup_ls(void *blob, struct bd_info *bd) { struct ls_pcie *pcie; @@ -279,7 +279,7 @@ void ft_pci_setup_ls(void *blob, bd_t *bd) } #else /* !CONFIG_OF_BOARD_SETUP */ -void ft_pci_setup_ls(void *blob, bd_t *bd) +void ft_pci_setup_ls(void *blob, struct bd_info *bd) { } #endif diff --git a/drivers/pci/pcie_layerscape_fixup_common.c b/drivers/pci/pcie_layerscape_fixup_common.c index c11c691b86..fef0a75f11 100644 --- a/drivers/pci/pcie_layerscape_fixup_common.c +++ b/drivers/pci/pcie_layerscape_fixup_common.c @@ -13,7 +13,7 @@ #include <asm/arch/soc.h> #include "pcie_layerscape_fixup_common.h" -void ft_pci_setup(void *blob, bd_t *bd) +void ft_pci_setup(void *blob, struct bd_info *bd) { #if defined(CONFIG_PCIE_LAYERSCAPE_GEN4) uint svr; diff --git a/drivers/pci/pcie_layerscape_fixup_common.h b/drivers/pci/pcie_layerscape_fixup_common.h index e1970a5790..70bd3f0cba 100644 --- a/drivers/pci/pcie_layerscape_fixup_common.h +++ b/drivers/pci/pcie_layerscape_fixup_common.h @@ -11,10 +11,10 @@ #include <common.h> -void ft_pci_setup_ls(void *blob, bd_t *bd); +void ft_pci_setup_ls(void *blob, struct bd_info *bd); #ifdef CONFIG_PCIE_LAYERSCAPE_GEN4 -void ft_pci_setup_ls_gen4(void *blob, bd_t *bd); +void ft_pci_setup_ls_gen4(void *blob, struct bd_info *bd); #endif /* CONFIG_PCIE_LAYERSCAPE_GEN4 */ int pcie_next_streamid(int currentid, int id); int pcie_board_fix_fdt(void *fdt); diff --git a/drivers/pci/pcie_layerscape_gen4_fixup.c b/drivers/pci/pcie_layerscape_gen4_fixup.c index 1975004e59..375ce45839 100644 --- a/drivers/pci/pcie_layerscape_gen4_fixup.c +++ b/drivers/pci/pcie_layerscape_gen4_fixup.c @@ -225,7 +225,7 @@ static void ft_pcie_layerscape_gen4_setup(void *blob, struct ls_pcie_g4 *pcie) } /* Fixup Kernel DT for PCIe */ -void ft_pci_setup_ls_gen4(void *blob, bd_t *bd) +void ft_pci_setup_ls_gen4(void *blob, struct bd_info *bd) { struct ls_pcie_g4 *pcie; @@ -238,7 +238,7 @@ void ft_pci_setup_ls_gen4(void *blob, bd_t *bd) } #else /* !CONFIG_OF_BOARD_SETUP */ -void ft_pci_setup_ls_gen4(void *blob, bd_t *bd) +void ft_pci_setup_ls_gen4(void *blob, struct bd_info *bd) { } #endif |