[PATCH] mmc: don't print 'MMC:' if there are no MMC devices

Jaehoon Chung jh80.chung at samsung.com
Thu Nov 14 07:54:30 CET 2024


Hi,

> -----Original Message-----
> From: Caleb Connolly <caleb.connolly at linaro.org>
> Sent: Wednesday, November 13, 2024 2:30 PM
> To: Caleb Connolly <caleb.connolly at linaro.org>; Christian Marangi <ansuelsmth at gmail.com>; Dragan Simic
> <dsimic at manjaro.org>; Ilias Apalodimas <ilias.apalodimas at linaro.org>; Jaehoon Chung
> <jh80.chung at samsung.com>; Jerome Forissier <jerome.forissier at linaro.org>; Jonas Karlman
> <jonas at kwiboo.se>; Marek Vasut <marek.vasut+renesas at mailbox.org>; Peng Fan <peng.fan at nxp.com>; Peter
> Robinson <pbrobinson at gmail.com>; Rasmus Villemoes <rasmus.villemoes at prevas.dk>; Simon Glass
> <sjg at chromium.org>; Sughosh Ganu <sughosh.ganu at linaro.org>; Tom Rini <trini at konsulko.com>
> Cc: u-boot at lists.denx.de
> Subject: [PATCH] mmc: don't print 'MMC:' if there are no MMC devices
>
> It may be the case that MMC support is enabled even though the board
> we're booting on doesn't have any MMC devices. Move the print over to
> the print_mmc_devices() function where we can only print it if we
> actually have MMC devices.
>
> Signed-off-by: Caleb Connolly <caleb.connolly at linaro.org>
> ---
>  common/board_r.c         | 1 -
>  drivers/mmc/mmc-uclass.c | 4 +++-
>  drivers/mmc/mmc_legacy.c | 5 +++++
>  3 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/common/board_r.c b/common/board_r.c
> index 62228a723e12..232a8fd19f03 100644
> --- a/common/board_r.c
> +++ b/common/board_r.c
> @@ -384,9 +384,8 @@ static int initr_onenand(void)
>
>  #ifdef CONFIG_MMC
>  static int initr_mmc(void)
>  {
> -	puts("MMC:   ");
>  	mmc_initialize(gd->bd);
>  	return 0;
>  }
>  #endif
> diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
> index c8db4f811c2f..56fe29249c36 100644
> --- a/drivers/mmc/mmc-uclass.c
> +++ b/drivers/mmc/mmc-uclass.c
> @@ -384,9 +384,11 @@ void print_mmc_devices(char separator)
>  	     dev;
>  	     uclass_next_device(&dev), first = false) {
>  		struct mmc *m = mmc_get_mmc_dev(dev);
>
> -		if (!first) {
> +		if (first) {
> +			printf("MMC:  ");
> +		} else {

Frankly, I don't know if it needs to print "MMC; " at here.
It's already knowing mmc with mmc command. In board_r, To clarify which device is showing "MMC", but not here.

Best Regards,
Jaehoon Chung

>  			printf("%c", separator);
>  			if (separator != '\n')
>  				puts(" ");
>  		}
> diff --git a/drivers/mmc/mmc_legacy.c b/drivers/mmc/mmc_legacy.c
> index 8f8ba34be717..f4a049a4a4d4 100644
> --- a/drivers/mmc/mmc_legacy.c
> +++ b/drivers/mmc/mmc_legacy.c
> @@ -98,8 +98,9 @@ void print_mmc_devices(char separator)
>  {
>  	struct mmc *m;
>  	struct list_head *entry;
>  	char *mmc_type;
> +	bool first = true;
>
>  	list_for_each(entry, &mmc_devices) {
>  		m = list_entry(entry, struct mmc, link);
>
> @@ -107,8 +108,12 @@ void print_mmc_devices(char separator)
>  			mmc_type = IS_SD(m) ? "SD" : "eMMC";
>  		else
>  			mmc_type = NULL;
>
> +		if (first) {
> +			printf("MMC:  ");
> +			first = false;
> +		}
>  		printf("%s: %d", m->cfg->name, m->block_dev.devnum);
>  		if (mmc_type)
>  			printf(" (%s)", mmc_type);
>
> --
> 2.47.0





More information about the U-Boot mailing list