On Wed, Jul 01, 2020 at 11:11:13AM +0200, Ahmad Fatoum wrote:
> +static void at91_fat_start_image(struct pbl_bio *bio,
> +                              void *buf, unsigned int len,
> +                              u32 r4)
> +{
> +     void __noreturn (*bb)(void);
> +     int ret;
> +
> +     ret = pbl_fat_load(bio, "barebox.bin", buf, len);
> +     if (ret < 0) {
> +             pr_err("pbl_fat_load: error %d\n", ret);
> +             return;
> +     }
> +
> +     bb = buf;
> +
> +     sync_caches_for_execution();
> +
> +     xload_bb(bb, r4);
> +}
> +
> +static const struct sdhci_instance {
> +     void __iomem *base;
> +     unsigned id;
> +     u8 periph;
> +     s8 pins[15];
> +} sdhci_instances[] = {
> +     [0] = { SAMA5D2_BASE_SDHC0, SAMA5D2_ID_SDMMC0, AT91_MUX_PERIPH_A,
> +             { 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 13, 10, 11, 12, -1 } },
> +     [1] = { SAMA5D2_BASE_SDHC1, SAMA5D2_ID_SDMMC1, AT91_MUX_PERIPH_E,
> +             { 18, 19, 20, 21, 22, 28, 30, -1 } },
> +};

Can we use C99 initializer here please?

> +
> +/**
> + * sama5d2_sdhci_start_image - Load and start an image from FAT-formatted 
> SDHCI
> + * @r4: value of r4 passed by BootROM
> + *
> + * Return: If successul, this function does not return. A negative error

s/successul/successful/

> + * code is returned when this function fails.

This is not true, the function panics on error.

> + */
> +void __noreturn sama5d2_sdhci_start_image(u32 r4)
> +{
> +     void *buf = (void *)SAMA5_DDRCS;
> +     const struct sdhci_instance *instance;
> +     struct pbl_bio bio;
> +     const s8 *pin;
> +     int ret;
> +
> +     instance = &sdhci_instances[!!sama5_bootsource_instance(r4)];

Why "!!"? sama5_bootsource_instance() should return exactly 0 or 1 here.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to