All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 00/40] env: common: Remove environment definitions from common.h
@ 2019-08-02 15:43 Simon Glass
  2019-08-02 15:44 ` [U-Boot] [PATCH v3 31/40] env: Drop the ENTRY typedef Simon Glass
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Simon Glass @ 2019-08-02 15:43 UTC (permalink / raw)
  To: u-boot

At present common.h has a lot of uncommon declarations in it. Many of
these would be better placed elsewhere, in header files more related to
their purpose. In particular the environnment functions should move to
the environment headers. This should reduce the overall amount of code
compiled and the length of time taken to build U-Boot.

This series splits the current environment.h file into:

   env.h           common definitions widely used in U-Boot; and
   env_internal.h  features internal to the environment drivers, etc.

Most files can then include just env.h which is fairly small and does not
have any CONFIG magic.

At the same time some dead code was noticed in common.h so this series
removes some of this.

After this series common.h is down to about 400 lines. For reference it
was about 1000 lines up until 3 years ago.

Changes in v3:
- Move removal of _ENTRY to next patch
- Move removal of _ENTRY to _'Drop ENTRY' patch
- Update w400.c as well
- Rebase to master

Changes in v2:
- Update to add header to image.c instead of bootm.c
- Add new patch to move eth_parse_enetaddr() to net.c/h
- Adjust patch to leave eth_parse_enetaddr() alone
- Fix typdef typo
- Rename ENVF_... flags to ENV_...
- Fix 'too' typo in commit message
- Rename ENVA_... to ENV_...
- Rebase to master

Simon Glass (40):
  common: Move gzip functions into a new gzip header
  common: Drop the dpram_... functions
  common: Move lcd_setmem() to lcd.h
  common: Remove video_setmem()
  env: Create a new file for environment functions
  env: Move get_env_id() to env.h
  env: Move env_get_f() to env.h
  env: Move env_init() to env.h
  env: Move env_relocate() to env.h
  env: Move envmatch() to env.h
  env: Move env_set_hex() to env.h
  env: Move env_set_ulong() to env.h
  env: Move env_get_ulong() to env.h
  env: Move env_get_yesno() to env.h
  env: Move env_get_hex() to env.h
  env: Move env_set() to env.h
  env: Move env_get() to env.h
  env: Move eth_env_get/set_enetaddr() to env.h
  env: net: Move eth_parse_enetaddr() to net.c/h
  env: Move env_fix_drivers() to env.h
  env: Move set_default_vars to env.h
  env: Move env_load/save functions to env.h
  env: Move env import/export functions to env.h
  env: Drop env_crc_update()
  env: Move get/set_default_env() to env.h
  env: Move env_get_char() to env.h
  env: Move env_reloc() to env.h
  env: Rename environment to embedded_environment
  env: Move env_valid to env.h
  env: Move callback definitions to env.h
  env: Drop the ENTRY typedef
  env: Drop _ENTRY
  env: Rename the redundancy flags
  env: Drop the ACTION typedef
  env: Drop the double underscores in search.h
  env: Move TOTAL_MALLOC_LEN to environment.h
  env: Drop environment.h header file where not needed
  env: Rename environment.h to env_internal.h
  Drop PCMCIA
  common: Add a note about the effort to reduce common.h

 README                                        |   2 +-
 api/api.c                                     |   7 +-
 arch/arm/cpu/arm926ejs/spear/spr_misc.c       |   2 +-
 arch/arm/cpu/armv7/vf610/generic.c            |   1 +
 arch/arm/cpu/armv8/fsl-layerscape/cpu.c       |   3 +-
 arch/arm/cpu/armv8/fsl-layerscape/soc.c       |   3 +-
 arch/arm/cpu/armv8/fsl-layerscape/spl.c       |   1 +
 arch/arm/lib/bootm.c                          |   1 +
 arch/arm/mach-davinci/misc.c                  |   2 +-
 arch/arm/mach-imx/cmd_dek.c                   |   1 -
 arch/arm/mach-imx/mx6/opos6ul.c               |   4 +-
 arch/arm/mach-imx/mx7/soc.c                   |   1 +
 arch/arm/mach-imx/video.c                     |   1 +
 arch/arm/mach-kirkwood/cpu.c                  |   1 +
 arch/arm/mach-meson/board-common.c            |   2 +-
 arch/arm/mach-omap2/boot-common.c             |   1 -
 arch/arm/mach-omap2/omap3/clock.c             |   1 -
 arch/arm/mach-omap2/utils.c                   |   2 +-
 arch/arm/mach-rmobile/cpu_info.c              |   1 +
 arch/arm/mach-rockchip/rk3288/rk3288.c        |   1 +
 arch/arm/mach-socfpga/misc_gen5.c             |   1 +
 arch/arm/mach-socfpga/misc_s10.c              |   1 +
 arch/arm/mach-stm32mp/cpu.c                   |   2 +-
 arch/arm/mach-tegra/board2.c                  |   1 +
 arch/arm/mach-tegra/cboot.c                   |   2 +-
 arch/arm/mach-uniphier/board_late_init.c      |   1 +
 arch/arm/mach-uniphier/mmc-first-dev.c        |   1 +
 arch/m68k/lib/bootm.c                         |   2 +-
 arch/microblaze/lib/bootm.c                   |   1 +
 arch/mips/lib/bootm.c                         |   1 +
 arch/nds32/include/asm/u-boot.h               |   1 -
 arch/nds32/lib/bootm.c                        |   1 +
 arch/powerpc/cpu/mpc85xx/cpu_init.c           |   1 +
 arch/powerpc/cpu/mpc85xx/fdt.c                |   2 +-
 arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c |   1 +
 arch/powerpc/cpu/mpc85xx/mp.c                 |   2 +
 arch/powerpc/lib/bootm.c                      |   2 +-
 arch/riscv/include/asm/u-boot.h               |   1 -
 arch/x86/cpu/qemu/e820.c                      |   1 +
 arch/x86/lib/zimage.c                         |   1 +
 arch/xtensa/lib/bootm.c                       |   1 +
 board/Arcturus/ucp1020/cmd_arc.c              |   2 +-
 board/Arcturus/ucp1020/spl.c                  |   3 +-
 board/Arcturus/ucp1020/ucp1020.c              |   1 +
 board/BuR/brppt1/board.c                      |   1 +
 board/BuR/brxre1/board.c                      |   1 +
 board/BuR/common/br_resetc.c                  |   1 +
 board/BuR/common/common.c                     |   1 +
 board/BuS/eb_cpu5282/eb_cpu5282.c             |   1 +
 board/CZ.NIC/turris_mox/turris_mox.c          |   2 +-
 board/CZ.NIC/turris_omnia/turris_omnia.c      |   2 +-
 board/CarMediaLab/flea3/flea3.c               |   1 +
 board/LaCie/net2big_v2/net2big_v2.c           |   2 +-
 board/LaCie/netspace_v2/netspace_v2.c         |   2 +-
 board/Synology/ds414/cmd_syno.c               |   1 +
 board/alliedtelesis/x530/x530.c               |   1 +
 board/amazon/kc1/kc1.c                        |   1 +
 board/amlogic/p200/p200.c                     |   2 +-
 board/amlogic/p201/p201.c                     |   2 +-
 board/amlogic/p212/p212.c                     |   2 +-
 board/amlogic/q200/q200.c                     |   2 +-
 board/amlogic/s400/s400.c                     |   1 -
 board/amlogic/u200/u200.c                     |   1 -
 board/amlogic/w400/w400.c                     |   2 +-
 board/aristainetos/aristainetos-v2.c          |   1 +
 board/armadeus/apf27/apf27.c                  |   1 -
 board/armltd/integrator/integrator.c          |   1 +
 board/atmel/common/board.c                    |   1 +
 board/atmel/common/mac_eeprom.c               |   2 +-
 board/atmel/sama5d3xek/sama5d3xek.c           |   1 +
 board/bachmann/ot1200/ot1200.c                |   1 +
 board/birdland/bav335x/board.c                |   4 +-
 board/bluegiga/apx4devkit/apx4devkit.c        |   1 +
 board/bluewater/gurnard/gurnard.c             |   1 +
 board/bosch/guardian/board.c                  |   3 +-
 board/bosch/shc/board.c                       |   4 +-
 board/boundary/nitrogen6x/nitrogen6x.c        |   1 +
 board/broadcom/bcm23550_w1d/bcm23550_w1d.c    |   1 +
 board/broadcom/bcm28155_ap/bcm28155_ap.c      |   1 +
 board/broadcom/bcmstb/bcmstb.c                |   1 +
 board/buffalo/lsxl/lsxl.c                     |   3 +-
 board/cadence/xtfpga/xtfpga.c                 |   1 +
 board/ccv/xpress/xpress.c                     |   1 +
 board/compulab/cl-som-imx7/cl-som-imx7.c      |   2 +-
 board/compulab/cm_fx6/cm_fx6.c                |   2 +-
 board/compulab/cm_t335/cm_t335.c              |   2 +-
 board/compulab/cm_t35/cm_t35.c                |   2 +-
 board/compulab/cm_t54/cm_t54.c                |   2 +-
 board/compulab/common/omap3_display.c         |   1 +
 board/congatec/cgtqmx6eval/cgtqmx6eval.c      |   1 +
 board/cssi/MCR3000/MCR3000.c                  |   1 +
 board/davinci/da8xxevm/da850evm.c             |   2 +-
 board/davinci/da8xxevm/omapl138_lcdk.c        |   1 +
 board/dhelectronics/dh_imx6/dh_imx6.c         |   2 +-
 board/eets/pdu001/board.c                     |   2 +-
 board/el/el6x/el6x.c                          |   1 +
 board/emulation/qemu-riscv/qemu-riscv.c       |   1 +
 board/engicam/common/board.c                  |   1 +
 board/esd/meesc/meesc.c                       |   1 +
 board/freescale/b4860qds/b4860qds.c           |   1 +
 board/freescale/b4860qds/spl.c                |   3 +-
 board/freescale/bsc9131rdb/bsc9131rdb.c       |   1 +
 board/freescale/bsc9132qds/bsc9132qds.c       |   1 +
 board/freescale/c29xpcie/c29xpcie.c           |   1 +
 board/freescale/c29xpcie/spl.c                |   2 +-
 board/freescale/common/cmd_esbc_validate.c    |   1 +
 board/freescale/common/fsl_chain_of_trust.c   |   1 +
 board/freescale/common/sys_eeprom.c           |   1 +
 board/freescale/common/vid.c                  |   1 +
 board/freescale/corenet_ds/corenet_ds.c       |   1 +
 board/freescale/imx8mq_evk/imx8mq_evk.c       |   1 +
 board/freescale/imx8qm_mek/imx8qm_mek.c       |   2 +-
 board/freescale/imx8qxp_mek/imx8qxp_mek.c     |   2 +-
 board/freescale/ls1012afrdm/ls1012afrdm.c     |   2 +-
 board/freescale/ls1012aqds/ls1012aqds.c       |   2 +-
 board/freescale/ls1012ardb/ls1012ardb.c       |   2 +-
 board/freescale/ls1028a/ls1028a.c             |   2 +-
 board/freescale/ls1088a/eth_ls1088aqds.c      |   1 +
 board/freescale/ls1088a/ls1088a.c             |   3 +-
 board/freescale/ls2080a/ls2080a.c             |   2 +-
 board/freescale/ls2080aqds/eth.c              |   1 +
 board/freescale/ls2080aqds/ls2080aqds.c       |   3 +-
 board/freescale/ls2080ardb/ls2080ardb.c       |   3 +-
 board/freescale/lx2160a/eth_lx2160aqds.c      |   1 +
 board/freescale/lx2160a/lx2160a.c             |   2 +-
 board/freescale/mpc8323erdb/mpc8323erdb.c     |   1 +
 board/freescale/mpc837xemds/pci.c             |   1 +
 board/freescale/mpc837xerdb/mpc837xerdb.c     |   1 +
 board/freescale/mpc8572ds/mpc8572ds.c         |   1 +
 board/freescale/mx51evk/mx51evk_video.c       |   1 +
 board/freescale/mx53loco/mx53loco.c           |   1 +
 board/freescale/mx53loco/mx53loco_video.c     |   1 +
 board/freescale/mx6sabreauto/mx6sabreauto.c   |   1 +
 board/freescale/mx6sabresd/mx6sabresd.c       |   1 +
 board/freescale/mx6sxsabresd/mx6sxsabresd.c   |   1 +
 .../mx6ul_14x14_evk/mx6ul_14x14_evk.c         |   1 +
 board/freescale/mx6ullevk/mx6ullevk.c         |   1 +
 board/freescale/p1010rdb/p1010rdb.c           |   1 +
 board/freescale/p1010rdb/spl.c                |   3 +-
 board/freescale/p1022ds/p1022ds.c             |   1 +
 board/freescale/p1022ds/spl.c                 |   3 +-
 board/freescale/p1023rdb/p1023rdb.c           |   1 +
 board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c   |   1 +
 board/freescale/p1_p2_rdb_pc/spl.c            |   3 +-
 board/freescale/p1_twr/p1_twr.c               |   1 +
 board/freescale/p2041rdb/p2041rdb.c           |   1 +
 board/freescale/qemu-ppce500/qemu-ppce500.c   |   1 +
 board/freescale/t102xqds/spl.c                |   2 +-
 board/freescale/t102xqds/t102xqds.c           |   1 +
 board/freescale/t102xrdb/spl.c                |   2 +-
 board/freescale/t102xrdb/t102xrdb.c           |   1 +
 board/freescale/t1040qds/t1040qds.c           |   1 +
 board/freescale/t104xrdb/spl.c                |   2 +-
 board/freescale/t104xrdb/t104xrdb.c           |   1 +
 board/freescale/t208xqds/spl.c                |   2 +-
 board/freescale/t208xqds/t208xqds.c           |   1 +
 board/freescale/t208xrdb/spl.c                |   2 +-
 board/freescale/t208xrdb/t208xrdb.c           |   1 +
 board/freescale/t4qds/spl.c                   |   2 +-
 board/freescale/t4qds/t4240emu.c              |   1 +
 board/freescale/t4qds/t4240qds.c              |   1 +
 board/freescale/t4rdb/spl.c                   |   2 +-
 board/freescale/t4rdb/t4240rdb.c              |   1 +
 board/gardena/smart-gateway-at91sam/board.c   |   1 +
 board/gardena/smart-gateway-mt7688/board.c    |   3 +-
 board/gateworks/gw_ventana/common.c           |   1 +
 board/gateworks/gw_ventana/gw_ventana.c       |   2 +-
 board/gateworks/gw_ventana/gw_ventana_spl.c   |   3 +-
 board/gdsys/a38x/keyprogram.c                 |   1 +
 board/gdsys/mpc8308/gazerbeam.c               |   1 +
 board/gdsys/mpc8308/hrcon.c                   |   1 +
 board/gdsys/mpc8308/strider.c                 |   1 +
 board/gdsys/p1022/controlcenterd-id.c         |   1 +
 board/gdsys/p1022/controlcenterd.c            |   1 +
 board/ge/bx50v3/bx50v3.c                      |   1 +
 board/ge/common/ge_common.c                   |   1 +
 board/ge/mx53ppd/mx53ppd.c                    |   2 +-
 board/grinn/chiliboard/board.c                |   2 +-
 board/grinn/liteboard/board.c                 |   1 +
 board/gumstix/pepper/board.c                  |   2 +-
 board/highbank/highbank.c                     |   1 +
 board/hisilicon/poplar/poplar.c               |   1 +
 board/imgtec/ci20/ci20.c                      |   2 +-
 board/intel/edison/edison.c                   |   2 +-
 board/isee/igep003x/board.c                   |   2 +-
 board/isee/igep00x0/igep00x0.c                |   1 +
 board/k+p/kp_imx53/kp_id_rev.c                |   2 +-
 board/k+p/kp_imx53/kp_imx53.c                 |   1 +
 board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c         |   1 +
 board/keymile/common/common.c                 |   1 +
 board/keymile/common/ivm.c                    |   1 +
 board/keymile/km83xx/km83xx.c                 |   1 +
 board/keymile/km_arm/km_arm.c                 |   1 +
 board/keymile/kmp204x/kmp204x.c               |   1 +
 board/kosagi/novena/novena.c                  |   2 +-
 board/laird/wb50n/wb50n.c                     |   1 +
 board/lg/sniper/sniper.c                      |   1 +
 board/liebherr/display5/display5.c            |   2 +-
 board/liebherr/display5/spl.c                 |   2 +-
 board/liebherr/mccmon6/mccmon6.c              |   1 +
 board/logicpd/imx6/imx6logic.c                |   1 +
 board/logicpd/zoom1/zoom1.c                   |   2 +-
 board/menlo/m53menlo/m53menlo.c               |   2 +
 board/micronas/vct/vct.c                      |   1 +
 board/mscc/ocelot/ocelot.c                    |   1 -
 board/nokia/rx51/rx51.c                       |   1 +
 board/nvidia/p2371-2180/p2371-2180.c          |   2 +-
 board/nvidia/p2771-0000/p2771-0000.c          |   2 +-
 board/overo/overo.c                           |   1 +
 board/phytec/pcm051/board.c                   |   2 +-
 board/phytec/pcm052/pcm052.c                  |   4 +-
 board/phytec/pfla02/pfla02.c                  |   1 +
 board/phytec/phycore_rk3288/phycore-rk3288.c  |   4 +-
 .../dragonboard410c/dragonboard410c.c         |   2 +-
 .../dragonboard820c/dragonboard820c.c         |   1 +
 board/raspberrypi/rpi/rpi.c                   |   2 +-
 board/renesas/alt/alt.c                       |   3 +-
 board/renesas/blanche/blanche.c               |   2 +-
 board/renesas/gose/gose.c                     |   3 +-
 board/renesas/koelsch/koelsch.c               |   3 +-
 board/renesas/lager/lager.c                   |   3 +-
 board/renesas/porter/porter.c                 |   3 +-
 board/renesas/sh7752evb/sh7752evb.c           |   2 +-
 board/renesas/sh7753evb/sh7753evb.c           |   2 +-
 board/renesas/sh7757lcr/sh7757lcr.c           |   2 +-
 board/renesas/silk/silk.c                     |   3 +-
 board/renesas/stout/stout.c                   |   3 +-
 board/rockchip/tinker_rk3288/tinker-rk3288.c  |   2 +-
 board/samsung/common/exynos5-dt.c             |   1 +
 board/samsung/common/misc.c                   |   1 +
 board/samsung/odroid/odroid.c                 |   1 +
 board/samsung/trats/trats.c                   |   1 +
 board/samsung/universal_c210/universal.c      |   1 +
 board/samtec/vining_fpga/socfpga.c            |   2 +-
 board/siemens/common/board.c                  |   1 +
 board/siemens/common/factoryset.c             |   2 +-
 board/siemens/draco/board.c                   |   1 +
 board/siemens/pxm2/board.c                    |   2 +-
 board/siemens/rut/board.c                     |   1 +
 board/siemens/taurus/taurus.c                 |   2 +-
 board/silica/pengwyn/board.c                  |   2 +-
 board/socrates/socrates.c                     |   1 +
 board/softing/vining_2000/vining_2000.c       |   2 +-
 board/solidrun/mx6cuboxi/mx6cuboxi.c          |   1 +
 board/st/stm32mp1/stm32mp1.c                  |   3 +-
 board/sunxi/board.c                           |   3 +-
 board/synopsys/hsdk/env-lib.c                 |   1 +
 board/synopsys/hsdk/hsdk.c                    |   1 +
 board/tcl/sl50/board.c                        |   4 +-
 board/technologic/ts4800/ts4800.c             |   2 +-
 .../puma_rk3399/puma-rk3399.c                 |   2 +-
 board/ti/am335x/board.c                       |   4 +-
 board/ti/am43xx/board.c                       |   2 +-
 board/ti/am57xx/board.c                       |   2 +-
 board/ti/am65x/evm.c                          |   1 +
 board/ti/beagle/beagle.c                      |   1 +
 board/ti/common/board_detect.c                |   1 +
 board/ti/dra7xx/evm.c                         |   2 +-
 board/ti/evm/evm.c                            |   1 +
 board/ti/ks2_evm/board.c                      |   1 +
 board/ti/ks2_evm/board_k2g.c                  |   1 +
 board/ti/panda/panda.c                        |   1 +
 board/ti/ti814x/evm.c                         |   2 +-
 board/ti/ti816x/evm.c                         |   2 +-
 board/timll/devkit8000/devkit8000.c           |   2 +-
 board/toradex/apalis-imx8/apalis-imx8.c       |   2 +-
 board/toradex/apalis_imx6/apalis_imx6.c       |   2 +-
 .../toradex/colibri-imx6ull/colibri-imx6ull.c |   1 +
 board/toradex/colibri-imx8x/colibri-imx8x.c   |   2 +-
 board/toradex/colibri_imx6/colibri_imx6.c     |   2 +-
 board/toradex/colibri_vf/colibri_vf.c         |   1 +
 board/toradex/common/tdx-cfg-block.c          |   1 +
 board/toradex/common/tdx-common.c             |   2 +-
 board/tqc/tqma6/tqma6.c                       |   1 +
 board/udoo/neo/neo.c                          |   1 +
 board/udoo/udoo.c                             |   1 +
 board/varisys/common/sys_eeprom.c             |   1 +
 board/varisys/cyrus/cyrus.c                   |   1 +
 board/vscom/baltos/board.c                    |   2 +-
 board/wandboard/wandboard.c                   |   1 +
 board/warp7/warp7.c                           |   1 +
 .../work_92105/work_92105_display.c           |   1 +
 board/xes/common/board.c                      |   1 +
 board/xilinx/zynq/board.c                     |   1 +
 board/xilinx/zynqmp/cmds.c                    |   1 +
 board/xilinx/zynqmp/zynqmp.c                  |   1 +
 cmd/Kconfig                                   |   8 -
 cmd/Makefile                                  |   1 -
 cmd/aes.c                                     |   1 -
 cmd/avb.c                                     |   1 +
 cmd/bdinfo.c                                  |   1 +
 cmd/binop.c                                   |   1 +
 cmd/blob.c                                    |   1 -
 cmd/bmp.c                                     |   8 +-
 cmd/bootefi.c                                 |   1 +
 cmd/bootm.c                                   |   2 +-
 cmd/bootmenu.c                                |   1 +
 cmd/cbfs.c                                    |   1 +
 cmd/config.c                                  |   1 +
 cmd/cramfs.c                                  |   1 +
 cmd/dtimg.c                                   |   1 +
 cmd/efidebug.c                                |   1 -
 cmd/elf.c                                     |   2 +-
 cmd/ethsw.c                                   |   2 +-
 cmd/fdt.c                                     |   1 +
 cmd/fpga.c                                    |   2 +
 cmd/gpt.c                                     |   1 +
 cmd/i2c.c                                     |   1 -
 cmd/ide.c                                     |   4 -
 cmd/ini.c                                     |   2 +-
 cmd/itest.c                                   |   1 +
 cmd/jffs2.c                                   |   1 +
 cmd/license.c                                 |   1 +
 cmd/load.c                                    |   1 +
 cmd/lzmadec.c                                 |   1 +
 cmd/md5sum.c                                  |   1 +
 cmd/mtdparts.c                                |   1 +
 cmd/mvebu/bubt.c                              |   1 +
 cmd/nand.c                                    |   1 +
 cmd/net.c                                     |   1 +
 cmd/nvedit.c                                  |  57 +--
 cmd/nvedit_efi.c                              |   1 +
 cmd/part.c                                    |   1 +
 cmd/pcmcia.c                                  | 341 ------------------
 cmd/pxe.c                                     |   1 +
 cmd/qfw.c                                     |   1 +
 cmd/reiser.c                                  |   1 +
 cmd/setexpr.c                                 |   1 +
 cmd/source.c                                  |   1 +
 cmd/spl.c                                     |   1 +
 cmd/tpm-common.c                              |   1 +
 cmd/tpm-v1.c                                  |   1 +
 cmd/tpm_test.c                                |   1 -
 cmd/trace.c                                   |   1 +
 cmd/ubi.c                                     |   1 +
 cmd/unzip.c                                   |   2 +
 cmd/ximg.c                                    |   2 +
 cmd/zfs.c                                     |   1 +
 cmd/zip.c                                     |   1 +
 common/autoboot.c                             |   1 +
 common/board_f.c                              |  11 +-
 common/board_r.c                              |  17 +-
 common/bootm.c                                |   1 +
 common/bootm_os.c                             |   1 +
 common/bootretry.c                            |   1 +
 common/cli.c                                  |   1 +
 common/cli_hush.c                             |   1 +
 common/cli_simple.c                           |   1 +
 common/command.c                              |   1 +
 common/console.c                              |   3 +-
 common/fdt_support.c                          |   1 +
 common/hash.c                                 |   1 +
 common/hwconfig.c                             |   1 +
 common/image-android.c                        |   1 +
 common/image-fdt.c                            |   1 +
 common/image.c                                |   3 +-
 common/main.c                                 |   1 +
 common/spl/spl_dfu.c                          |   4 +-
 common/spl/spl_ext.c                          |   1 +
 common/spl/spl_fat.c                          |   1 +
 common/spl/spl_fit.c                          |   1 +
 common/spl/spl_net.c                          |   1 +
 common/spl/spl_ymodem.c                       |   1 +
 common/splash.c                               |   1 +
 common/splash_source.c                        |   1 +
 common/update.c                               |   1 +
 common/usb_hub.c                              |   1 +
 common/usb_kbd.c                              |   1 +
 disk/part.c                                   |   1 +
 disk/part_amiga.c                             |   1 +
 doc/README.marubun-pcmcia                     |  65 ----
 doc/README.ne2000                             |  11 -
 drivers/Kconfig                               |   2 -
 drivers/Makefile                              |   1 -
 drivers/bootcount/bootcount_env.c             |   2 +-
 drivers/ddr/fsl/fsl_ddr_gen4.c                |   1 +
 drivers/ddr/fsl/interactive.c                 |   1 +
 drivers/ddr/fsl/options.c                     |   1 +
 drivers/dfu/dfu.c                             |   1 +
 drivers/fastboot/fb_command.c                 |   1 +
 drivers/fastboot/fb_common.c                  |   1 +
 drivers/fastboot/fb_getvar.c                  |   1 +
 drivers/fastboot/fb_mmc.c                     |   1 +
 drivers/input/i8042.c                         |   1 +
 drivers/input/input.c                         |   1 +
 drivers/misc/fs_loader.c                      |   1 +
 drivers/mtd/cfi_flash.c                       |   3 +-
 drivers/mtd/jedec_flash.c                     |   1 -
 drivers/mtd/mtd_uboot.c                       |   1 +
 drivers/net/dc2114x.c                         |   1 +
 drivers/net/fec_mxc.c                         |   2 +-
 drivers/net/fm/b4860.c                        |   1 +
 drivers/net/fm/fdt.c                          |   1 +
 drivers/net/fm/fm.c                           |   2 +-
 drivers/net/fsl-mc/mc.c                       |   1 +
 drivers/net/fsl_mcdmafec.c                    |   2 +-
 drivers/net/ftmac100.c                        |   1 +
 drivers/net/lan91c96.c                        |   1 +
 drivers/net/mcffec.c                          |   2 +-
 drivers/net/ne2000_base.c                     |  12 +-
 drivers/net/netconsole.c                      |   5 +-
 drivers/net/phy/micrel_ksz90x1.c              |   1 +
 drivers/net/sandbox-raw.c                     |   1 +
 drivers/net/sh_eth.c                          |   2 +-
 drivers/net/ti/cpsw-common.c                  |   1 -
 drivers/pci/fsl_pci_init.c                    |   1 +
 drivers/pci/pci.c                             |   1 +
 drivers/pci/pci_common.c                      |   1 +
 drivers/pcmcia/Kconfig                        |   0
 drivers/pcmcia/Makefile                       |   6 -
 drivers/pcmcia/marubun_pcmcia.c               |  99 -----
 drivers/qe/qe.c                               |   1 -
 drivers/reset/reset-socfpga.c                 |   1 +
 drivers/rtc/m41t60.c                          |   1 +
 drivers/scsi/scsi.c                           |   1 +
 drivers/serial/serial-uclass.c                |   2 +-
 drivers/serial/serial.c                       |   2 +-
 drivers/serial/usbtty.c                       |   1 +
 drivers/tee/sandbox.c                         |   8 +-
 drivers/usb/gadget/designware_udc.c           |   1 +
 drivers/usb/gadget/ether.c                    |   2 +-
 drivers/usb/gadget/f_dfu.c                    |   1 +
 drivers/usb/gadget/f_fastboot.c               |   1 +
 drivers/usb/gadget/f_rockusb.c                |   1 +
 drivers/usb/gadget/f_sdp.c                    |   1 +
 drivers/usb/host/ehci-fsl.c                   |   1 +
 drivers/video/ati_radeon_fb.c                 |   1 +
 drivers/video/cfb_console.c                   |   2 +
 drivers/video/mb862xx.c                       |   1 +
 drivers/video/mx3fb.c                         |   1 +
 drivers/video/mxsfb.c                         |   1 +
 drivers/video/videomodes.c                    |   1 +
 env/callback.c                                |  11 +-
 env/common.c                                  |  21 +-
 env/eeprom.c                                  |  13 +-
 env/embedded.c                                |   2 +-
 env/env.c                                     |   3 +-
 env/ext4.c                                    |   5 +-
 env/fat.c                                     |   5 +-
 env/flags.c                                   |  15 +-
 env/flash.c                                   |  23 +-
 env/mmc.c                                     |   7 +-
 env/nand.c                                    |   9 +-
 env/nowhere.c                                 |   3 +-
 env/nvram.c                                   |   3 +-
 env/onenand.c                                 |   2 +-
 env/remote.c                                  |   2 +-
 env/sata.c                                    |   5 +-
 env/sf.c                                      |  19 +-
 env/ubi.c                                     |   9 +-
 examples/api/demo.c                           |   1 +
 examples/api/glue.c                           |   3 +-
 fs/fs.c                                       |   1 +
 fs/ubifs/ubifs.c                              |   2 +
 include/bootcount.h                           |   1 +
 include/command.h                             |   1 +
 include/common.h                              | 191 +---------
 include/env.h                                 | 335 +++++++++++++++++
 include/env_callback.h                        |  25 +-
 include/env_default.h                         |   2 +-
 include/env_flags.h                           |   7 +-
 include/{environment.h => env_internal.h}     | 110 ++----
 include/exports.h                             |   1 +
 include/gzip.h                                | 103 ++++++
 include/lcd.h                                 |   1 +
 include/net.h                                 |  12 +
 include/pcmcia.h                              | 137 -------
 include/pcmcia/yenta.h                        | 156 --------
 include/search.h                              |  77 ++--
 lib/efi_loader/efi_boottime.c                 |   1 -
 lib/efi_loader/efi_console.c                  |   1 +
 lib/efi_loader/efi_variable.c                 |   3 +-
 lib/fdtdec.c                                  |   2 +
 lib/gunzip.c                                  |   5 +-
 lib/gzip.c                                    |   1 +
 lib/hashtable.c                               |  66 ++--
 lib/smbios.c                                  |   1 +
 lib/uuid.c                                    |   1 +
 net/bootp.c                                   |   1 +
 net/dns.c                                     |   1 +
 net/eth-uclass.c                              |   2 +-
 net/eth_common.c                              |   4 +-
 net/eth_legacy.c                              |   2 +-
 net/link_local.c                              |   1 +
 net/net.c                                     |  15 +-
 net/tftp.c                                    |   1 +
 net/wol.c                                     |   2 +-
 post/post.c                                   |   1 +
 scripts/config_whitelist.txt                  |   6 -
 test/compression.c                            |   1 +
 test/dm/eth.c                                 |   1 +
 test/env/hashtable.c                          |  20 +-
 tools/env/fw_env.c                            |  24 +-
 tools/env/fw_env.h                            |   1 +
 tools/env/fw_env_main.c                       |   1 +
 tools/envcrc.c                                |   6 +-
 496 files changed, 1197 insertions(+), 1555 deletions(-)
 delete mode 100644 cmd/pcmcia.c
 delete mode 100644 doc/README.marubun-pcmcia
 delete mode 100644 drivers/pcmcia/Kconfig
 delete mode 100644 drivers/pcmcia/Makefile
 delete mode 100644 drivers/pcmcia/marubun_pcmcia.c
 create mode 100644 include/env.h
 rename include/{environment.h => env_internal.h} (75%)
 create mode 100644 include/gzip.h
 delete mode 100644 include/pcmcia.h
 delete mode 100644 include/pcmcia/yenta.h

-- 
2.22.0.770.g0f2c4a37fd-goog

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 31/40] env: Drop the ENTRY typedef
  2019-08-02 15:43 [U-Boot] [PATCH v3 00/40] env: common: Remove environment definitions from common.h Simon Glass
@ 2019-08-02 15:44 ` Simon Glass
  2019-08-13 16:56   ` Tom Rini
  2019-08-02 15:44 ` [U-Boot] [PATCH v3 32/40] env: Drop _ENTRY Simon Glass
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Simon Glass @ 2019-08-02 15:44 UTC (permalink / raw)
  To: u-boot

U-Boot is not supposed to use typedef for structs anymore. Also this name
is the same as the ENTRY() macro used in assembler files, and 'entry'
itself is widely used in U-Boot (>8k matches).

Drop the typedef and rename the struct to env_entry to reduce confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v3:
- Move removal of _ENTRY to next patch

Changes in v2:
- Fix typdef typo

 api/api.c              |  2 +-
 cmd/nvedit.c           | 12 +++++------
 drivers/tee/sandbox.c  |  2 +-
 env/callback.c         |  6 +++---
 env/common.c           |  2 +-
 env/flags.c            | 10 +++++-----
 include/env_callback.h |  2 +-
 include/env_flags.h    |  6 +++---
 include/search.h       | 21 +++++++++++---------
 lib/hashtable.c        | 45 +++++++++++++++++++++---------------------
 test/env/hashtable.c   | 12 +++++------
 11 files changed, 62 insertions(+), 58 deletions(-)

diff --git a/api/api.c b/api/api.c
index 8a41b7cce7..a0fc62ca9e 100644
--- a/api/api.c
+++ b/api/api.c
@@ -497,7 +497,7 @@ static int API_env_enum(va_list ap)
 {
 	int i, buflen;
 	char *last, **next, *s;
-	ENTRY *match, search;
+	struct env_entry *match, search;
 	static char *var;
 
 	last = (char *)va_arg(ap, unsigned long);
diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index acbe85b8e4..39140c0733 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -94,7 +94,7 @@ static int env_print(char *name, int flag)
 	ssize_t len;
 
 	if (name) {		/* print a single name */
-		ENTRY e, *ep;
+		struct env_entry e, *ep;
 
 		e.key = name;
 		e.data = NULL;
@@ -225,7 +225,7 @@ static int _do_env_set(int flag, int argc, char * const argv[], int env_flag)
 {
 	int   i, len;
 	char  *name, *value, *s;
-	ENTRY e, *ep;
+	struct env_entry e, *ep;
 
 	debug("Initial value for argc=%d\n", argc);
 
@@ -473,7 +473,7 @@ static int print_static_binding(const char *var_name, const char *callback_name,
 	return 0;
 }
 
-static int print_active_callback(ENTRY *entry)
+static int print_active_callback(struct env_entry *entry)
 {
 	struct env_clbk_tbl *clbkp;
 	int i;
@@ -554,7 +554,7 @@ static int print_static_flags(const char *var_name, const char *flags,
 	return 0;
 }
 
-static int print_active_flags(ENTRY *entry)
+static int print_active_flags(struct env_entry *entry)
 {
 	enum env_flags_vartype type;
 	enum env_flags_varaccess access;
@@ -662,7 +662,7 @@ static int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc,
 char *env_get(const char *name)
 {
 	if (gd->flags & GD_FLG_ENV_READY) { /* after import into hashtable */
-		ENTRY e, *ep;
+		struct env_entry e, *ep;
 
 		WATCHDOG_RESET();
 
@@ -1262,7 +1262,7 @@ static int do_env_info(cmd_tbl_t *cmdtp, int flag,
 static int do_env_exists(cmd_tbl_t *cmdtp, int flag, int argc,
 		       char * const argv[])
 {
-	ENTRY e, *ep;
+	struct env_entry e, *ep;
 
 	if (argc < 2)
 		return CMD_RET_USAGE;
diff --git a/drivers/tee/sandbox.c b/drivers/tee/sandbox.c
index 2f3355c7b7..4bbcf74967 100644
--- a/drivers/tee/sandbox.c
+++ b/drivers/tee/sandbox.c
@@ -79,7 +79,7 @@ static u32 ta_avb_invoke_func(struct udevice *dev, u32 func, uint num_params,
 			      struct tee_param *params)
 {
 	struct sandbox_tee_state *state = dev_get_priv(dev);
-	ENTRY e, *ep;
+	struct env_entry e, *ep;
 	char *name;
 	u32 res;
 	uint slot;
diff --git a/env/callback.c b/env/callback.c
index 95be80d454..d539da93aa 100644
--- a/env/callback.c
+++ b/env/callback.c
@@ -43,7 +43,7 @@ static const char *callback_list;
  * This is called specifically when the variable did not exist in the hash
  * previously, so the blanket update did not find this variable.
  */
-void env_callback_init(ENTRY *var_entry)
+void env_callback_init(struct env_entry *var_entry)
 {
 	const char *var_name = var_entry->key;
 	char callback_name[256] = "";
@@ -80,7 +80,7 @@ void env_callback_init(ENTRY *var_entry)
  * Called on each existing env var prior to the blanket update since removing
  * a callback association should remove its callback.
  */
-static int clear_callback(ENTRY *entry)
+static int clear_callback(struct env_entry *entry)
 {
 	entry->callback = NULL;
 
@@ -92,7 +92,7 @@ static int clear_callback(ENTRY *entry)
  */
 static int set_callback(const char *name, const char *value, void *priv)
 {
-	ENTRY e, *ep;
+	struct env_entry e, *ep;
 	struct env_clbk_tbl *clbkp;
 
 	e.key	= name;
diff --git a/env/common.c b/env/common.c
index 1d9d0f934d..474ea2280b 100644
--- a/env/common.c
+++ b/env/common.c
@@ -250,7 +250,7 @@ void env_relocate(void)
 int env_complete(char *var, int maxv, char *cmdv[], int bufsz, char *buf,
 		 bool dollar_comp)
 {
-	ENTRY *match;
+	struct env_entry *match;
 	int found, idx;
 
 	if (dollar_comp) {
diff --git a/env/flags.c b/env/flags.c
index 7277711594..fdbad7bf33 100644
--- a/env/flags.c
+++ b/env/flags.c
@@ -419,7 +419,7 @@ static const char *flags_list;
  * This is called specifically when the variable did not exist in the hash
  * previously, so the blanket update did not find this variable.
  */
-void env_flags_init(ENTRY *var_entry)
+void env_flags_init(struct env_entry *var_entry)
 {
 	const char *var_name = var_entry->key;
 	char flags[ENV_FLAGS_ATTR_MAX_LEN + 1] = "";
@@ -441,7 +441,7 @@ void env_flags_init(ENTRY *var_entry)
  * Called on each existing env var prior to the blanket update since removing
  * a flag in the flag list should remove its flags.
  */
-static int clear_flags(ENTRY *entry)
+static int clear_flags(struct env_entry *entry)
 {
 	entry->flags = 0;
 
@@ -453,7 +453,7 @@ static int clear_flags(ENTRY *entry)
  */
 static int set_flags(const char *name, const char *value, void *priv)
 {
-	ENTRY e, *ep;
+	struct env_entry e, *ep;
 
 	e.key	= name;
 	e.data	= NULL;
@@ -496,8 +496,8 @@ U_BOOT_ENV_CALLBACK(flags, on_flags);
  * overwriting of write-once variables.
  */
 
-int env_flags_validate(const ENTRY *item, const char *newval, enum env_op op,
-	int flag)
+int env_flags_validate(const struct env_entry *item, const char *newval,
+		       enum env_op op, int flag)
 {
 	const char *name;
 	const char *oldval = NULL;
diff --git a/include/env_callback.h b/include/env_callback.h
index 3d30a33f5b..982c07854d 100644
--- a/include/env_callback.h
+++ b/include/env_callback.h
@@ -72,6 +72,6 @@
 	"serial#:serialno," \
 	CONFIG_ENV_CALLBACK_LIST_STATIC
 
-void env_callback_init(ENTRY *var_entry);
+void env_callback_init(struct env_entry *var_entry);
 
 #endif /* __ENV_CALLBACK_H__ */
diff --git a/include/env_flags.h b/include/env_flags.h
index f2306436b4..e5380f2948 100644
--- a/include/env_flags.h
+++ b/include/env_flags.h
@@ -153,13 +153,13 @@ int env_flags_validate_env_set_params(char *name, char *const val[], int count);
  * When adding a variable to the environment, initialize the flags for that
  * variable.
  */
-void env_flags_init(ENTRY *var_entry);
+void env_flags_init(struct env_entry *var_entry);
 
 /*
  * Validate the newval for to conform with the requirements defined by its flags
  */
-int env_flags_validate(const ENTRY *item, const char *newval, enum env_op op,
-	int flag);
+int env_flags_validate(const struct env_entry *item, const char *newval,
+		       enum env_op op, int flag);
 
 #endif /* USE_HOSTCC */
 
diff --git a/include/search.h b/include/search.h
index f9fb29fdf9..81745a917d 100644
--- a/include/search.h
+++ b/include/search.h
@@ -25,13 +25,14 @@ typedef enum {
 	ENTER
 } ACTION;
 
-typedef struct entry {
+/** struct env_entry - An entry in the environment hashtable */
+struct env_entry {
 	const char *key;
 	char *data;
 	int (*callback)(const char *name, const char *value, enum env_op op,
 		int flags);
 	int flags;
-} ENTRY;
+};
 
 /* Opaque type for internal use.  */
 struct _ENTRY;
@@ -54,8 +55,8 @@ struct hsearch_data {
  * shall force overwriting of write-once variables.
  * Must return 0 for approval, 1 for denial.
  */
-	int (*change_ok)(const ENTRY *__item, const char *newval, enum env_op,
-		int flag);
+	int (*change_ok)(const struct env_entry *__item, const char *newval,
+			 enum env_op, int flag);
 };
 
 /* Create a new hash table which will contain at most "__nel" elements.  */
@@ -70,15 +71,16 @@ extern void hdestroy_r(struct hsearch_data *__htab);
  * NULL.  If ACTION is `ENTER' replace existing data (if any) with
  * __item.data.
  * */
-extern int hsearch_r(ENTRY __item, ACTION __action, ENTRY ** __retval,
-		     struct hsearch_data *__htab, int __flag);
+extern int hsearch_r(struct env_entry __item, ACTION __action,
+		     struct env_entry **__retval, struct hsearch_data *__htab,
+		     int __flag);
 
 /*
  * Search for an entry matching "__match".  Otherwise, Same semantics
  * as hsearch_r().
  */
-extern int hmatch_r(const char *__match, int __last_idx, ENTRY ** __retval,
-		    struct hsearch_data *__htab);
+extern int hmatch_r(const char *__match, int __last_idx,
+		    struct env_entry **__retval, struct hsearch_data *__htab);
 
 /* Search and delete entry matching "__key" in internal hash table. */
 extern int hdelete_r(const char *__key, struct hsearch_data *__htab,
@@ -98,7 +100,8 @@ extern int himport_r(struct hsearch_data *__htab,
 		     char * const vars[]);
 
 /* Walk the whole table calling the callback on each element */
-extern int hwalk_r(struct hsearch_data *__htab, int (*callback)(ENTRY *));
+extern int hwalk_r(struct hsearch_data *__htab,
+		   int (*callback)(struct env_entry *entry));
 
 /* Flags for himport_r(), hexport_r(), hdelete_r(), and hsearch_r() */
 #define H_NOCLEAR	(1 << 0) /* do not clear hash table before importing */
diff --git a/lib/hashtable.c b/lib/hashtable.c
index 0d288d12d9..c77b68f4e6 100644
--- a/lib/hashtable.c
+++ b/lib/hashtable.c
@@ -61,12 +61,12 @@
 
 typedef struct _ENTRY {
 	int used;
-	ENTRY entry;
+	struct env_entry entry;
 } _ENTRY;
 
 
-static void _hdelete(const char *key, struct hsearch_data *htab, ENTRY *ep,
-	int idx);
+static void _hdelete(const char *key, struct hsearch_data *htab,
+		     struct env_entry *ep, int idx);
 
 /*
  * hcreate()
@@ -151,7 +151,7 @@ void hdestroy_r(struct hsearch_data *htab)
 	/* free used memory */
 	for (i = 1; i <= htab->size; ++i) {
 		if (htab->table[i].used > 0) {
-			ENTRY *ep = &htab->table[i].entry;
+			struct env_entry *ep = &htab->table[i].entry;
 
 			free((void *)ep->key);
 			free(ep->data);
@@ -200,7 +200,7 @@ void hdestroy_r(struct hsearch_data *htab)
  *   example for functions like hdelete().
  */
 
-int hmatch_r(const char *match, int last_idx, ENTRY ** retval,
+int hmatch_r(const char *match, int last_idx, struct env_entry **retval,
 	     struct hsearch_data *htab)
 {
 	unsigned int idx;
@@ -224,9 +224,10 @@ int hmatch_r(const char *match, int last_idx, ENTRY ** retval,
  * Compare an existing entry with the desired key, and overwrite if the action
  * is ENTER.  This is simply a helper function for hsearch_r().
  */
-static inline int _compare_and_overwrite_entry(ENTRY item, ACTION action,
-	ENTRY **retval, struct hsearch_data *htab, int flag,
-	unsigned int hval, unsigned int idx)
+static inline int _compare_and_overwrite_entry(struct env_entry item,
+		ACTION action, struct env_entry **retval,
+		struct hsearch_data *htab, int flag, unsigned int hval,
+		unsigned int idx)
 {
 	if (htab->table[idx].used == hval
 	    && strcmp(item.key, htab->table[idx].entry.key) == 0) {
@@ -270,7 +271,7 @@ static inline int _compare_and_overwrite_entry(ENTRY item, ACTION action,
 	return -1;
 }
 
-int hsearch_r(ENTRY item, ACTION action, ENTRY ** retval,
+int hsearch_r(struct env_entry item, ACTION action, struct env_entry **retval,
 	      struct hsearch_data *htab, int flag)
 {
 	unsigned int hval;
@@ -431,10 +432,10 @@ int hsearch_r(ENTRY item, ACTION action, ENTRY ** retval,
  * do that.
  */
 
-static void _hdelete(const char *key, struct hsearch_data *htab, ENTRY *ep,
-	int idx)
+static void _hdelete(const char *key, struct hsearch_data *htab,
+		     struct env_entry *ep, int idx)
 {
-	/* free used ENTRY */
+	/* free used entry */
 	debug("hdelete: DELETING key \"%s\"\n", key);
 	free((void *)ep->key);
 	free(ep->data);
@@ -447,7 +448,7 @@ static void _hdelete(const char *key, struct hsearch_data *htab, ENTRY *ep,
 
 int hdelete_r(const char *key, struct hsearch_data *htab, int flag)
 {
-	ENTRY e, *ep;
+	struct env_entry e, *ep;
 	int idx;
 
 	debug("hdelete: DELETE key \"%s\"\n", key);
@@ -528,8 +529,8 @@ int hdelete_r(const char *key, struct hsearch_data *htab, int flag)
 
 static int cmpkey(const void *p1, const void *p2)
 {
-	ENTRY *e1 = *(ENTRY **) p1;
-	ENTRY *e2 = *(ENTRY **) p2;
+	struct env_entry *e1 = *(struct env_entry **)p1;
+	struct env_entry *e2 = *(struct env_entry **)p2;
 
 	return (strcmp(e1->key, e2->key));
 }
@@ -563,8 +564,8 @@ static int match_string(int flag, const char *str, const char *pat, void *priv)
 	return 0;
 }
 
-static int match_entry(ENTRY *ep, int flag,
-		 int argc, char * const argv[])
+static int match_entry(struct env_entry *ep, int flag, int argc,
+		       char *const argv[])
 {
 	int arg;
 	void *priv = NULL;
@@ -596,7 +597,7 @@ ssize_t hexport_r(struct hsearch_data *htab, const char sep, int flag,
 		 char **resp, size_t size,
 		 int argc, char * const argv[])
 {
-	ENTRY *list[htab->size];
+	struct env_entry *list[htab->size];
 	char *res, *p;
 	size_t totlen;
 	int i, n;
@@ -617,7 +618,7 @@ ssize_t hexport_r(struct hsearch_data *htab, const char sep, int flag,
 	for (i = 1, n = 0, totlen = 0; i <= htab->size; ++i) {
 
 		if (htab->table[i].used > 0) {
-			ENTRY *ep = &htab->table[i].entry;
+			struct env_entry *ep = &htab->table[i].entry;
 			int found = match_entry(ep, flag, argc, argv);
 
 			if ((argc > 0) && (found == 0))
@@ -657,7 +658,7 @@ ssize_t hexport_r(struct hsearch_data *htab, const char sep, int flag,
 #endif
 
 	/* Sort list by keys */
-	qsort(list, n, sizeof(ENTRY *), cmpkey);
+	qsort(list, n, sizeof(struct env_entry *), cmpkey);
 
 	/* Check if the user supplied buffer size is sufficient */
 	if (size) {
@@ -869,7 +870,7 @@ int himport_r(struct hsearch_data *htab,
 	}
 	/* Parse environment; allow for '\0' and 'sep' as separators */
 	do {
-		ENTRY e, *rv;
+		struct env_entry e, *rv;
 
 		/* skip leading white space */
 		while (isblank(*dp))
@@ -976,7 +977,7 @@ end:
  * Walk all of the entries in the hash, calling the callback for each one.
  * this allows some generic operation to be performed on each element.
  */
-int hwalk_r(struct hsearch_data *htab, int (*callback)(ENTRY *))
+int hwalk_r(struct hsearch_data *htab, int (*callback)(struct env_entry *entry))
 {
 	int i;
 	int retval;
diff --git a/test/env/hashtable.c b/test/env/hashtable.c
index 8c87e65457..bad276bd10 100644
--- a/test/env/hashtable.c
+++ b/test/env/hashtable.c
@@ -18,8 +18,8 @@ static int htab_fill(struct unit_test_state *uts,
 		     struct hsearch_data *htab, size_t size)
 {
 	size_t i;
-	ENTRY item;
-	ENTRY *ritem;
+	struct env_entry item;
+	struct env_entry *ritem;
 	char key[20];
 
 	for (i = 0; i < size; i++) {
@@ -38,8 +38,8 @@ static int htab_check_fill(struct unit_test_state *uts,
 			   struct hsearch_data *htab, size_t size)
 {
 	size_t i;
-	ENTRY item;
-	ENTRY *ritem;
+	struct env_entry item;
+	struct env_entry *ritem;
 	char key[20];
 
 	for (i = 0; i < size; i++) {
@@ -61,8 +61,8 @@ static int htab_create_delete(struct unit_test_state *uts,
 			      struct hsearch_data *htab, size_t iterations)
 {
 	size_t i;
-	ENTRY item;
-	ENTRY *ritem;
+	struct env_entry item;
+	struct env_entry *ritem;
 	char key[20];
 
 	for (i = 0; i < iterations; i++) {
-- 
2.22.0.770.g0f2c4a37fd-goog

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 32/40] env: Drop _ENTRY
  2019-08-02 15:43 [U-Boot] [PATCH v3 00/40] env: common: Remove environment definitions from common.h Simon Glass
  2019-08-02 15:44 ` [U-Boot] [PATCH v3 31/40] env: Drop the ENTRY typedef Simon Glass
@ 2019-08-02 15:44 ` Simon Glass
  2019-08-02 17:00   ` Joe Hershberger
  2019-08-13 16:56   ` Tom Rini
  2019-08-02 15:44 ` [U-Boot] [PATCH v3 38/40] env: Rename environment.h to env_internal.h Simon Glass
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 12+ messages in thread
From: Simon Glass @ 2019-08-02 15:44 UTC (permalink / raw)
  To: u-boot

This typedef does not need to be defined in the search.h header since it
is only used in one file (hashtable.c). Remove it from the header and
change it to a struct.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v3:
- Move removal of _ENTRY to _'Drop ENTRY' patch

Changes in v2: None

 include/search.h | 5 +----
 lib/hashtable.c  | 7 ++++---
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/include/search.h b/include/search.h
index 81745a917d..c99648f80b 100644
--- a/include/search.h
+++ b/include/search.h
@@ -34,9 +34,6 @@ struct env_entry {
 	int flags;
 };
 
-/* Opaque type for internal use.  */
-struct _ENTRY;
-
 /*
  * Family of hash table handling functions.  The functions also
  * have reentrant counterparts ending with _r.  The non-reentrant
@@ -45,7 +42,7 @@ struct _ENTRY;
 
 /* Data type for reentrant functions.  */
 struct hsearch_data {
-	struct _ENTRY *table;
+	struct env_entry_node *table;
 	unsigned int size;
 	unsigned int filled;
 /*
diff --git a/lib/hashtable.c b/lib/hashtable.c
index c77b68f4e6..1093d8adaa 100644
--- a/lib/hashtable.c
+++ b/lib/hashtable.c
@@ -59,10 +59,10 @@
  * which describes the current status.
  */
 
-typedef struct _ENTRY {
+struct env_entry_node {
 	int used;
 	struct env_entry entry;
-} _ENTRY;
+};
 
 
 static void _hdelete(const char *key, struct hsearch_data *htab,
@@ -120,7 +120,8 @@ int hcreate_r(size_t nel, struct hsearch_data *htab)
 	htab->filled = 0;
 
 	/* allocate memory and zero out */
-	htab->table = (_ENTRY *) calloc(htab->size + 1, sizeof(_ENTRY));
+	htab->table = (struct env_entry_node *)calloc(htab->size + 1,
+						sizeof(struct env_entry_node));
 	if (htab->table == NULL)
 		return 0;
 
-- 
2.22.0.770.g0f2c4a37fd-goog

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 38/40] env: Rename environment.h to env_internal.h
  2019-08-02 15:43 [U-Boot] [PATCH v3 00/40] env: common: Remove environment definitions from common.h Simon Glass
  2019-08-02 15:44 ` [U-Boot] [PATCH v3 31/40] env: Drop the ENTRY typedef Simon Glass
  2019-08-02 15:44 ` [U-Boot] [PATCH v3 32/40] env: Drop _ENTRY Simon Glass
@ 2019-08-02 15:44 ` Simon Glass
  2019-08-13 16:56   ` Tom Rini
  2019-08-02 15:44 ` [U-Boot] [PATCH v3 40/40] common: Add a note about the effort to reduce common.h Simon Glass
  2019-08-02 16:55 ` [U-Boot] [PATCH v3 00/40] env: common: Remove environment definitions from common.h Joe Hershberger
  4 siblings, 1 reply; 12+ messages in thread
From: Simon Glass @ 2019-08-02 15:44 UTC (permalink / raw)
  To: u-boot

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
---

Changes in v3:
- Update w400.c as well

Changes in v2: None

 api/api.c                                    |  2 +-
 arch/arm/cpu/armv8/fsl-layerscape/cpu.c      |  2 +-
 arch/arm/cpu/armv8/fsl-layerscape/soc.c      |  2 +-
 arch/x86/cpu/qemu/e820.c                     |  2 +-
 board/Arcturus/ucp1020/spl.c                 |  2 +-
 board/amlogic/w400/w400.c                    |  2 +-
 board/birdland/bav335x/board.c               |  2 +-
 board/bosch/guardian/board.c                 |  2 +-
 board/bosch/shc/board.c                      |  2 +-
 board/buffalo/lsxl/lsxl.c                    |  2 +-
 board/freescale/b4860qds/spl.c               |  2 +-
 board/freescale/c29xpcie/spl.c               |  2 +-
 board/freescale/ls1012afrdm/ls1012afrdm.c    |  2 +-
 board/freescale/ls1012aqds/ls1012aqds.c      |  2 +-
 board/freescale/ls1012ardb/ls1012ardb.c      |  2 +-
 board/freescale/ls1028a/ls1028a.c            |  2 +-
 board/freescale/ls1088a/ls1088a.c            |  2 +-
 board/freescale/ls2080a/ls2080a.c            |  2 +-
 board/freescale/ls2080aqds/ls2080aqds.c      |  2 +-
 board/freescale/ls2080ardb/ls2080ardb.c      |  2 +-
 board/freescale/lx2160a/lx2160a.c            |  2 +-
 board/freescale/p1010rdb/spl.c               |  2 +-
 board/freescale/p1022ds/spl.c                |  2 +-
 board/freescale/p1_p2_rdb_pc/spl.c           |  2 +-
 board/freescale/t102xqds/spl.c               |  2 +-
 board/freescale/t102xrdb/spl.c               |  2 +-
 board/freescale/t104xrdb/spl.c               |  2 +-
 board/freescale/t208xqds/spl.c               |  2 +-
 board/freescale/t208xrdb/spl.c               |  2 +-
 board/freescale/t4qds/spl.c                  |  2 +-
 board/freescale/t4rdb/spl.c                  |  2 +-
 board/gardena/smart-gateway-mt7688/board.c   |  2 +-
 board/phytec/phycore_rk3288/phycore-rk3288.c |  2 +-
 board/renesas/alt/alt.c                      |  2 +-
 board/renesas/gose/gose.c                    |  2 +-
 board/renesas/koelsch/koelsch.c              |  2 +-
 board/renesas/lager/lager.c                  |  2 +-
 board/renesas/porter/porter.c                |  2 +-
 board/renesas/silk/silk.c                    |  2 +-
 board/renesas/stout/stout.c                  |  2 +-
 board/st/stm32mp1/stm32mp1.c                 |  2 +-
 board/sunxi/board.c                          |  2 +-
 board/tcl/sl50/board.c                       |  2 +-
 board/ti/am335x/board.c                      |  2 +-
 cmd/nvedit.c                                 |  2 +-
 common/board_f.c                             |  2 +-
 common/board_r.c                             |  2 +-
 common/console.c                             |  2 +-
 drivers/mtd/cfi_flash.c                      |  2 +-
 drivers/serial/serial-uclass.c               |  2 +-
 drivers/serial/serial.c                      |  2 +-
 env/callback.c                               |  2 +-
 env/common.c                                 |  2 +-
 env/eeprom.c                                 |  2 +-
 env/embedded.c                               |  2 +-
 env/env.c                                    |  2 +-
 env/ext4.c                                   |  2 +-
 env/fat.c                                    |  2 +-
 env/flags.c                                  |  2 +-
 env/flash.c                                  |  2 +-
 env/mmc.c                                    |  2 +-
 env/nand.c                                   |  2 +-
 env/nowhere.c                                |  2 +-
 env/nvram.c                                  |  2 +-
 env/onenand.c                                |  2 +-
 env/remote.c                                 |  2 +-
 env/sata.c                                   |  2 +-
 env/sf.c                                     |  2 +-
 env/ubi.c                                    |  2 +-
 include/common.h                             |  2 +-
 include/{environment.h => env_internal.h}    | 14 +++++++++++---
 lib/efi_loader/efi_variable.c                |  2 +-
 net/net.c                                    |  2 +-
 tools/envcrc.c                               |  2 +-
 74 files changed, 84 insertions(+), 76 deletions(-)
 rename include/{environment.h => env_internal.h} (93%)

diff --git a/api/api.c b/api/api.c
index cd7487fde2..bc9454eb4b 100644
--- a/api/api.c
+++ b/api/api.c
@@ -10,7 +10,7 @@
 #include <common.h>
 #include <env.h>
 #include <malloc.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <linux/types.h>
 #include <api_public.h>
 
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
index 9577ada113..26f4fdacdb 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
@@ -33,7 +33,7 @@
 #include <fsl_qbman.h>
 
 #ifdef CONFIG_TFABOOT
-#include <environment.h>
+#include <env_internal.h>
 #ifdef CONFIG_CHAIN_OF_TRUST
 #include <fsl_validate.h>
 #endif
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/soc.c b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
index 00c705f74e..ca8005992a 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/soc.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
@@ -27,7 +27,7 @@
 #endif
 #include <fsl_immap.h>
 #ifdef CONFIG_TFABOOT
-#include <environment.h>
+#include <env_internal.h>
 DECLARE_GLOBAL_DATA_PTR;
 #endif
 
diff --git a/arch/x86/cpu/qemu/e820.c b/arch/x86/cpu/qemu/e820.c
index 7b3bc7db5e..e682486547 100644
--- a/arch/x86/cpu/qemu/e820.c
+++ b/arch/x86/cpu/qemu/e820.c
@@ -4,7 +4,7 @@
  */
 
 #include <common.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <asm/e820.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/Arcturus/ucp1020/spl.c b/board/Arcturus/ucp1020/spl.c
index f3b7d99878..9314fabdf2 100644
--- a/board/Arcturus/ucp1020/spl.c
+++ b/board/Arcturus/ucp1020/spl.c
@@ -10,7 +10,7 @@
 #include <common.h>
 #include <console.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <ns16550.h>
 #include <malloc.h>
 #include <mmc.h>
diff --git a/board/amlogic/w400/w400.c b/board/amlogic/w400/w400.c
index 4737865367..e60dc3a622 100644
--- a/board/amlogic/w400/w400.c
+++ b/board/amlogic/w400/w400.c
@@ -6,7 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <asm/io.h>
 #include <asm/arch/eth.h>
 
diff --git a/board/birdland/bav335x/board.c b/board/birdland/bav335x/board.c
index 9e64cbbc82..8811583ac6 100644
--- a/board/birdland/bav335x/board.c
+++ b/board/birdland/bav335x/board.c
@@ -28,7 +28,7 @@
 #include <cpsw.h>
 #include <power/tps65217.h>
 #include <power/tps65910.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <watchdog.h>
 #include "board.h"
 
diff --git a/board/bosch/guardian/board.c b/board/bosch/guardian/board.c
index bc3c6d229c..ec0c4a17f6 100644
--- a/board/bosch/guardian/board.c
+++ b/board/bosch/guardian/board.c
@@ -11,7 +11,7 @@
 #include <common.h>
 #include <cpsw.h>
 #include <dm.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <errno.h>
 #include <i2c.h>
 #include <miiphy.h>
diff --git a/board/bosch/shc/board.c b/board/bosch/shc/board.c
index 358118f757..a96fdef992 100644
--- a/board/bosch/shc/board.c
+++ b/board/bosch/shc/board.c
@@ -31,7 +31,7 @@
 #include <miiphy.h>
 #include <cpsw.h>
 #include <power/tps65217.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <watchdog.h>
 #include "mmc.h"
 #include "board.h"
diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c
index b2ccb83c8a..95d3a5e1f5 100644
--- a/board/buffalo/lsxl/lsxl.c
+++ b/board/buffalo/lsxl/lsxl.c
@@ -9,7 +9,7 @@
 
 #include <common.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <net.h>
 #include <malloc.h>
 #include <netdev.h>
diff --git a/board/freescale/b4860qds/spl.c b/board/freescale/b4860qds/spl.c
index d9aa57f41c..6dfc0c73ec 100644
--- a/board/freescale/b4860qds/spl.c
+++ b/board/freescale/b4860qds/spl.c
@@ -5,7 +5,7 @@
 #include <common.h>
 #include <console.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <asm/spl.h>
 #include <malloc.h>
 #include <ns16550.h>
diff --git a/board/freescale/c29xpcie/spl.c b/board/freescale/c29xpcie/spl.c
index 5db60d8ed9..29040962cf 100644
--- a/board/freescale/c29xpcie/spl.c
+++ b/board/freescale/c29xpcie/spl.c
@@ -4,7 +4,7 @@
 
 #include <common.h>
 #include <console.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <ns16550.h>
 #include <malloc.h>
 #include <mmc.h>
diff --git a/board/freescale/ls1012afrdm/ls1012afrdm.c b/board/freescale/ls1012afrdm/ls1012afrdm.c
index b4c611e19f..31e41ce169 100644
--- a/board/freescale/ls1012afrdm/ls1012afrdm.c
+++ b/board/freescale/ls1012afrdm/ls1012afrdm.c
@@ -15,7 +15,7 @@
 #include <asm/arch/soc.h>
 #include <fsl_esdhc.h>
 #include <hwconfig.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <fsl_mmdc.h>
 #include <netdev.h>
 #include <fsl_sec.h>
diff --git a/board/freescale/ls1012aqds/ls1012aqds.c b/board/freescale/ls1012aqds/ls1012aqds.c
index a862fe6a93..86c72ee357 100644
--- a/board/freescale/ls1012aqds/ls1012aqds.c
+++ b/board/freescale/ls1012aqds/ls1012aqds.c
@@ -18,7 +18,7 @@
 #include <ahci.h>
 #include <hwconfig.h>
 #include <mmc.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <scsi.h>
 #include <fm_eth.h>
 #include <fsl_esdhc.h>
diff --git a/board/freescale/ls1012ardb/ls1012ardb.c b/board/freescale/ls1012ardb/ls1012ardb.c
index f648a9040b..e4527c19b8 100644
--- a/board/freescale/ls1012ardb/ls1012ardb.c
+++ b/board/freescale/ls1012ardb/ls1012ardb.c
@@ -18,7 +18,7 @@
 #include <mmc.h>
 #include <scsi.h>
 #include <fsl_esdhc.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <fsl_mmdc.h>
 #include <netdev.h>
 #include <fsl_sec.h>
diff --git a/board/freescale/ls1028a/ls1028a.c b/board/freescale/ls1028a/ls1028a.c
index e5de4eb70c..4aa7cec9ce 100644
--- a/board/freescale/ls1028a/ls1028a.c
+++ b/board/freescale/ls1028a/ls1028a.c
@@ -11,7 +11,7 @@
 #include <hwconfig.h>
 #include <fdt_support.h>
 #include <linux/libfdt.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <asm/arch-fsl-layerscape/soc.h>
 #include <i2c.h>
 #include <asm/arch/soc.h>
diff --git a/board/freescale/ls1088a/ls1088a.c b/board/freescale/ls1088a/ls1088a.c
index a1c9eb3f46..f0bea7327d 100644
--- a/board/freescale/ls1088a/ls1088a.c
+++ b/board/freescale/ls1088a/ls1088a.c
@@ -15,7 +15,7 @@
 #include <fdt_support.h>
 #include <linux/libfdt.h>
 #include <fsl-mc/fsl_mc.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <asm/arch-fsl-layerscape/soc.h>
 #include <asm/arch/ppa.h>
 #include <hwconfig.h>
diff --git a/board/freescale/ls2080a/ls2080a.c b/board/freescale/ls2080a/ls2080a.c
index cc1822d0f5..413a698511 100644
--- a/board/freescale/ls2080a/ls2080a.c
+++ b/board/freescale/ls2080a/ls2080a.c
@@ -12,7 +12,7 @@
 #include <fdt_support.h>
 #include <linux/libfdt.h>
 #include <fsl-mc/fsl_mc.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <asm/arch/soc.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/freescale/ls2080aqds/ls2080aqds.c b/board/freescale/ls2080aqds/ls2080aqds.c
index e9e0999a18..e9c055745f 100644
--- a/board/freescale/ls2080aqds/ls2080aqds.c
+++ b/board/freescale/ls2080aqds/ls2080aqds.c
@@ -13,7 +13,7 @@
 #include <fdt_support.h>
 #include <linux/libfdt.h>
 #include <fsl-mc/fsl_mc.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <i2c.h>
 #include <rtc.h>
 #include <asm/arch/soc.h>
diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c
index a278e2fc11..2b2dbbb0ce 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -15,7 +15,7 @@
 #include <fdt_support.h>
 #include <linux/libfdt.h>
 #include <fsl-mc/fsl_mc.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <efi_loader.h>
 #include <i2c.h>
 #include <asm/arch/mmu.h>
diff --git a/board/freescale/lx2160a/lx2160a.c b/board/freescale/lx2160a/lx2160a.c
index 3b4cb86692..f3885fa8b7 100644
--- a/board/freescale/lx2160a/lx2160a.c
+++ b/board/freescale/lx2160a/lx2160a.c
@@ -16,7 +16,7 @@
 #include <fdt_support.h>
 #include <linux/libfdt.h>
 #include <fsl-mc/fsl_mc.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <efi_loader.h>
 #include <asm/arch/mmu.h>
 #include <hwconfig.h>
diff --git a/board/freescale/p1010rdb/spl.c b/board/freescale/p1010rdb/spl.c
index 95f8b5837d..8f050b3947 100644
--- a/board/freescale/p1010rdb/spl.c
+++ b/board/freescale/p1010rdb/spl.c
@@ -5,7 +5,7 @@
 #include <common.h>
 #include <console.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <ns16550.h>
 #include <malloc.h>
 #include <mmc.h>
diff --git a/board/freescale/p1022ds/spl.c b/board/freescale/p1022ds/spl.c
index 92fd199876..06273f1d20 100644
--- a/board/freescale/p1022ds/spl.c
+++ b/board/freescale/p1022ds/spl.c
@@ -6,7 +6,7 @@
 #include <common.h>
 #include <console.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <ns16550.h>
 #include <malloc.h>
 #include <mmc.h>
diff --git a/board/freescale/p1_p2_rdb_pc/spl.c b/board/freescale/p1_p2_rdb_pc/spl.c
index 9d7b5eff6f..dbf9f739b2 100644
--- a/board/freescale/p1_p2_rdb_pc/spl.c
+++ b/board/freescale/p1_p2_rdb_pc/spl.c
@@ -6,7 +6,7 @@
 #include <common.h>
 #include <console.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <ns16550.h>
 #include <malloc.h>
 #include <mmc.h>
diff --git a/board/freescale/t102xqds/spl.c b/board/freescale/t102xqds/spl.c
index 1b58174ed1..3008f0919f 100644
--- a/board/freescale/t102xqds/spl.c
+++ b/board/freescale/t102xqds/spl.c
@@ -4,7 +4,7 @@
 
 #include <common.h>
 #include <console.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <malloc.h>
 #include <ns16550.h>
 #include <nand.h>
diff --git a/board/freescale/t102xrdb/spl.c b/board/freescale/t102xrdb/spl.c
index a226d4b5b5..029e3d212c 100644
--- a/board/freescale/t102xrdb/spl.c
+++ b/board/freescale/t102xrdb/spl.c
@@ -4,7 +4,7 @@
 
 #include <common.h>
 #include <console.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <malloc.h>
 #include <ns16550.h>
 #include <nand.h>
diff --git a/board/freescale/t104xrdb/spl.c b/board/freescale/t104xrdb/spl.c
index 58a7376e7f..7b0eb8edf5 100644
--- a/board/freescale/t104xrdb/spl.c
+++ b/board/freescale/t104xrdb/spl.c
@@ -4,7 +4,7 @@
 
 #include <common.h>
 #include <console.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <malloc.h>
 #include <ns16550.h>
 #include <nand.h>
diff --git a/board/freescale/t208xqds/spl.c b/board/freescale/t208xqds/spl.c
index 27f3c4c84f..9695dfc2e2 100644
--- a/board/freescale/t208xqds/spl.c
+++ b/board/freescale/t208xqds/spl.c
@@ -4,7 +4,7 @@
 
 #include <common.h>
 #include <console.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <malloc.h>
 #include <ns16550.h>
 #include <nand.h>
diff --git a/board/freescale/t208xrdb/spl.c b/board/freescale/t208xrdb/spl.c
index ecb1e0d73c..ca7d6a28e0 100644
--- a/board/freescale/t208xrdb/spl.c
+++ b/board/freescale/t208xrdb/spl.c
@@ -4,7 +4,7 @@
 
 #include <common.h>
 #include <console.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <malloc.h>
 #include <ns16550.h>
 #include <nand.h>
diff --git a/board/freescale/t4qds/spl.c b/board/freescale/t4qds/spl.c
index 16cc29eaa6..7666fe7556 100644
--- a/board/freescale/t4qds/spl.c
+++ b/board/freescale/t4qds/spl.c
@@ -4,7 +4,7 @@
 
 #include <common.h>
 #include <console.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <asm/spl.h>
 #include <malloc.h>
 #include <ns16550.h>
diff --git a/board/freescale/t4rdb/spl.c b/board/freescale/t4rdb/spl.c
index cc2b2f9ffb..a19558bd6b 100644
--- a/board/freescale/t4rdb/spl.c
+++ b/board/freescale/t4rdb/spl.c
@@ -7,7 +7,7 @@
 
 #include <common.h>
 #include <console.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <asm/spl.h>
 #include <malloc.h>
 #include <ns16550.h>
diff --git a/board/gardena/smart-gateway-mt7688/board.c b/board/gardena/smart-gateway-mt7688/board.c
index baa3e5726c..bd494c84fc 100644
--- a/board/gardena/smart-gateway-mt7688/board.c
+++ b/board/gardena/smart-gateway-mt7688/board.c
@@ -5,7 +5,7 @@
 
 #include <common.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <led.h>
 #include <net.h>
 #include <spi.h>
diff --git a/board/phytec/phycore_rk3288/phycore-rk3288.c b/board/phytec/phycore_rk3288/phycore-rk3288.c
index 7b9178e3a6..5fcbf65b7c 100644
--- a/board/phytec/phycore_rk3288/phycore-rk3288.c
+++ b/board/phytec/phycore_rk3288/phycore-rk3288.c
@@ -8,7 +8,7 @@
 #include <common.h>
 #include <dm.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <i2c.h>
 #include <i2c_eeprom.h>
 #include <netdev.h>
diff --git a/board/renesas/alt/alt.c b/board/renesas/alt/alt.c
index 77979704be..10ef7f931b 100644
--- a/board/renesas/alt/alt.c
+++ b/board/renesas/alt/alt.c
@@ -10,7 +10,7 @@
 #include <malloc.h>
 #include <dm.h>
 #include <dm/platform_data/serial_sh.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
diff --git a/board/renesas/gose/gose.c b/board/renesas/gose/gose.c
index bffa85c232..f86c9f1a63 100644
--- a/board/renesas/gose/gose.c
+++ b/board/renesas/gose/gose.c
@@ -10,7 +10,7 @@
 #include <malloc.h>
 #include <dm.h>
 #include <dm/platform_data/serial_sh.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
diff --git a/board/renesas/koelsch/koelsch.c b/board/renesas/koelsch/koelsch.c
index 1bb3b492e2..841d337f4d 100644
--- a/board/renesas/koelsch/koelsch.c
+++ b/board/renesas/koelsch/koelsch.c
@@ -11,7 +11,7 @@
 #include <malloc.h>
 #include <dm.h>
 #include <dm/platform_data/serial_sh.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
diff --git a/board/renesas/lager/lager.c b/board/renesas/lager/lager.c
index bda3295bad..3cb1a56142 100644
--- a/board/renesas/lager/lager.c
+++ b/board/renesas/lager/lager.c
@@ -9,7 +9,7 @@
 
 #include <common.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <malloc.h>
 #include <netdev.h>
 #include <dm.h>
diff --git a/board/renesas/porter/porter.c b/board/renesas/porter/porter.c
index d3afc2a400..86f79da7fd 100644
--- a/board/renesas/porter/porter.c
+++ b/board/renesas/porter/porter.c
@@ -11,7 +11,7 @@
 #include <malloc.h>
 #include <dm.h>
 #include <dm/platform_data/serial_sh.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
diff --git a/board/renesas/silk/silk.c b/board/renesas/silk/silk.c
index bda6a414e6..25221e3c55 100644
--- a/board/renesas/silk/silk.c
+++ b/board/renesas/silk/silk.c
@@ -11,7 +11,7 @@
 #include <malloc.h>
 #include <dm.h>
 #include <dm/platform_data/serial_sh.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
diff --git a/board/renesas/stout/stout.c b/board/renesas/stout/stout.c
index 95b5711fdb..0a0ff5ff76 100644
--- a/board/renesas/stout/stout.c
+++ b/board/renesas/stout/stout.c
@@ -14,7 +14,7 @@
 #include <netdev.h>
 #include <dm.h>
 #include <dm/platform_data/serial_sh.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 1f9251d7a0..279c7b7797 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -9,7 +9,7 @@
 #include <clk.h>
 #include <dm.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <g_dnl.h>
 #include <generic-phy.h>
 #include <i2c.h>
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index bb425cbf66..e3b2d13892 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -30,7 +30,7 @@
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <u-boot/crc.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <linux/libfdt.h>
 #include <nand.h>
 #include <net.h>
diff --git a/board/tcl/sl50/board.c b/board/tcl/sl50/board.c
index a9c9d377b4..c7eed31946 100644
--- a/board/tcl/sl50/board.c
+++ b/board/tcl/sl50/board.c
@@ -28,7 +28,7 @@
 #include <cpsw.h>
 #include <power/tps65217.h>
 #include <power/tps65910.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <watchdog.h>
 #include "board.h"
 
diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index 54adcd510d..7eaa6cd96d 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -34,7 +34,7 @@
 #include <cpsw.h>
 #include <power/tps65217.h>
 #include <power/tps65910.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <watchdog.h>
 #include "../common/board_detect.h"
 #include "board.h"
diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index 8e8572235c..1cb0bc1460 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -28,7 +28,7 @@
 #include <command.h>
 #include <console.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <search.h>
 #include <errno.h>
 #include <malloc.h>
diff --git a/common/board_f.c b/common/board_f.c
index 18937bf6f5..31181a9dc4 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -15,7 +15,7 @@
 #include <cpu.h>
 #include <dm.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <fdtdec.h>
 #include <fs.h>
 #include <i2c.h>
diff --git a/common/board_r.c b/common/board_r.c
index f4193cdbec..1dabf5a11c 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -19,7 +19,7 @@
 #include <console.h>
 #include <dm.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <fdtdec.h>
 #include <ide.h>
 #include <initcall.h>
diff --git a/common/console.c b/common/console.c
index 4c5f7d8f1f..f474388f37 100644
--- a/common/console.c
+++ b/common/console.c
@@ -17,7 +17,7 @@
 #include <serial.h>
 #include <stdio_dev.h>
 #include <exports.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <watchdog.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 6c22f074b0..c59254c76e 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -26,7 +26,7 @@
 #include <asm/io.h>
 #include <asm/byteorder.h>
 #include <asm/unaligned.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <mtd/cfi_flash.h>
 #include <watchdog.h>
 
diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index d4488a2cc2..dcdaedefe7 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -5,7 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <errno.h>
 #include <os.h>
 #include <serial.h>
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index 09365ba6a1..b907508dbe 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -5,7 +5,7 @@
  */
 
 #include <common.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <serial.h>
 #include <stdio_dev.h>
 #include <post.h>
diff --git a/env/callback.c b/env/callback.c
index d5469ce3c2..f0904cfdc5 100644
--- a/env/callback.c
+++ b/env/callback.c
@@ -6,7 +6,7 @@
 
 #include <common.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 
 #if defined(CONFIG_NEEDS_MANUAL_RELOC)
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/env/common.c b/env/common.c
index 474ea2280b..3fb60509dd 100644
--- a/env/common.c
+++ b/env/common.c
@@ -10,7 +10,7 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <linux/stddef.h>
 #include <search.h>
 #include <errno.h>
diff --git a/env/eeprom.c b/env/eeprom.c
index 91ee3f35eb..cb04d2ac88 100644
--- a/env/eeprom.c
+++ b/env/eeprom.c
@@ -10,7 +10,7 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <linux/stddef.h>
 #if defined(CONFIG_I2C_ENV_EEPROM_BUS)
 #include <i2c.h>
diff --git a/env/embedded.c b/env/embedded.c
index b1090e90e5..a38e169fe0 100644
--- a/env/embedded.c
+++ b/env/embedded.c
@@ -12,7 +12,7 @@
 #define	__ASM_STUB_PROCESSOR_H__	/* don't include asm/processor. */
 #include <config.h>
 #undef	__ASSEMBLY__
-#include <environment.h>
+#include <env_internal.h>
 #include <linux/stringify.h>
 
 /* Handle HOSTS that have prepended crap on symbol names, not TARGETS. */
diff --git a/env/env.c b/env/env.c
index 9d421e8125..9237bb9c74 100644
--- a/env/env.c
+++ b/env/env.c
@@ -6,7 +6,7 @@
 
 #include <common.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/env/ext4.c b/env/ext4.c
index 6aa36867b6..1f6b1b5bd8 100644
--- a/env/ext4.c
+++ b/env/ext4.c
@@ -22,7 +22,7 @@
 
 #include <command.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <linux/stddef.h>
 #include <malloc.h>
 #include <memalign.h>
diff --git a/env/fat.c b/env/fat.c
index d23753c6ff..1836556f36 100644
--- a/env/fat.c
+++ b/env/fat.c
@@ -10,7 +10,7 @@
 
 #include <command.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <linux/stddef.h>
 #include <malloc.h>
 #include <memalign.h>
diff --git a/env/flags.c b/env/flags.c
index 93d337a1aa..418d6cc742 100644
--- a/env/flags.c
+++ b/env/flags.c
@@ -19,7 +19,7 @@
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 #else
 #include <common.h>
-#include <environment.h>
+#include <env_internal.h>
 #endif
 
 #ifdef CONFIG_CMD_NET
diff --git a/env/flash.c b/env/flash.c
index bdba09e306..231a5fdf24 100644
--- a/env/flash.c
+++ b/env/flash.c
@@ -12,7 +12,7 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <linux/stddef.h>
 #include <malloc.h>
 #include <search.h>
diff --git a/env/mmc.c b/env/mmc.c
index 4ca7c2b9ff..9f1878def1 100644
--- a/env/mmc.c
+++ b/env/mmc.c
@@ -9,7 +9,7 @@
 
 #include <command.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <fdtdec.h>
 #include <linux/stddef.h>
 #include <malloc.h>
diff --git a/env/nand.c b/env/nand.c
index 3e2235f5f3..9f3dc635cf 100644
--- a/env/nand.c
+++ b/env/nand.c
@@ -16,7 +16,7 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <linux/stddef.h>
 #include <malloc.h>
 #include <memalign.h>
diff --git a/env/nowhere.c b/env/nowhere.c
index 7db4eec845..f5b0a17652 100644
--- a/env/nowhere.c
+++ b/env/nowhere.c
@@ -10,7 +10,7 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <linux/stddef.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/env/nvram.c b/env/nvram.c
index a5b1873aaf..79201bd788 100644
--- a/env/nvram.c
+++ b/env/nvram.c
@@ -26,7 +26,7 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <linux/stddef.h>
 #include <search.h>
 #include <errno.h>
diff --git a/env/onenand.c b/env/onenand.c
index d371bd757c..dfd4e939f8 100644
--- a/env/onenand.c
+++ b/env/onenand.c
@@ -9,7 +9,7 @@
 
 #include <common.h>
 #include <command.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <linux/stddef.h>
 #include <malloc.h>
 #include <search.h>
diff --git a/env/remote.c b/env/remote.c
index b1a7d1a4c1..02531f427b 100644
--- a/env/remote.c
+++ b/env/remote.c
@@ -7,7 +7,7 @@
 
 #include <common.h>
 #include <command.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <linux/stddef.h>
 
 #ifdef ENV_IS_EMBEDDED
diff --git a/env/sata.c b/env/sata.c
index a5364dda5d..9369710081 100644
--- a/env/sata.c
+++ b/env/sata.c
@@ -9,7 +9,7 @@
 
 #include <command.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <linux/stddef.h>
 #include <errno.h>
 #include <memalign.h>
diff --git a/env/sf.c b/env/sf.c
index 09646e1eed..590d0cedd8 100644
--- a/env/sf.c
+++ b/env/sf.c
@@ -11,7 +11,7 @@
 #include <common.h>
 #include <dm.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <malloc.h>
 #include <spi.h>
 #include <spi_flash.h>
diff --git a/env/ubi.c b/env/ubi.c
index a69db14afd..08aac47df2 100644
--- a/env/ubi.c
+++ b/env/ubi.c
@@ -8,7 +8,7 @@
 
 #include <command.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <errno.h>
 #include <malloc.h>
 #include <memalign.h>
diff --git a/include/common.h b/include/common.h
index 34ae514805..f8afbc0d70 100644
--- a/include/common.h
+++ b/include/common.h
@@ -394,7 +394,7 @@ int cpu_release(u32 nr, int argc, char * const argv[]);
 
 /* Pull in stuff for the build system */
 #ifdef DO_DEPS_ONLY
-# include <environment.h>
+# include <env_internal.h>
 #endif
 
 #endif	/* __COMMON_H_ */
diff --git a/include/environment.h b/include/env_internal.h
similarity index 93%
rename from include/environment.h
rename to include/env_internal.h
index cc8c0546c2..b1ddcb5adf 100644
--- a/include/environment.h
+++ b/include/env_internal.h
@@ -1,11 +1,19 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
+ * Internal environment header file. This includes direct access to environment
+ * information such as its size and offset, direct access to the default
+ * environment and embedded environment (if used). It also provides environment
+ * drivers with various declarations.
+ *
+ * It should not be included by board files, drivers and code other than that
+ * related to the environment implementation.
+ *
  * (C) Copyright 2002
  * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
  */
 
-#ifndef _ENVIRONMENT_H_
-#define _ENVIRONMENT_H_
+#ifndef _ENV_INTERNAL_H_
+#define _ENV_INTERNAL_H_
 
 #include <linux/kconfig.h>
 
@@ -267,4 +275,4 @@ extern struct hsearch_data env_htab;
 
 #endif /* DO_DEPS_ONLY */
 
-#endif /* _ENVIRONMENT_H_ */
+#endif /* _ENV_INTERNAL_H_ */
diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
index 8a0e0db13e..6687b69a40 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -10,7 +10,7 @@
 #include <charset.h>
 #include <efi_loader.h>
 #include <hexdump.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <search.h>
 #include <uuid.h>
 
diff --git a/net/net.c b/net/net.c
index f0a3996cd6..40511db645 100644
--- a/net/net.c
+++ b/net/net.c
@@ -91,7 +91,7 @@
 #include <command.h>
 #include <console.h>
 #include <env.h>
-#include <environment.h>
+#include <env_internal.h>
 #include <errno.h>
 #include <net.h>
 #include <net/fastboot.h>
diff --git a/tools/envcrc.c b/tools/envcrc.c
index 7eb7246d45..672ef4d675 100644
--- a/tools/envcrc.c
+++ b/tools/envcrc.c
@@ -59,7 +59,7 @@
 
 
 #ifdef CONFIG_BUILD_ENVCRC
-# include <environment.h>
+# include <env_internal.h>
 extern unsigned int env_size;
 extern env_t embedded_environment;
 #endif	/* CONFIG_BUILD_ENVCRC */
-- 
2.22.0.770.g0f2c4a37fd-goog

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 40/40] common: Add a note about the effort to reduce common.h
  2019-08-02 15:43 [U-Boot] [PATCH v3 00/40] env: common: Remove environment definitions from common.h Simon Glass
                   ` (2 preceding siblings ...)
  2019-08-02 15:44 ` [U-Boot] [PATCH v3 38/40] env: Rename environment.h to env_internal.h Simon Glass
@ 2019-08-02 15:44 ` Simon Glass
  2019-08-13 16:56   ` Tom Rini
  2019-08-02 16:55 ` [U-Boot] [PATCH v3 00/40] env: common: Remove environment definitions from common.h Joe Hershberger
  4 siblings, 1 reply; 12+ messages in thread
From: Simon Glass @ 2019-08-02 15:44 UTC (permalink / raw)
  To: u-boot

This file has quite a lot of general definitions and include files. Add a
note about our intent to remove more of this.

The file should ultimately include the configuration and perhaps a very
other very common things used by most U-Boot files.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v3:
- Rebase to master

Changes in v2:
- Rebase to master

 include/common.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/common.h b/include/common.h
index 2645ac9615..d8f302ea92 100644
--- a/include/common.h
+++ b/include/common.h
@@ -1,5 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
+ * Common header file for U-Boot
+ *
+ * This file still includes quite a bit of stuff that should be in separate
+ * headers like command.h, cpu.h and timer.h. Please think before adding more
+ * things. Patches to remove things are welcome.
+ *
  * (C) Copyright 2000-2009
  * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
  */
-- 
2.22.0.770.g0f2c4a37fd-goog

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 00/40] env: common: Remove environment definitions from common.h
  2019-08-02 15:43 [U-Boot] [PATCH v3 00/40] env: common: Remove environment definitions from common.h Simon Glass
                   ` (3 preceding siblings ...)
  2019-08-02 15:44 ` [U-Boot] [PATCH v3 40/40] common: Add a note about the effort to reduce common.h Simon Glass
@ 2019-08-02 16:55 ` Joe Hershberger
  2019-08-02 17:45   ` Simon Glass
  4 siblings, 1 reply; 12+ messages in thread
From: Joe Hershberger @ 2019-08-02 16:55 UTC (permalink / raw)
  To: u-boot

On Fri, Aug 2, 2019 at 10:44 AM Simon Glass <sjg@chromium.org> wrote:
>
> At present common.h has a lot of uncommon declarations in it. Many of
> these would be better placed elsewhere, in header files more related to
> their purpose. In particular the environnment functions should move to
> the environment headers. This should reduce the overall amount of code
> compiled and the length of time taken to build U-Boot.
>
> This series splits the current environment.h file into:
>
>    env.h           common definitions widely used in U-Boot; and
>    env_internal.h  features internal to the environment drivers, etc.
>
> Most files can then include just env.h which is fairly small and does not
> have any CONFIG magic.
>
> At the same time some dead code was noticed in common.h so this series
> removes some of this.
>
> After this series common.h is down to about 400 lines. For reference it
> was about 1000 lines up until 3 years ago.
>
> Changes in v3:
> - Move removal of _ENTRY to next patch
> - Move removal of _ENTRY to _'Drop ENTRY' patch
> - Update w400.c as well
> - Rebase to master
>
> Changes in v2:
> - Update to add header to image.c instead of bootm.c
> - Add new patch to move eth_parse_enetaddr() to net.c/h
> - Adjust patch to leave eth_parse_enetaddr() alone
> - Fix typdef typo
> - Rename ENVF_... flags to ENV_...
> - Fix 'too' typo in commit message
> - Rename ENVA_... to ENV_...
> - Rebase to master
>
> Simon Glass (40):
>   common: Move gzip functions into a new gzip header
>   common: Drop the dpram_... functions
>   common: Move lcd_setmem() to lcd.h
>   common: Remove video_setmem()
>   env: Create a new file for environment functions
>   env: Move get_env_id() to env.h
>   env: Move env_get_f() to env.h
>   env: Move env_init() to env.h
>   env: Move env_relocate() to env.h
>   env: Move envmatch() to env.h
>   env: Move env_set_hex() to env.h
>   env: Move env_set_ulong() to env.h
>   env: Move env_get_ulong() to env.h
>   env: Move env_get_yesno() to env.h
>   env: Move env_get_hex() to env.h
>   env: Move env_set() to env.h
>   env: Move env_get() to env.h
>   env: Move eth_env_get/set_enetaddr() to env.h
>   env: net: Move eth_parse_enetaddr() to net.c/h
>   env: Move env_fix_drivers() to env.h
>   env: Move set_default_vars to env.h
>   env: Move env_load/save functions to env.h
>   env: Move env import/export functions to env.h
>   env: Drop env_crc_update()
>   env: Move get/set_default_env() to env.h
>   env: Move env_get_char() to env.h
>   env: Move env_reloc() to env.h
>   env: Rename environment to embedded_environment
>   env: Move env_valid to env.h
>   env: Move callback definitions to env.h
>   env: Drop the ENTRY typedef
>   env: Drop _ENTRY
>   env: Rename the redundancy flags
>   env: Drop the ACTION typedef
>   env: Drop the double underscores in search.h
>   env: Move TOTAL_MALLOC_LEN to environment.h
>   env: Drop environment.h header file where not needed
>   env: Rename environment.h to env_internal.h
>   Drop PCMCIA
>   common: Add a note about the effort to reduce common.h

This series is good to go. Thanks for all the cleanup and excellent
patch craftsmanship!

Cheers,
-Joe

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 32/40] env: Drop _ENTRY
  2019-08-02 15:44 ` [U-Boot] [PATCH v3 32/40] env: Drop _ENTRY Simon Glass
@ 2019-08-02 17:00   ` Joe Hershberger
  2019-08-13 16:56   ` Tom Rini
  1 sibling, 0 replies; 12+ messages in thread
From: Joe Hershberger @ 2019-08-02 17:00 UTC (permalink / raw)
  To: u-boot

On Fri, Aug 2, 2019 at 10:46 AM Simon Glass <sjg@chromium.org> wrote:
>
> This typedef does not need to be defined in the search.h header since it
> is only used in one file (hashtable.c). Remove it from the header and
> change it to a struct.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>

Acked-by :Joe Hershberger <joe.hershberger@ni.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 00/40] env: common: Remove environment definitions from common.h
  2019-08-02 16:55 ` [U-Boot] [PATCH v3 00/40] env: common: Remove environment definitions from common.h Joe Hershberger
@ 2019-08-02 17:45   ` Simon Glass
  0 siblings, 0 replies; 12+ messages in thread
From: Simon Glass @ 2019-08-02 17:45 UTC (permalink / raw)
  To: u-boot

On Fri, 2 Aug 2019 at 10:55, Joe Hershberger <joe.hershberger@ni.com> wrote:
>
> On Fri, Aug 2, 2019 at 10:44 AM Simon Glass <sjg@chromium.org> wrote:
> >
> > At present common.h has a lot of uncommon declarations in it. Many of
> > these would be better placed elsewhere, in header files more related to
> > their purpose. In particular the environnment functions should move to
> > the environment headers. This should reduce the overall amount of code
> > compiled and the length of time taken to build U-Boot.
> >
> > This series splits the current environment.h file into:
> >
> >    env.h           common definitions widely used in U-Boot; and
> >    env_internal.h  features internal to the environment drivers, etc.
> >
> > Most files can then include just env.h which is fairly small and does not
> > have any CONFIG magic.
> >
> > At the same time some dead code was noticed in common.h so this series
> > removes some of this.
> >
> > After this series common.h is down to about 400 lines. For reference it
> > was about 1000 lines up until 3 years ago.
> >
> > Changes in v3:
> > - Move removal of _ENTRY to next patch
> > - Move removal of _ENTRY to _'Drop ENTRY' patch
> > - Update w400.c as well
> > - Rebase to master
> >
> > Changes in v2:
> > - Update to add header to image.c instead of bootm.c
> > - Add new patch to move eth_parse_enetaddr() to net.c/h
> > - Adjust patch to leave eth_parse_enetaddr() alone
> > - Fix typdef typo
> > - Rename ENVF_... flags to ENV_...
> > - Fix 'too' typo in commit message
> > - Rename ENVA_... to ENV_...
> > - Rebase to master
> >
> > Simon Glass (40):
> >   common: Move gzip functions into a new gzip header
> >   common: Drop the dpram_... functions
> >   common: Move lcd_setmem() to lcd.h
> >   common: Remove video_setmem()
> >   env: Create a new file for environment functions
> >   env: Move get_env_id() to env.h
> >   env: Move env_get_f() to env.h
> >   env: Move env_init() to env.h
> >   env: Move env_relocate() to env.h
> >   env: Move envmatch() to env.h
> >   env: Move env_set_hex() to env.h
> >   env: Move env_set_ulong() to env.h
> >   env: Move env_get_ulong() to env.h
> >   env: Move env_get_yesno() to env.h
> >   env: Move env_get_hex() to env.h
> >   env: Move env_set() to env.h
> >   env: Move env_get() to env.h
> >   env: Move eth_env_get/set_enetaddr() to env.h
> >   env: net: Move eth_parse_enetaddr() to net.c/h
> >   env: Move env_fix_drivers() to env.h
> >   env: Move set_default_vars to env.h
> >   env: Move env_load/save functions to env.h
> >   env: Move env import/export functions to env.h
> >   env: Drop env_crc_update()
> >   env: Move get/set_default_env() to env.h
> >   env: Move env_get_char() to env.h
> >   env: Move env_reloc() to env.h
> >   env: Rename environment to embedded_environment
> >   env: Move env_valid to env.h
> >   env: Move callback definitions to env.h
> >   env: Drop the ENTRY typedef
> >   env: Drop _ENTRY
> >   env: Rename the redundancy flags
> >   env: Drop the ACTION typedef
> >   env: Drop the double underscores in search.h
> >   env: Move TOTAL_MALLOC_LEN to environment.h
> >   env: Drop environment.h header file where not needed
> >   env: Rename environment.h to env_internal.h
> >   Drop PCMCIA
> >   common: Add a note about the effort to reduce common.h
>
> This series is good to go. Thanks for all the cleanup and excellent
> patch craftsmanship!

Thanks Joe, much appreciated.

It would be good to keep trimming down common.h. I feel a bit guilty
as I've added stuff myself in the past.

- Simon

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 31/40] env: Drop the ENTRY typedef
  2019-08-02 15:44 ` [U-Boot] [PATCH v3 31/40] env: Drop the ENTRY typedef Simon Glass
@ 2019-08-13 16:56   ` Tom Rini
  0 siblings, 0 replies; 12+ messages in thread
From: Tom Rini @ 2019-08-13 16:56 UTC (permalink / raw)
  To: u-boot

On Fri, Aug 02, 2019 at 09:44:18AM -0600, Simon Glass wrote:

> U-Boot is not supposed to use typedef for structs anymore. Also this name
> is the same as the ENTRY() macro used in assembler files, and 'entry'
> itself is widely used in U-Boot (>8k matches).
> 
> Drop the typedef and rename the struct to env_entry to reduce confusion.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Acked-by: Joe Hershberger <joe.hershberger@ni.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190813/4d20da32/attachment.sig>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 32/40] env: Drop _ENTRY
  2019-08-02 15:44 ` [U-Boot] [PATCH v3 32/40] env: Drop _ENTRY Simon Glass
  2019-08-02 17:00   ` Joe Hershberger
@ 2019-08-13 16:56   ` Tom Rini
  1 sibling, 0 replies; 12+ messages in thread
From: Tom Rini @ 2019-08-13 16:56 UTC (permalink / raw)
  To: u-boot

On Fri, Aug 02, 2019 at 09:44:19AM -0600, Simon Glass wrote:

> This typedef does not need to be defined in the search.h header since it
> is only used in one file (hashtable.c). Remove it from the header and
> change it to a struct.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190813/4d9da7c9/attachment.sig>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 40/40] common: Add a note about the effort to reduce common.h
  2019-08-02 15:44 ` [U-Boot] [PATCH v3 40/40] common: Add a note about the effort to reduce common.h Simon Glass
@ 2019-08-13 16:56   ` Tom Rini
  0 siblings, 0 replies; 12+ messages in thread
From: Tom Rini @ 2019-08-13 16:56 UTC (permalink / raw)
  To: u-boot

On Fri, Aug 02, 2019 at 09:44:27AM -0600, Simon Glass wrote:

> This file has quite a lot of general definitions and include files. Add a
> note about our intent to remove more of this.
> 
> The file should ultimately include the configuration and perhaps a very
> other very common things used by most U-Boot files.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190813/e2dc22ce/attachment.sig>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 38/40] env: Rename environment.h to env_internal.h
  2019-08-02 15:44 ` [U-Boot] [PATCH v3 38/40] env: Rename environment.h to env_internal.h Simon Glass
@ 2019-08-13 16:56   ` Tom Rini
  0 siblings, 0 replies; 12+ messages in thread
From: Tom Rini @ 2019-08-13 16:56 UTC (permalink / raw)
  To: u-boot

On Fri, Aug 02, 2019 at 09:44:25AM -0600, Simon Glass wrote:

> This file contains lots of internal details about the environment. Most
> code can include env.h instead, calling the functions there as needed.
> 
> Rename this file and add a comment at the top to indicate its internal
> nature.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190813/eac566da/attachment.sig>

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-08-13 16:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-02 15:43 [U-Boot] [PATCH v3 00/40] env: common: Remove environment definitions from common.h Simon Glass
2019-08-02 15:44 ` [U-Boot] [PATCH v3 31/40] env: Drop the ENTRY typedef Simon Glass
2019-08-13 16:56   ` Tom Rini
2019-08-02 15:44 ` [U-Boot] [PATCH v3 32/40] env: Drop _ENTRY Simon Glass
2019-08-02 17:00   ` Joe Hershberger
2019-08-13 16:56   ` Tom Rini
2019-08-02 15:44 ` [U-Boot] [PATCH v3 38/40] env: Rename environment.h to env_internal.h Simon Glass
2019-08-13 16:56   ` Tom Rini
2019-08-02 15:44 ` [U-Boot] [PATCH v3 40/40] common: Add a note about the effort to reduce common.h Simon Glass
2019-08-13 16:56   ` Tom Rini
2019-08-02 16:55 ` [U-Boot] [PATCH v3 00/40] env: common: Remove environment definitions from common.h Joe Hershberger
2019-08-02 17:45   ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.