spl: Move check for SPL_LIBCOMMON support to header
PATCH v2 1/1 spl: Move check for SPL_LIBCOMMON support to header
Print statements in SPL depend on lib/common support, due to this many such print statements are ifdef'd. Instead of checking at each call site move the check to the common.h header and remove these inline checks.
--- common/common_fit.c | 2 -- common/spl/spl.c | 2 -- common/spl/spl_ext.c | 8 -------- common/spl/spl_fat.c | 6 ------ common/spl/spl_mmc.c | 18 ------------------ common/spl/spl_sata.c | 2 -- common/spl/spl_usb.c | 2 -- drivers/mmc/mmc-uclass.c | 2 -- drivers/mmc/mmc.c | 12 ------------ drivers/mmc/mmc_legacy.c | 2 -- include/stdio.h | 5 ++--- 11 files changed, 2 insertions(+), 59 deletions(-)
common/common_fit.c +0 -2
@@ -48,10 +48,8 @@ int fit_find_config_node(const void *fdt) node = fdt_next_subnode(fdt, node)) { name =fdt_getprop (fdt, node,"description" , &len);if (!name) { -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf ("%s: Missing FDT description in DTB\n" , __func__); -#endif return -EINVAL ; }
common/spl/spl.c +0 -2
@@ -577,12 +577,10 @@ static int boot_from_devices(struct spl_image_info *spl_image,struct spl_image_loader *loader; loader =spl_ll_find_loader (spl_boot_list[i]); -#if defined(CONFIG_SPL_SERIAL_SUPPORT ) && defined(CONFIG_SPL_LIBCOMMON_SUPPORT )if (loader)printf ("Trying to boot from %s\n" , loader->name);else puts (SPL_TPL_PROMPT "Unsupported Boot Device!\n" ); -#endif if (loader && !spl_load_image (spl_image, loader)) { spl_image->boot_device = spl_boot_list[i];return 0 ;
common/spl/spl_ext.c +0 -8
@@ -28,9 +28,7 @@ int spl_load_image_ext(struct spl_image_info *spl_image, err =ext4fs_mount (0 );if (!err) { -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf ("%s: ext4fs mount err - %d\n" , __func__, err); -#endif goto end; }
@@ -54,11 +52,9 @@ int spl_load_image_ext(struct spl_image_info *spl_image, err =ext4fs_read ((char *)spl_image->load_addr,0 , filelen, &actlen); end: -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT if (err <0 )printf ("%s: error reading image %s, err - %d\n" , __func__, filename, err); -#endif return err <0 ; }
@@ -81,9 +77,7 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image, err =ext4fs_mount (0 );if (!err) { -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf ("%s: ext4fs mount err - %d\n" , __func__, err); -#endif return -1 ; }#if defined(CONFIG_SPL_ENV_SUPPORT )
@@ -126,10 +120,8 @@ defaults: err =ext4fs_read ((void *)CONFIG_SYS_SPL_ARGS_ADDR ,0 , filelen, &actlen);if (err <0 ) { -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf ("%s: error reading image %s, err - %d\n" , __func__,CONFIG_SPL_FS_LOAD_ARGS_NAME , err); -#endif return -1 ; }
common/spl/spl_fat.c +0 -6
@@ -28,9 +28,7 @@ static int spl_register_fat_device(struct blk_desc *block_dev, int partition) err =fat_register_device (block_dev, partition);if (err) { -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf ("%s: fat register err - %d\n" , __func__, err); -#endif return err; }
@@ -102,11 +100,9 @@ int spl_load_image_fat(struct spl_image_info *spl_image, } end: -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT if (err <=0 )printf ("%s: error reading image %s, err - %d\n" , __func__, filename, err); -#endif return (err <=0 ); }
@@ -152,10 +148,8 @@ defaults: err =file_fat_read (CONFIG_SPL_FS_LOAD_ARGS_NAME , (void *)CONFIG_SYS_SPL_ARGS_ADDR ,0 );if (err <=0 ) { -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf ("%s: error reading image %s, err - %d\n" , __func__,CONFIG_SPL_FS_LOAD_ARGS_NAME , err); -#endif return -1 ; }
common/spl/spl_mmc.c +0 -18
@@ -95,9 +95,7 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image, end:if (ret) { -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT puts ("mmc_load_image_raw_sector: mmc block read error\n" ); -#endif return -1 ; }
@@ -114,9 +112,7 @@ static int spl_mmc_get_device_index(u32 boot_device)return 1 ; } -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf ("spl: unsupported mmc boot device.\n" ); -#endif return -ENODEV ; }
@@ -135,18 +131,14 @@ static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device) err =mmc_initialize (NULL );#endif /* DM_MMC */ if (err) { -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf ("spl: could not initialize mmc. error: %d\n" , err); -#endif return err; } *mmcp =find_mmc_device (mmc_dev); err = *mmcp ?0 : -ENODEV ;if (err) { -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf ("spl: could not find mmc device %d. error: %d\n" , mmc_dev, err); -#endif return err; }
@@ -178,9 +170,7 @@ static int mmc_load_image_raw_partition(struct spl_image_info *spl_image, err =part_get_info (mmc_get_blk_desc (mmc), partition, &info);if (err) { -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT puts ("spl: partition error\n" ); -#endif return -1 ; }
@@ -206,9 +196,7 @@ static int mmc_load_image_raw_os(struct spl_image_info *spl_image,CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS , (void *) CONFIG_SYS_SPL_ARGS_ADDR);if (count !=CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS ) { -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT puts ("mmc_load_image_raw_os: mmc block read error\n" ); -#endif return -1 ; }#endif /* CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR */
@@ -336,9 +324,7 @@ int spl_mmc_load(struct spl_image_info *spl_image, err =mmc_init (mmc);if (err) { mmc =NULL ; -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf ("spl: mmc init failed with error: %d\n" , err); -#endif return err; } }
@@ -367,9 +353,7 @@ int spl_mmc_load(struct spl_image_info *spl_image, err =blk_dselect_hwpart (mmc_get_blk_desc (mmc), part);if (err) { -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT puts ("spl: mmc partition switch failed\n" ); -#endif return err; }/* Fall through */
@@ -404,10 +388,8 @@ int spl_mmc_load(struct spl_image_info *spl_image,return err;break ; -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT default :puts ("spl: mmc: wrong boot mode\n" ); -#endif }return err;
common/spl/spl_sata.c +0 -2
@@ -66,9 +66,7 @@ static int spl_sata_load_image(struct spl_image_info *spl_image, err =init_sata (CONFIG_SPL_SATA_BOOT_DEVICE );#endif if (err) { -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf ("spl: sata init failed: err - %d\n" , err); -#endif return err; }else {/* try to recognize storage devices immediately */
common/spl/spl_usb.c +0 -2
@@ -26,9 +26,7 @@ static int spl_usb_load_image(struct spl_image_info *spl_image,usb_stop (); err =usb_init ();if (err) { -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf ("%s: usb init failed: err - %d\n" , __func__, err); -#endif return err; }
drivers/mmc/mmc-uclass.c +0 -2
@@ -225,9 +225,7 @@ struct mmc *find_mmc_device(int dev_num) ret =blk_find_device (IF_TYPE_MMC , dev_num, &dev);if (ret) { -#if !defined(CONFIG_SPL_BUILD ) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT )printf ("MMC Device %d not found\n" , dev_num); -#endif return NULL ; }
drivers/mmc/mmc.c +0 -12
@@ -250,9 +250,7 @@ int mmc_poll_for_busy(struct mmc *mmc, int timeout_ms)break ;if (status &MMC_STATUS_MASK ) { -#if !defined(CONFIG_SPL_BUILD ) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT )pr_err ("Status Error: 0x%08x\n" , status); -#endif return -ECOMM ; }
@@ -263,9 +261,7 @@ int mmc_poll_for_busy(struct mmc *mmc, int timeout_ms) }if (timeout_ms <=0 ) { -#if !defined(CONFIG_SPL_BUILD ) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT )pr_err ("Timeout waiting card ready\n" ); -#endif return -ETIMEDOUT ; }
@@ -405,9 +401,7 @@ static int mmc_read_blocks(struct mmc *mmc, void *dst, lbaint_t start, cmd.cmdarg =0 ; cmd.resp_type = MMC_RSP_R1b;if (mmc_send_cmd (mmc, &cmd,NULL )) { -#if !defined(CONFIG_SPL_BUILD ) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT )pr_err ("mmc fail to send stop cmd\n" ); -#endif return 0 ; } }
@@ -445,10 +439,8 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,return 0 ;if ((start + blkcnt) > block_dev->lba) { -#if !defined(CONFIG_SPL_BUILD ) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT )pr_err ("MMC: block number 0x" LBAF " exceeds max(0x" LBAF ")\n" , start + blkcnt, block_dev->lba); -#endif return 0 ; }
@@ -2811,9 +2803,7 @@ retry: err =mmc_send_op_cond (mmc);if (err) { -#if !defined(CONFIG_SPL_BUILD ) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT )pr_err ("Card did not respond to voltage select!\n" ); -#endif return -EOPNOTSUPP ; } }
@@ -2844,9 +2834,7 @@ int mmc_start_init(struct mmc *mmc)#endif if (no_card) { mmc->has_init =0 ; -#if !defined(CONFIG_SPL_BUILD ) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT )pr_err ("MMC: no card present\n" ); -#endif return -ENOMEDIUM ; }
drivers/mmc/mmc_legacy.c +0 -2
@@ -46,9 +46,7 @@ struct mmc *find_mmc_device(int dev_num)return m; } -#if !defined(CONFIG_SPL_BUILD ) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT )printf ("MMC Device %d not found\n" , dev_num); -#endif return NULL ; }
include/stdio.h +2 -3
@@ -10,9 +10,8 @@ int tstc(void);/* stdout */ #if !defined(CONFIG_SPL_BUILD ) || \ - (defined(CONFIG_TPL_BUILD ) && defined(CONFIG_TPL_SERIAL_SUPPORT )) || \ - (defined(CONFIG_SPL_BUILD ) && !defined(CONFIG_TPL_BUILD ) && \ - defined(CONFIG_SPL_SERIAL_SUPPORT )) + (defined(CONFIG_TPL_BUILD ) && defined(CONFIG_TPL_SERIAL_SUPPORT ) && defined(CONFIG_TPL_LIBCOMMON_SUPPORT )) || \ + (defined(CONFIG_SPL_BUILD ) && defined(CONFIG_SPL_SERIAL_SUPPORT ) && defined(CONFIG_SPL_LIBCOMMON_SUPPORT ) && !defined(CONFIG_TPL_BUILD ))void putc (const char c);void puts (const char *s); int __printf(1, 2) printf(const char *fmt, ...);
Signature · 1 line
2.17.1
PATCH v2 1/1 spl: Move check for SPL_LIBCOMMON support to header
Quoted 6 lines · Andrew F. Davis
Print statements in SPL depend on lib/common support, due to this many such print statements are ifdef'd. Instead of checking at each call site move the check to the
common.hheader and remove these inline checks.Signed-off-by Andrew F. Davis <[email protected]>Reviewed-by Simon Glass <[email protected]>
Nice cleanup..!!
Thanks and regards,
Lokesh
PATCH v2 1/1 spl: Move check for SPL_LIBCOMMON support to header
In reply to Andrew F. DavisQuoted 7 lines · Andrew F. Davis
Print statements in SPL depend on lib/common support, due to this many such print statements are ifdef'd. Instead of checking at each call site move the check to the
common.hheader and remove these inline checks.Signed-off-by Andrew F. Davis <[email protected]>Reviewed-by Simon Glass <[email protected]>Reviewed-by Lokesh Vutla <[email protected]>
This breaks a number of platforms as can be seen on Travis/GitLab/Azure. I bisected down to this commit while testing by using the firefly-px30 board.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200122/7229c87c/attachment.sig>