From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] i2c: merge all i2c_reg_read() and i2c_reg_write() into inline functions
Date: Sat, 04 Oct 2008 01:21:36 +0200 [thread overview]
Message-ID: <20081003232136.76FA22480D@gemini.denx.de> (raw)
In-Reply-To: <1222959963-5697-1-git-send-email-timur@freescale.com>
Dear Timur Tabi,
In message <1222959963-5697-1-git-send-email-timur@freescale.com> you wrote:
> All implementations of the functions i2c_reg_read() and i2c_reg_write() are
> identical. We can save space and simplify the code by converting these
> functions into inlines and putting them in i2c.h.
Actually they are not identical:
> +++ b/cpu/arm926ejs/davinci/i2c.c
> @@ -331,21 +331,4 @@ int i2c_write(u_int8_t chip, u_int32_t addr, int alen, u_int8_t *buf, int len)
...
> -u_int8_t i2c_reg_read(u_int8_t chip, u_int8_t reg)
> -{
> - u_int8_t tmp;
> -
> - i2c_read(chip, reg, 1, &tmp, 1);
> - return(tmp);
> -}
...
> -void i2c_reg_write(u_int8_t chip, u_int8_t reg, u_int8_t val)
> -{
> - u_int8_t tmp;
> -
> - i2c_write(chip, reg, 1, &tmp, 1);
> -}
> -
> #endif /* CONFIG_DRIVER_DAVINCI_I2C */
> diff --git a/cpu/blackfin/i2c.c b/cpu/blackfin/i2c.c
> index 60f03d4..2a3e223 100644
> --- a/cpu/blackfin/i2c.c
> +++ b/cpu/blackfin/i2c.c
> @@ -425,20 +425,4 @@ int i2c_write(uchar chip, uint addr, int alen, uchar * buffer, int len)
...
> -uchar i2c_reg_read(uchar chip, uchar reg)
> -{
> - uchar buf;
> -
> - PRINTD("i2c_reg_read: chip=0x%02x, reg=0x%02x\n", chip, reg);
> - i2c_read(chip, reg, 0, &buf, 1);
> - return (buf);
> -}
> -
> -void i2c_reg_write(uchar chip, uchar reg, uchar val)
> -{
> - PRINTD("i2c_reg_write: chip=0x%02x, reg=0x%02x, val=0x%02x\n", chip,
> - reg, val);
> - i2c_write(chip, reg, 0, &val, 1);
> -}
> -
This does not exactly look identical to me.
And when you claim "We can save space" - which sort of space are you
talking about? Dos this reduce the memory footprint of the code?
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
The main thing is the play itself. I swear that greed for money has
nothing to do with it, although heaven knows I am sorely in need of
money. - Feodor Dostoyevsky
next prev parent reply other threads:[~2008-10-03 23:21 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-02 15:06 [U-Boot] [PATCH] i2c: merge all i2c_reg_read() and i2c_reg_write() into inline functions Timur Tabi
2008-10-03 22:25 ` Timur Tabi
2008-10-03 23:37 ` Wolfgang Denk
2008-10-03 23:21 ` Wolfgang Denk [this message]
2008-10-03 23:25 ` Timur Tabi
2008-10-03 23:39 ` Wolfgang Denk
2008-10-04 22:39 ` Timur Tabi
2008-10-05 16:06 ` Timur Tabi
2008-10-05 18:08 ` Stefan Roese
2008-10-06 3:25 ` Timur Tabi
2008-10-14 20:52 ` Wolfgang Denk
2008-10-14 21:00 ` Timur Tabi
2008-10-19 21:18 ` Mike Frysinger
2008-10-19 21:57 ` Timur Tabi
2008-10-19 23:41 ` Mike Frysinger
2008-10-20 14:19 ` Timur Tabi
2008-10-21 4:22 ` Mike Frysinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081003232136.76FA22480D@gemini.denx.de \
--to=wd@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox