lkml.org 
[lkml]   [2012]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/7] rtc: Convert struct i2c_msg initialization to C99 format
On Tuesday 18 September 2012 07:21 AM, Ryan Mallon wrote:
> Actually, I wonder if it is useful to have something like:.
Read and write differ only in the flag also it will be a deviation from
what $SUBJECT
would warrant. So could be a separate patch.
>
> #define I2C_WRITE(_addr, _buf, _len) { \
> .addr = _addr, \
> .buf = _buf, \
> .len = _len, \
> }
>
> #define I2C_READ(_addr, _buf, _len) { \
> .addr = _addr, \
> .buf = _buf, \
> .len = _len, \
> .flags = I2C_M_RD, \
> }
>
> and then write this as:
>
> struct i2c_msg msgs[2] = {
> I2C_WRITE(client->addr, reg_addr, sizeof(reg_addr)),
> I2C_READ(client->addr, buf, len),
> };



\
 
 \ /
  Last update: 2012-09-18 08:21    [W:0.129 / U:0.708 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site