[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <63f4f4fa-4eb1-d203-8cad-0cffebb919ee@denx.de>
Date: Tue, 18 Dec 2018 15:49:40 +0100
From: Marek Vasut <marex@...x.de>
To: Andrew Lunn <andrew@...n.ch>,
Sergio Paracuellos <sergio.paracuellos@...il.com>
Cc: Tristram.Ha@...rochip.com, Florian Fainelli <f.fainelli@...il.com>,
Pavel Machek <pavel@....cz>,
Dan Carpenter <dan.carpenter@...cle.com>,
vivien.didelot@...oirfairelinux.com, UNGLinuxDriver@...rochip.com,
netdev@...r.kernel.org
Subject: Re: [PATCH RFC net-next] net: dsa: microchip: add KSZ9477 I2C driver
On 12/18/2018 11:01 AM, Andrew Lunn wrote:
> On Tue, Dec 18, 2018 at 07:24:52AM +0100, Sergio Paracuellos wrote:
>>> +static int ksz9477_i2c_read_reg(struct i2c_client *i2c, u32 reg, u8 *val,
>>> + unsigned int len)
>>> +{
>>> + struct i2c_msg msg[2];
>>> + int ret = 0;
>>> +
>>> + val[0] = (u8)(reg >> 8);
>>> + val[1] = (u8)reg;
>>> +
>>> + msg[0].addr = i2c->addr;
>>> + msg[0].flags = 0;
>>> + msg[0].len = 2;
>>> + msg[0].buf = val;
>>> +
>>> + msg[1].addr = i2c->addr;
>>> + msg[1].flags = I2C_M_RD;
>>> + msg[1].len = len;
>>> + msg[1].buf = &val[2];
>>> +
>>> + if (i2c_transfer(i2c->adapter, msg, 2) != 2)
>>> + ret = -ENODEV;
>>
>> Should this be -EREMOTEIO instead?
>
> It should actually be whatever error code i2c_transfer returns.
Before we plunge into coding yet another I2C-and-SPI layer, can we use
regmap instead ?
--
Best regards,
Marek Vasut
Powered by blists - more mailing lists