[U-Boot] [PATCH/RFC] cmd_tbl_t: constify (and sometimes localize)

Mike Frysinger vapier at gentoo.org
Wed Oct 20 11:21:44 CEST 2010


The command structures need not be writable, so constify them all.  We
also need to constify the functions that refer to these structures.

In the process, many of these functions don't need to be global, so mark
them static.

Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
patch compressed & attached due to size

ive attempted to compile test this for many arches, but many boards
dont even compile without this change at the moment.  for the ones
that do, i'm not seeing any (new) build warnings.  the only aspect
that seems a little shady is the fixup_cmdtable() where i have to
ignore the "const" aspect of this data in order to let the function
process the pointers embedded in the structure.  since ive done no
work on the relocation code, i really have no idea the expectations
here.  is rodata allowed to have pointers to data ?

 arch/arm/cpu/armv7/mx51/clock.c                    |    3 +-
 arch/arm/cpu/armv7/omap3/board.c                   |    3 +-
 arch/arm/lib/reset.c                               |    2 +-
 arch/avr32/cpu/cpu.c                               |    2 +-
 arch/avr32/lib/board.c                             |    1 -
 arch/blackfin/cpu/cmd_gpio.c                       |    3 +-
 arch/blackfin/cpu/reset.c                          |    2 +-
 arch/blackfin/lib/cmd_cache_dump.c                 |    6 +-
 arch/i386/cpu/cpu.c                                |    2 +-
 arch/i386/lib/interrupts.c                         |    2 +-
 arch/i386/lib/zimage.c                             |    3 +-
 arch/m68k/cpu/mcf5227x/cpu.c                       |    2 +-
 arch/m68k/cpu/mcf523x/cpu.c                        |    2 +-
 arch/m68k/cpu/mcf52x2/cpu.c                        |   14 ++--
 arch/m68k/cpu/mcf532x/cpu.c                        |    2 +-
 arch/m68k/cpu/mcf5445x/cpu.c                       |    2 +-
 arch/m68k/cpu/mcf547x_8x/cpu.c                     |    2 +-
 arch/m68k/lib/board.c                              |    1 -
 arch/microblaze/cpu/interrupts.c                   |    4 +-
 arch/mips/cpu/cpu.c                                |    2 +-
 arch/mips/lib/board.c                              |    1 -
 arch/nios2/cpu/cpu.c                               |    2 +-
 arch/nios2/cpu/epcs.c                              |    3 +-
 arch/nios2/cpu/interrupts.c                        |    2 +-
 arch/nios2/cpu/sysid.c                             |    3 +-
 arch/powerpc/cpu/74xx_7xx/cpu.c                    |    2 +-
 arch/powerpc/cpu/74xx_7xx/interrupts.c             |    2 +-
 arch/powerpc/cpu/mpc512x/cpu.c                     |    2 +-
 arch/powerpc/cpu/mpc512x/iim.c                     |    6 +-
 arch/powerpc/cpu/mpc512x/speed.c                   |    3 +-
 arch/powerpc/cpu/mpc5xx/cpu.c                      |    2 +-
 arch/powerpc/cpu/mpc5xx/interrupts.c               |    2 +-
 arch/powerpc/cpu/mpc5xxx/cpu.c                     |    2 +-
 arch/powerpc/cpu/mpc5xxx/interrupts.c              |    2 +-
 arch/powerpc/cpu/mpc8220/cpu.c                     |    2 +-
 arch/powerpc/cpu/mpc8220/interrupts.c              |    2 +-
 arch/powerpc/cpu/mpc824x/cpu.c                     |    2 +-
 arch/powerpc/cpu/mpc8260/bedbug_603e.c             |   22 +++---
 arch/powerpc/cpu/mpc8260/cpu.c                     |    2 +-
 arch/powerpc/cpu/mpc8260/interrupts.c              |    2 +-
 arch/powerpc/cpu/mpc83xx/cpu.c                     |    2 +-
 arch/powerpc/cpu/mpc83xx/ecc.c                     |    3 +-
 arch/powerpc/cpu/mpc83xx/interrupts.c              |    2 +-
 arch/powerpc/cpu/mpc83xx/speed.c                   |    3 +-
 arch/powerpc/cpu/mpc85xx/cmd_errata.c              |    3 +-
 arch/powerpc/cpu/mpc85xx/cpu.c                     |    2 +-
 arch/powerpc/cpu/mpc85xx/interrupts.c              |    2 +-
 arch/powerpc/cpu/mpc86xx/cpu.c                     |    2 +-
 arch/powerpc/cpu/mpc86xx/interrupts.c              |    2 +-
 arch/powerpc/cpu/mpc8xx/bedbug_860.c               |   22 +++---
 arch/powerpc/cpu/mpc8xx/cpu.c                      |    4 +-
 arch/powerpc/cpu/ppc4xx/bedbug_405.c               |    4 +-
 arch/powerpc/cpu/ppc4xx/cmd_chip_config.c          |    3 +-
 arch/powerpc/cpu/ppc4xx/cmd_ecctest.c              |    3 +-
 arch/powerpc/cpu/ppc4xx/cpu.c                      |    2 +-
 arch/powerpc/cpu/ppc4xx/interrupts.c               |    2 +-
 arch/sh/cpu/sh2/cpu.c                              |    2 +-
 arch/sh/cpu/sh3/cpu.c                              |    2 +-
 arch/sh/cpu/sh4/cpu.c                              |    2 +-
 arch/sparc/cpu/leon2/cpu.c                         |    2 +-
 arch/sparc/cpu/leon2/interrupts.c                  |    2 +-
 arch/sparc/cpu/leon3/cpu.c                         |    2 +-
 arch/sparc/cpu/leon3/interrupts.c                  |    2 +-
 arch/sparc/lib/board.c                             |    3 +-
 board/BuS/EB+MCF-EV123/EB+MCF-EV123.c              |    3 +-
 board/BuS/eb_cpux9k2/cpux9k2.c                     |    3 +-
 board/amcc/acadia/cmd_acadia.c                     |    3 +-
 board/amcc/luan/luan.c                             |    3 +-
 board/amcc/makalu/cmd_pll.c                        |    4 +-
 board/amcc/taihu/lcd.c                             |   12 ++-
 board/amcc/taihu/taihu.c                           |    6 +-
 board/amcc/taihu/update.c                          |    3 +-
 board/amcc/taishan/lcd.c                           |   21 ++++--
 board/amcc/taishan/showinfo.c                      |    9 ++-
 board/amcc/taishan/update.c                        |    3 +-
 board/amcc/yucca/cmd_yucca.c                       |    7 +-
 board/amirix/ap1000/ap1000.c                       |   15 +++--
 board/amirix/ap1000/powerspan.c                    |    4 +-
 board/barco/barco.c                                |    2 +-
 board/bc3450/cmd_bc3450.c                          |   15 +++--
 board/bct-brettl2/cled.c                           |    3 +-
 board/cm5200/cmd_cm5200.c                          |    3 +-
 board/cm5200/fwupdate.c                            |    6 +-
 board/delta/delta.c                                |    3 +-
 board/digsy_mtc/cmd_mtc.c                          |   36 ++++++----
 board/eltec/bab7xx/bab7xx.c                        |    2 +-
 board/eltec/elppc/elppc.c                          |    2 +-
 board/esd/ar405/ar405.c                            |    9 ++-
 board/esd/cms700/cms700.c                          |    3 +-
 board/esd/common/auto_update.c                     |    2 +-
 board/esd/common/cmd_loadpci.c                     |    4 +-
 board/esd/common/lcd.c                             |    2 +-
 board/esd/common/xilinx_jtag/micro.c               |    2 +-
 board/esd/cpci2dp/cpci2dp.c                        |    3 +-
 board/esd/cpci405/cpci405.c                        |    6 +-
 board/esd/cpci5200/cpci5200.c                      |    2 +-
 board/esd/cpci750/cpci750.c                        |    8 +-
 board/esd/cpci750/sdram_init.c                     |    2 +-
 board/esd/dasa_sim/cmd_dasa_sim.c                  |    4 +-
 board/esd/du440/du440.c                            |   24 +++++--
 board/esd/hh405/hh405.c                            |    3 +-
 board/esd/ocrtc/cmd_ocrtc.c                        |    4 +-
 board/esd/pci405/cmd_pci405.c                      |    2 +-
 board/esd/pci405/pci405.c                          |    2 +-
 board/esd/pf5200/pf5200.c                          |    6 +-
 board/esd/plu405/plu405.c                          |    3 +-
 board/esd/pmc405de/pmc405de.c                      |   12 ++-
 board/esd/pmc440/cmd_pmc440.c                      |   27 +++++---
 board/esd/tasreg/tasreg.c                          |   12 ++--
 board/esd/vme8349/caddy.c                          |    2 +-
 board/esd/voh405/voh405.c                          |    3 +-
 board/evb64260/zuma_pbb.c                          |    6 +-
 board/freescale/common/ngpixis.c                   |    2 +-
 board/freescale/common/pixis.c                     |    6 +-
 board/freescale/common/sys_eeprom.c                |    2 +-
 board/funkwerk/vovpn-gw/vovpn-gw.c                 |    2 +-
 board/g2000/g2000.c                                |    6 +-
 board/hymod/bsp.c                                  |    6 +-
 board/inka4x0/inkadiag.c                           |   35 +++++-----
 board/keymile/km_arm/km_arm.c                      |    2 +-
 board/lwmon/lwmon.c                                |   21 +++---
 board/lwmon5/kbd.c                                 |    9 ++-
 board/lwmon5/lwmon5.c                              |    2 +-
 board/micronas/vct/smc_eeprom.c                    |    6 +-
 board/mpl/common/common_util.c                     |    4 +-
 board/mpl/mip405/cmd_mip405.c                      |    4 +-
 board/mpl/pati/cmd_pati.c                          |    4 +-
 board/mpl/pip405/cmd_pip405.c                      |    4 +-
 board/mpl/vcma9/cmd_vcma9.c                        |    4 +-
 board/pcippc2/pcippc2.c                            |    4 +-
 board/pcs440ep/pcs440ep.c                          |    4 +-
 board/pdm360ng/pdm360ng.c                          |    2 +-
 board/pn62/cmd_pn62.c                              |    4 +-
 board/ppmc7xx/ppmc7xx.c                            |    2 +-
 board/prodrive/pdnb3/pdnb3.c                       |    2 +-
 board/pxa255_idp/pxa_idp.c                         |    2 +-
 board/r360mpi/r360mpi.c                            |    3 +-
 board/renesas/sh7785lcr/rtl8169_mac.c              |    4 +-
 board/renesas/sh7785lcr/selfcheck.c                |    2 +-
 board/renesas/sh7785lcr/sh7785lcr.c                |    2 +-
 board/sandburst/common/ppc440gx_i2c.c              |    2 +-
 board/sandburst/karef/karef.c                      |    4 +-
 board/sandburst/metrobox/metrobox.c                |    4 +-
 board/siemens/common/fpga.c                        |    2 +-
 board/spear/common/spr_misc.c                      |    2 +-
 board/tqc/tqm5200/cmd_stk52xx.c                    |    8 +-
 board/tqc/tqm5200/cmd_tb5200.c                     |    4 +-
 board/tqc/tqm8272/tqm8272.c                        |    2 +-
 board/trab/cmd_trab.c                              |   24 ++++----
 board/trab/trab.c                                  |    3 +-
 board/trizepsiv/eeprom.c                           |    8 ++-
 board/w7o/cmd_vpd.c                                |    2 +-
 .../xilinx/microblaze-generic/microblaze-generic.c |    2 +-
 board/zeus/update.c                                |    2 +-
 board/zeus/zeus.c                                  |    4 +-
 common/cmd_ambapp.c                                |    3 +-
 common/cmd_bdinfo.c                                |   33 ++++++---
 common/cmd_bedbug.c                                |   24 +++++--
 common/cmd_bmp.c                                   |   13 ++--
 common/cmd_boot.c                                  |    3 +-
 common/cmd_bootldr.c                               |    3 +-
 common/cmd_bootm.c                                 |   30 +++++----
 common/cmd_cache.c                                 |    6 +-
 common/cmd_console.c                               |    3 +-
 common/cmd_cplbinfo.c                              |    3 +-
 common/cmd_cramfs.c                                |    6 +-
 common/cmd_dataflash_mmc_mux.c                     |    3 +-
 common/cmd_date.c                                  |    3 +-
 common/cmd_dcr.c                                   |   12 ++-
 common/cmd_df.c                                    |    3 +-
 common/cmd_diag.c                                  |    3 +-
 common/cmd_display.c                               |    3 +-
 common/cmd_dtt.c                                   |    3 +-
 common/cmd_echo.c                                  |    3 +-
 common/cmd_eeprom.c                                |    3 +-
 common/cmd_elf.c                                   |    4 +-
 common/cmd_exit.c                                  |    3 +-
 common/cmd_ext2.c                                  |    6 +-
 common/cmd_fat.c                                   |    6 +-
 common/cmd_fdc.c                                   |    2 +-
 common/cmd_fdos.c                                  |    6 +-
 common/cmd_fdt.c                                   |    3 +-
 common/cmd_flash.c                                 |   10 ++-
 common/cmd_fpga.c                                  |    3 +-
 common/cmd_help.c                                  |    5 +-
 common/cmd_i2c.c                                   |   48 +++++++++-----
 common/cmd_ide.c                                   |    6 +-
 common/cmd_immap.c                                 |   70 
++++++++++----------
 common/cmd_irq.c                                   |    4 +-
 common/cmd_itest.c                                 |    3 +-
 common/cmd_jffs2.c                                 |    9 ++-
 common/cmd_license.c                               |    3 +-
 common/cmd_load.c                                  |   12 ++-
 common/cmd_log.c                                   |    3 +-
 common/cmd_mac.c                                   |    2 +-
 common/cmd_mem.c                                   |   60 +++++++++++------
 common/cmd_mfsl.c                                  |    9 ++-
 common/cmd_mgdisk.c                                |    3 +-
 common/cmd_mii.c                                   |    3 +-
 common/cmd_misc.c                                  |    3 +-
 common/cmd_mmc.c                                   |    9 ++-
 common/cmd_mp.c                                    |    4 +-
 common/cmd_mtdparts.c                              |    6 +-
 common/cmd_nand.c                                  |   11 ++-
 common/cmd_net.c                                   |   31 ++++++---
 common/cmd_nvedit.c                                |   36 +++++++----
 common/cmd_onenand.c                               |   31 ++++++---
 common/cmd_otp.c                                   |    3 +-
 common/cmd_pci.c                                   |    3 +-
 common/cmd_pcmcia.c                                |    3 +-
 common/cmd_portio.c                                |    6 +-
 common/cmd_reginfo.c                               |    3 +-
 common/cmd_reiser.c                                |    6 +-
 common/cmd_sata.c                                  |    3 +-
 common/cmd_scsi.c                                  |    6 +-
 common/cmd_setexpr.c                               |    3 +-
 common/cmd_sf.c                                    |    3 +-
 common/cmd_source.c                                |    2 +-
 common/cmd_spi.c                                   |    3 +-
 common/cmd_spibootldr.c                            |    3 +-
 common/cmd_strings.c                               |    3 +-
 common/cmd_terminal.c                              |    3 +-
 common/cmd_test.c                                  |    9 ++-
 common/cmd_tsi148.c                                |    3 +-
 common/cmd_ubi.c                                   |    3 +-
 common/cmd_ubifs.c                                 |    9 ++-
 common/cmd_universe.c                              |    3 +-
 common/cmd_usb.c                                   |    6 +-
 common/cmd_version.c                               |    3 +-
 common/cmd_vfd.c                                   |    3 +-
 common/cmd_ximg.c                                  |    4 +-
 common/cmd_yaffs2.c                                |   36 +++++++----
 common/command.c                                   |   25 ++++----
 common/hush.c                                      |    5 +-
 common/image.c                                     |    2 +-
 common/kgdb.c                                      |    4 +-
 common/lcd.c                                       |    5 +-
 common/main.c                                      |    4 +-
 drivers/gpio/pca953x.c                             |    7 +-
 drivers/misc/ds4510.c                              |    7 +-
 drivers/misc/fsl_pmic.c                            |    3 +-
 drivers/qe/qe.c                                    |    3 +-
 include/bedbug/type.h                              |    2 +-
 include/command.h                                  |   28 ++++----
 include/vxworks.h                                  |    2 +-
 245 files changed, 918 insertions(+), 636 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-cmd_tbl_t-constify-and-sometimes-localize.patch.zip
Type: application/zip
Size: 42020 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20101020/724353cd/attachment.zip 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20101020/724353cd/attachment.pgp 


More information about the U-Boot mailing list