From: Magnus Lilja Date: Mon, 5 Jan 2009 16:23:56 +0100 Subject: [U-Boot] [PATCH 2/2] smc911x_eeprom: new example app for managing newer SMC parts In-Reply-To: <1229932567-10682-2-git-send-email-vapier@gentoo.org> References: <1229932567-10682-1-git-send-email-vapier@gentoo.org> <1229932567-10682-2-git-send-email-vapier@gentoo.org> Message-ID: <59b21cf20901050723u313c670bt8491d237cd32b690@mail.gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi I forgot to include some comments on the code, sorry about the noise. 2008/12/22 Mike Frysinger : > A forward port of the last version to work with the newer smc911x driver. > I only have a board with a LAN9218 part on it, so that is the only one > I've tested. But there isn't anything in this that would make it terribly > chip specific afaik. > > Signed-off-by: Mike Frysinger > CC: Sascha Hauer > CC: Guennadi Liakhovetski > CC: Magnus Lilja > CC: Ben Warren > --- > examples/.gitignore | 1 + > examples/Makefile | 7 +- > examples/smc911x_eeprom.c | 381 +++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 386 insertions(+), 3 deletions(-) > diff --git a/examples/smc911x_eeprom.c b/examples/smc911x_eeprom.c > new file mode 100644 > index 0000000..3dac4d3 > --- /dev/null > +++ b/examples/smc911x_eeprom.c <...> > +static void print_macaddr(void) > +{ > + puts("Current MAC Address in MAC: "); > + ulong addrl = smc911x_get_mac_csr(ADDRL); > + ulong addrh = smc911x_get_mac_csr(ADDRH); > + printf("%02x:%02x:%02x:%02x:%02x:%02x\n", > + (u8)(addrl), (u8)(addrl >> 8), (u8)(addrl >> 16), > + (u8)(addrl >> 24), (u8)(addrh), (u8)(addrh >> 8)); > + > + puts("Current MAC Address in EEPROM: "); > + int i; > + for (i = 1; i < 6; ++i) > + printf("%02x:", read_eeprom_reg(i)); > + printf("%02x\n", read_eeprom_reg(i)); > +} The above function declares new variables in the middle of the code. Is this OK w.r.t. the coding standard? I haven't seen such code in U-boot (or Linux) before. /Magnus