Hello Caleb,
On 2024-11-13 14:08, Caleb Connolly wrote:
On 13/11/2024 10:48, Dragan Simic wrote:
Thanks for the patch. Please, see a comment below.
On 2024-11-13 06:30, Caleb Connolly wrote:
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.conno...@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 {
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;
+ }
Can't we simply check for "entry == &mmc_devices->next" here and
avoid the introduction of "first"?
That would be clever, yeah I can do this in v2.
Thanks, please make sure to Cc me in the v2 submission.
I hvaen't found a way to test mmc_legacy thus far, does anyone know how
I could?
printf("%s: %d", m->cfg->name, m->block_dev.devnum);
if (mmc_type)
printf(" (%s)", mmc_type);