From: Alexey Brodkin Date: Wed, 15 Jan 2014 15:30:24 +0000 Subject: [U-Boot] [PATCH] designware_i2c: Enhance DesignWare I2C driver address support In-Reply-To: <1389797898-10254-1-git-send-email-clsee@altera.com> References: <1389797898-10254-1-git-send-email-clsee@altera.com> Message-ID: <1389799822.19230.15.camel@abrodkin-8560l> 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-01-15 at 08:58 -0600, Chin Liang See wrote: > Enhance the DesignWare I2C driver to support address length more > than 1 byte. This enhancement is required as some I2C slave > device such as EEPROM chip might have 16 bit address byte. > diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c > index cb2ac04..c0ac5f7 100644 > --- a/drivers/i2c/designware_i2c.c > +++ b/drivers/i2c/designware_i2c.c > @@ -205,27 +205,21 @@ static int check_params(uint addr, int alen, uchar *buffer, int len) > return 1; > } > > - if (alen > 1) { > - printf("addr len %d not supported\n", alen); > - return 1; > - } > - > - if (addr + len > 256) { > - printf("address out of range\n"); > - return 1; > - } > - > return 0; > } Hi Chin, if you strip down functionality of "check_params()" to one single check I would recommend you to remove "check_params()" at all and do in-place check for "buffer" existence. Moreover you may just use "assert" for this check because this buffer is passed by u-boot (no need to check every parameter passed to any function in run-time) so in production/release build it won't exist at all. Regards, Alexey