From: Wolfgang Denk Date: Tue, 25 Dec 2012 20:57:24 +0100 Subject: [U-Boot] [PATCH v3 1/1] OMAP3: add boot status GPIO LED for IGEP boards In-Reply-To: <1356349896-11693-1-git-send-email-javier.martinez@collabora.co.uk> References: <1356349896-11693-1-git-send-email-javier.martinez@collabora.co.uk> Message-ID: <20121225195724.8A723200F85@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Javier Martinez Canillas, In message <1356349896-11693-1-git-send-email-javier.martinez@collabora.co.uk> you wrote: > This patch adds an GPIO LED boot status for IGEP boards. > > The GPIO LED used is the red LED0 while the Linux kernel > uses the green LED0 as the boot status. > > By using different GPIO LEDs, the user can know in which > step of the boot process the board currently is. > > Signed-off-by: Javier Martinez Canillas ... > --- a/board/isee/igep0020/igep0020.c > +++ b/board/isee/igep0020/igep0020.c ... > +#if defined(CONFIG_SHOW_BOOT_PROGRESS) && !defined(CONFIG_SPL_BUILD) > +void show_boot_progress(int val) > +{ > + if (val < 0) { > + /* something went wrong */ > + return; > + } > + > + if (!gpio_request(IGEP0020_GPIO_LED, "")) { > + gpio_direction_output(IGEP0020_GPIO_LED, 0); > + gpio_set_value(IGEP0020_GPIO_LED, 1); > + } > +} > +#endif ... > --- a/board/isee/igep0030/igep0030.c > +++ b/board/isee/igep0030/igep0030.c ... > +#if defined(CONFIG_SHOW_BOOT_PROGRESS) && !defined(CONFIG_SPL_BUILD) > +void show_boot_progress(int val) > +{ > + if (val < 0) { > + /* something went wrong */ > + return; > + } > + > + if (!gpio_request(IGEP0030_GPIO_LED, "")) { > + gpio_direction_output(IGEP0030_GPIO_LED, 0); > + gpio_set_value(IGEP0030_GPIO_LED, 1); > + } > +} > +#endif Can we not avoid duplicating this code? If you change IGEP0020_GPIO_LED and IGEP0030_GPIO_LED into some common name like IGEP00XX_GPIO_LED, you can use common code for all such boards. Thanks. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Whenever people agree with me, I always think I must be wrong. - Oscar Wilde