From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Date: Sun, 28 Dec 2014 09:40:05 +0000 Subject: [U-Boot] [PATCH 05/17] sunxi: video: Improve monitor video-mode option handling In-Reply-To: <1419447989-21959-6-git-send-email-hdegoede@redhat.com> References: <1419447989-21959-1-git-send-email-hdegoede@redhat.com> <1419447989-21959-6-git-send-email-hdegoede@redhat.com> Message-ID: <1419759605.13595.45.camel@hellion.org.uk> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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.