Hi Simon,
On Wed, Jul 19, 2017 at 11:05 AM, Simon Glass <[email protected]> wrote:
> On 14 July 2017 at 05:55, Mario Six <[email protected]> wrote:
>> Prepare the function interface of the ihs_i2c driver for DM conversion
>> in a future patch.
>>
>> While we're at it, fix some style violations, and make the code more
>> readable.
>>
>> Signed-off-by: Mario Six <[email protected]>
>> ---
>>
>> drivers/i2c/ihs_i2c.c | 74
>> +++++++++++++++++++++++++++++++--------------------
>> 1 file changed, 45 insertions(+), 29 deletions(-)
>
> Reviewed-by: Simon Glass <[email protected]>
>
> Please see below
>
>>
>> diff --git a/drivers/i2c/ihs_i2c.c b/drivers/i2c/ihs_i2c.c
>> index 29612e69fe..e066ad53db 100644
>> --- a/drivers/i2c/ihs_i2c.c
>> +++ b/drivers/i2c/ihs_i2c.c
>
>> @@ -182,13 +182,29 @@ static int ihs_i2c_probe(struct i2c_adapter *adap,
>> uchar chip)
>> static int ihs_i2c_read(struct i2c_adapter *adap, uchar chip, uint addr,
>> int alen, uchar *buffer, int len)
>> {
>> - return ihs_i2c_access(adap, chip, addr, alen, buffer, len, true);
>> + u8 addr_bytes[4];
>> +
>> + addr_bytes[0] = (addr >> 0) & 0xFF;
>> + addr_bytes[1] = (addr >> 8) & 0xFF;
>> + addr_bytes[2] = (addr >> 16) & 0xFF;
>> + addr_bytes[3] = (addr >> 24) & 0xFF;
>
> Can you use put_unaligned_le32() or similar?
>
I wasn't aware that put_unaligned_le32 has been imported from the kernel; I've
used identical code in several I2C drivers, so I'll convert them in a separate
series as well.
>> +
>> + return ihs_i2c_access(adap, chip, addr_bytes, alen, buffer, len,
>> + I2COP_READ);
>> }
>>
>> static int ihs_i2c_write(struct i2c_adapter *adap, uchar chip, uint addr,
>> int alen, uchar *buffer, int len)
>> {
>> - return ihs_i2c_access(adap, chip, addr, alen, buffer, len, false);
>> + u8 addr_bytes[4];
>> +
>> + addr_bytes[0] = (addr >> 0) & 0xFF;
>> + addr_bytes[1] = (addr >> 8) & 0xFF;
>> + addr_bytes[2] = (addr >> 16) & 0xFF;
>> + addr_bytes[3] = (addr >> 24) & 0xFF;
>> +
>> + return ihs_i2c_access(adap, chip, addr_bytes, alen, buffer, len,
>> + I2COP_WRITE);
>> }
>>
>> static unsigned int ihs_i2c_set_bus_speed(struct i2c_adapter *adap,
>> --
>> 2.11.0
>>
>
> Regards,
> Simon
Best regards,
Mario
_______________________________________________
U-Boot mailing list
[email protected]
https://lists.denx.de/listinfo/u-boot