Re: [RFC 02/11] i2c: add quirk checks to core

2015-02-24 Thread Wolfram Sang
On Mon, Jan 12, 2015 at 12:08:14PM +, Russell King - ARM Linux wrote: On Fri, Jan 09, 2015 at 06:21:32PM +0100, Wolfram Sang wrote: +static int i2c_quirk_error(struct i2c_adapter *adap, struct i2c_msg *msg, char *err_msg) +{ + dev_err(adap-dev, quirk: %s (addr 0x%04x, size %u)\n,

Re: [RFC 02/11] i2c: add quirk checks to core

2015-02-24 Thread Wolfram Sang
+ if (msgs[i].flags I2C_M_RD) { + if (i2c_quirk_exceeded(len, max_read)) + return i2c_quirk_error(adap, msgs[i], msg too long); + } else { + if (i2c_quirk_exceeded(len, max_write))

Re: [RFC 02/11] i2c: add quirk checks to core

2015-01-12 Thread Ludovic Desroches
Hi Wolfram, On Fri, Jan 09, 2015 at 06:21:32PM +0100, Wolfram Sang wrote: Let the core do the checks if HW quirks prevent a transfer. Saves code from drivers and adds consistency. Signed-off-by: Wolfram Sang w...@the-dreams.de --- drivers/i2c/i2c-core.c | 53

Re: [RFC 02/11] i2c: add quirk checks to core

2015-01-12 Thread Wolfram Sang
I am not sure it will perfectly fit at91 quirks. I think it does. The hardware can handle two messages by using the internal address feature. The internal address size is from one byte to three bytes. Then the length of the first message is limited to three but we don't have this

Re: [RFC 02/11] i2c: add quirk checks to core

2015-01-12 Thread Matthias Brugger
2015-01-09 18:21 GMT+01:00 Wolfram Sang w...@the-dreams.de: Let the core do the checks if HW quirks prevent a transfer. Saves code from drivers and adds consistency. Signed-off-by: Wolfram Sang w...@the-dreams.de --- drivers/i2c/i2c-core.c | 53

Re: [RFC 02/11] i2c: add quirk checks to core

2015-01-12 Thread Russell King - ARM Linux
On Fri, Jan 09, 2015 at 06:21:32PM +0100, Wolfram Sang wrote: +static int i2c_quirk_error(struct i2c_adapter *adap, struct i2c_msg *msg, char *err_msg) +{ + dev_err(adap-dev, quirk: %s (addr 0x%04x, size %u)\n, err_msg, msg-addr, msg-len); + return -EOPNOTSUPP; +} So, what

[RFC 02/11] i2c: add quirk checks to core

2015-01-09 Thread Wolfram Sang
Let the core do the checks if HW quirks prevent a transfer. Saves code from drivers and adds consistency. Signed-off-by: Wolfram Sang w...@the-dreams.de --- drivers/i2c/i2c-core.c | 53 ++ 1 file changed, 53 insertions(+) diff --git

Re: [RFC 02/11] i2c: add quirk checks to core

2015-01-09 Thread Sergei Shtylyov
Hello. On 01/09/2015 08:21 PM, Wolfram Sang wrote: Let the core do the checks if HW quirks prevent a transfer. Saves code from drivers and adds consistency. Signed-off-by: Wolfram Sang w...@the-dreams.de --- drivers/i2c/i2c-core.c | 53 ++

Re: [RFC 02/11] i2c: add quirk checks to core

2015-01-09 Thread Wolfram Sang
On Fri, Jan 09, 2015 at 10:35:27PM +0300, Sergei Shtylyov wrote: Hello. On 01/09/2015 08:21 PM, Wolfram Sang wrote: Let the core do the checks if HW quirks prevent a transfer. Saves code from drivers and adds consistency. Signed-off-by: Wolfram Sang w...@the-dreams.de ---

Re: [RFC 02/11] i2c: add quirk checks to core

2015-01-09 Thread Sergei Shtylyov
Hello. On 01/09/2015 11:45 PM, Wolfram Sang wrote: Let the core do the checks if HW quirks prevent a transfer. Saves code from drivers and adds consistency. Signed-off-by: Wolfram Sang w...@the-dreams.de --- drivers/i2c/i2c-core.c | 53 ++