* [PATCH 1/3] include/linux/i2c.h: introduce macros for i2c_msg initialization
@ 2012-09-30 7:33 Julia Lawall
2012-10-01 22:24 ` Ryan Mallon
2012-10-01 22:47 ` Peter Hüwe
0 siblings, 2 replies; 3+ messages in thread
From: Julia Lawall @ 2012-09-30 7:33 UTC (permalink / raw)
To: kernel-janitors
From: Julia Lawall <Julia.Lawall@lip6.fr>
This patch introduces some macros for describing how an i2c_msg is being
initialized. There are three macros: I2C_MSG_READ, for a read message,
I2C_MSG_WRITE, for a write message, and I2C_MSG_OP, for some other kind of
message, which is expected to be very rarely used.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
include/linux/i2c.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 5970266..0990071 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -556,6 +556,13 @@ struct i2c_msg {
__u8 *buf; /* pointer to msg data */
};
+#define I2C_MSG_OP(_addr, _buf, _len, _flags) \
+ { .addr = _addr, .buf = _buf, .len = _len, .flags = _flags }
+
+#define I2C_MSG_WRITE(addr, buf, len) I2C_MSG_OP(addr, buf, len, 0)
+#define I2C_MSG_READ(addr, buf, len) I2C_MSG_OP(addr, buf, len, I2C_M_RD)
+
+
/* To determine what functionality is present */
#define I2C_FUNC_I2C 0x00000001
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 1/3] include/linux/i2c.h: introduce macros for i2c_msg initialization
2012-09-30 7:33 [PATCH 1/3] include/linux/i2c.h: introduce macros for i2c_msg initialization Julia Lawall
@ 2012-10-01 22:24 ` Ryan Mallon
2012-10-01 22:47 ` Peter Hüwe
1 sibling, 0 replies; 3+ messages in thread
From: Ryan Mallon @ 2012-10-01 22:24 UTC (permalink / raw)
To: kernel-janitors
On 30/09/12 17:33, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> This patch introduces some macros for describing how an i2c_msg is being
> initialized. There are three macros: I2C_MSG_READ, for a read message,
> I2C_MSG_WRITE, for a write message, and I2C_MSG_OP, for some other kind of
> message, which is expected to be very rarely used.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Looks good to me. You can add:
Reviewed-by: Ryan Mallon <rmallon@gmail.com>
>
> ---
> include/linux/i2c.h | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/include/linux/i2c.h b/include/linux/i2c.h
> index 5970266..0990071 100644
> --- a/include/linux/i2c.h
> +++ b/include/linux/i2c.h
> @@ -556,6 +556,13 @@ struct i2c_msg {
> __u8 *buf; /* pointer to msg data */
> };
>
> +#define I2C_MSG_OP(_addr, _buf, _len, _flags) \
> + { .addr = _addr, .buf = _buf, .len = _len, .flags = _flags }
> +
> +#define I2C_MSG_WRITE(addr, buf, len) I2C_MSG_OP(addr, buf, len, 0)
> +#define I2C_MSG_READ(addr, buf, len) I2C_MSG_OP(addr, buf, len, I2C_M_RD)
> +
> +
> /* To determine what functionality is present */
>
> #define I2C_FUNC_I2C 0x00000001
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 1/3] include/linux/i2c.h: introduce macros for i2c_msg initialization
2012-09-30 7:33 [PATCH 1/3] include/linux/i2c.h: introduce macros for i2c_msg initialization Julia Lawall
2012-10-01 22:24 ` Ryan Mallon
@ 2012-10-01 22:47 ` Peter Hüwe
1 sibling, 0 replies; 3+ messages in thread
From: Peter Hüwe @ 2012-10-01 22:47 UTC (permalink / raw)
To: kernel-janitors
Am Dienstag, 2. Oktober 2012, 00:24:49 schrieb Ryan Mallon:
> On 30/09/12 17:33, Julia Lawall wrote:
> > From: Julia Lawall <Julia.Lawall@lip6.fr>
> >
> > This patch introduces some macros for describing how an i2c_msg is being
> > initialized. There are three macros: I2C_MSG_READ, for a read message,
> > I2C_MSG_WRITE, for a write message, and I2C_MSG_OP, for some other kind
> > of message, which is expected to be very rarely used.
> >
> > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Cool.
Especially as there is no i2c flag for write this makes code more readable.
Reviewed-by: Peter Huewe <peterhuewe@gmx.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-10-01 22:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-30 7:33 [PATCH 1/3] include/linux/i2c.h: introduce macros for i2c_msg initialization Julia Lawall
2012-10-01 22:24 ` Ryan Mallon
2012-10-01 22:47 ` Peter Hüwe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox