Message ID | 20231106022603.3405551-6-seanga2@gmail.com |
---|---|
State | Superseded |
Delegated to: | Tom Rini |
Headers | show |
Series | spl: Use common function for loading/parsing images | expand |
Hi Sean, On Sun, 5 Nov 2023 at 19:26, Sean Anderson <seanga2@gmail.com> wrote: > > Remove NULL assignments to fields in spl_load_info when .load doesn't > reference these fields. This can result in more efficient code. filename > must stay even if it is unused, since load_simple_fit uses it. > > Signed-off-by: Sean Anderson <seanga2@gmail.com> > --- > > Changes in v6: > - New > > arch/arm/mach-sunxi/spl_spi_sunxi.c | 2 -- > common/spl/spl_fat.c | 1 - > common/spl/spl_mmc.c | 2 -- > common/spl/spl_nand.c | 4 ---- > common/spl/spl_spi.c | 2 -- > common/spl/spl_ymodem.c | 1 - > 6 files changed, 12 deletions(-) This makes me wonder if we should have a function to clear it out (using memset() and perhaps a bl_len parameter)? Having said that, the info-field use is pretty self-contained with these files. Reviewed-by: Simon Glass <sjg@chromium.org>
On 11/7/23 23:23, Simon Glass wrote: > Hi Sean, > > On Sun, 5 Nov 2023 at 19:26, Sean Anderson <seanga2@gmail.com> wrote: >> >> Remove NULL assignments to fields in spl_load_info when .load doesn't >> reference these fields. This can result in more efficient code. filename >> must stay even if it is unused, since load_simple_fit uses it. >> >> Signed-off-by: Sean Anderson <seanga2@gmail.com> >> --- >> >> Changes in v6: >> - New >> >> arch/arm/mach-sunxi/spl_spi_sunxi.c | 2 -- >> common/spl/spl_fat.c | 1 - >> common/spl/spl_mmc.c | 2 -- >> common/spl/spl_nand.c | 4 ---- >> common/spl/spl_spi.c | 2 -- >> common/spl/spl_ymodem.c | 1 - >> 6 files changed, 12 deletions(-) > > This makes me wonder if we should have a function to clear it out > (using memset() and perhaps a bl_len parameter)? Having said that, the > info-field use is pretty self-contained with these files. > > Reviewed-by: Simon Glass <sjg@chromium.org> It would be simpler, but this series causes bloat in other areas and this is a very simple way to reduce text size. --Sean
diff --git a/arch/arm/mach-sunxi/spl_spi_sunxi.c b/arch/arm/mach-sunxi/spl_spi_sunxi.c index c2410dd7bb1..896aba69c32 100644 --- a/arch/arm/mach-sunxi/spl_spi_sunxi.c +++ b/arch/arm/mach-sunxi/spl_spi_sunxi.c @@ -354,8 +354,6 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, struct spl_load_info load; debug("Found FIT image\n"); - load.dev = NULL; - load.priv = NULL; load.filename = NULL; load.bl_len = 1; load.read = spi_load_read; diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c index 014074f85be..6172e7bcd48 100644 --- a/common/spl/spl_fat.c +++ b/common/spl/spl_fat.c @@ -99,7 +99,6 @@ int spl_load_image_fat(struct spl_image_info *spl_image, load.read = spl_fit_read; load.bl_len = 1; load.filename = (void *)filename; - load.priv = NULL; return spl_load_simple_fit(spl_image, &load, 0, header); } else { diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index 82689da1401..6d9137c32e0 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -106,7 +106,6 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image, debug("Found FIT\n"); load.dev = mmc; - load.priv = NULL; load.filename = NULL; load.bl_len = mmc->read_bl_len; load.read = h_spl_load_read; @@ -116,7 +115,6 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image, struct spl_load_info load; load.dev = mmc; - load.priv = NULL; load.filename = NULL; load.bl_len = mmc->read_bl_len; load.read = h_spl_load_read; diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c index b8cd6403ba4..9a5a5ffa04a 100644 --- a/common/spl/spl_nand.c +++ b/common/spl/spl_nand.c @@ -91,7 +91,6 @@ static int spl_nand_load_element(struct spl_image_info *spl_image, struct spl_load_info load; debug("Found FIT\n"); - load.dev = NULL; load.priv = &offset; load.filename = NULL; load.bl_len = bl_len; @@ -101,7 +100,6 @@ static int spl_nand_load_element(struct spl_image_info *spl_image, valid_container_hdr((void *)header)) { struct spl_load_info load; - load.dev = NULL; load.priv = &offset; load.filename = NULL; load.bl_len = bl_len; @@ -112,8 +110,6 @@ static int spl_nand_load_element(struct spl_image_info *spl_image, struct spl_load_info load; debug("Found legacy image\n"); - load.dev = NULL; - load.priv = NULL; load.filename = NULL; load.bl_len = IS_ENABLED(CONFIG_SPL_LZMA) ? bl_len : 1; load.read = spl_nand_legacy_read; diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c index 3ac4b1b5091..d83d70f2f33 100644 --- a/common/spl/spl_spi.c +++ b/common/spl/spl_spi.c @@ -152,7 +152,6 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, debug("Found FIT\n"); load.dev = flash; - load.priv = NULL; load.filename = NULL; load.bl_len = 1; load.read = spl_spi_fit_read; @@ -164,7 +163,6 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, struct spl_load_info load; load.dev = flash; - load.priv = NULL; load.filename = NULL; load.bl_len = 1; load.read = spl_spi_fit_read; diff --git a/common/spl/spl_ymodem.c b/common/spl/spl_ymodem.c index 038b4438457..8616cb3e915 100644 --- a/common/spl/spl_ymodem.c +++ b/common/spl/spl_ymodem.c @@ -134,7 +134,6 @@ int spl_ymodem_load_image(struct spl_image_info *spl_image, struct ymodem_fit_info info; debug("Found FIT\n"); - load.dev = NULL; load.priv = (void *)&info; load.filename = NULL; load.bl_len = 1;
Remove NULL assignments to fields in spl_load_info when .load doesn't reference these fields. This can result in more efficient code. filename must stay even if it is unused, since load_simple_fit uses it. Signed-off-by: Sean Anderson <seanga2@gmail.com> --- Changes in v6: - New arch/arm/mach-sunxi/spl_spi_sunxi.c | 2 -- common/spl/spl_fat.c | 1 - common/spl/spl_mmc.c | 2 -- common/spl/spl_nand.c | 4 ---- common/spl/spl_spi.c | 2 -- common/spl/spl_ymodem.c | 1 - 6 files changed, 12 deletions(-)