Skip to contentSkip to conversation

should print_mmc_devices() not add an extraneous blank between devices?

U-Boot Robert P. J. Day 2 participants 2 messages Aug 20, 2013 – Aug 21, 2013

lore
Share & tools
lore
#0 lore raw

playing on my beaglebone black and:

U-Boot# mmc list
OMAP SD/MMC: 0
OMAP SD/MMC: 1 <-- ???
U-Boot#

puzzled as to why the second line is indented, and discovered, first
from cmd_mmc.c:

        print_mmc_devices('\n');

which reasonably defines a newline as a separator, but then there's this in drivers/mmc/mmc.c:

        list_for_each(entry, &mmc_devices) {
                m = list_entry(entry, struct mmc, link);

                printf("%s: %d", m->name, m->block_dev.dev);

                if (entry->next != &mmc_devices)
                        printf("%c ", separator);
        }

where that loop inserts the separator *and* a blank. is that deliberate? it just looks weird.

rday

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
#1 lore raw

Hi Robert,

Quoted 25 lines · Robert P. J. Day

playing on my beaglebone black and:

U-Boot# mmc list
OMAP SD/MMC: 0
OMAP SD/MMC: 1 <-- ???
U-Boot#

puzzled as to why the second line is indented, and discovered, first
from cmd_mmc.c:

        print_mmc_devices('\n');

which reasonably defines a newline as a separator, but then there's this in drivers/mmc/mmc.c:

        list_for_each(entry, &mmc_devices) {
                m = list_entry(entry, struct mmc, link);

                printf("%s: %d", m->name, m->block_dev.dev);

                if (entry->next != &mmc_devices)
                        printf("%c ", separator);
        }
Quoted 3 lines

where that loop inserts the separator *and* a blank. is that deliberate? it just looks weird.

I have used to fix this as follows on some older U-Boot versions:

		if (entry->next != &mmc_devices) {
			printf("%c", separator);
			if (separator != '\n')
				puts (" ");
		}

But as this is just cosmetics, never bothered to submit a patch, nor am fixing it anymore locally. If you are a style perfectionist, do submit one... ;)

Best regards,
Lubomir