On Wed, 2014-12-24 at 20:06 +0100, Hans de Goede wrote:

> +enum sunxi_monitor {
> +     sunxi_monitor_none,
> +     sunxi_monitor_dvi,
> +     sunxi_monitor_hdmi,
> +     sunxi_monitor_lcd,
> +     sunxi_monitor_vga,
> +};
[...]
> +     const char *mon_desc[] = { "none", "dvi", "hdmi", "lcd", "vga" };

These risk getting out of sync. I half expect the array will be punted
by the compiler into static storage anyway, so you could just make it a
global up near the enum (and perhaps use the [sunxi_monitor_none] =
"none" initialiser style).

Another option (which I think I prefer) would be a get_mon_desc helper
with a switch in it over the enum, returning the const char *. Then the
compiler will (hopefully) complain if a new enum is added without a
corresponding description.

The rest all looks fine to me.

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to