Hans Verkuil c70366732f i2c: New macro to initialize i2c address lists on the fly
For video4linux we sometimes need to probe for a single i2c address.
Normally you would do it like this:

static const unsigned short addrs[] = {
	addr, I2C_CLIENT_END
};

client = i2c_new_probed_device(adapter, &info, addrs);

This is a bit awkward and I came up with this macro:

#define V4L2_I2C_ADDRS(addr, addrs...) \
	((const unsigned short []){ addr, ## addrs, I2C_CLIENT_END })

This can construct a list of one or more i2c addresses on the fly. But
this is something that really belongs in i2c.h, renamed to I2C_ADDRS.

With this macro we can just do:

client = i2c_new_probed_device(adapter, &info, I2C_ADDRS(addr));

Note that this can also be used to initialize an array:

static const unsigned short addrs[] = I2C_ADDRS(0x2a, 0x2c);

Whether you want to is another matter, but it works. This functionality is 
also available in the oldest supported gcc (3.2).

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-06-19 16:58:21 +02:00
..
2009-06-18 13:03:44 -07:00
2009-06-17 19:41:52 +02:00
2009-06-02 13:53:35 +03:00
2009-06-11 21:36:00 -04:00
2009-06-18 08:46:47 +10:00
2009-06-17 00:36:36 -04:00
2009-04-01 08:59:23 -07:00
2009-06-01 06:21:13 +00:00
2009-05-02 15:36:10 -07:00
2009-06-15 16:47:21 +10:00
2009-04-23 10:06:35 +01:00
2009-06-11 21:36:09 -04:00
2009-04-03 14:53:32 -07:00
2009-05-29 08:40:01 -07:00
2009-06-11 08:50:57 -07:00
2009-06-11 21:36:06 -04:00
2009-06-15 21:30:25 -07:00
2009-04-03 14:53:32 -07:00
2009-06-17 09:33:49 -07:00
2009-06-15 21:30:25 -07:00
2009-06-16 19:50:13 -07:00
2009-06-18 13:04:05 -07:00
2009-04-02 19:04:53 -07:00
2009-06-03 14:05:10 -04:00
2009-05-19 16:02:02 -07:00
2009-05-22 09:43:41 +10:00
2009-06-02 00:45:24 -07:00
2009-06-16 19:47:28 -07:00
2009-06-18 13:03:57 -07:00
2009-06-18 13:03:56 -07:00
2009-04-21 13:41:48 -07:00
2009-04-21 13:41:48 -07:00
2009-06-18 13:04:04 -07:00
2009-06-15 15:49:23 +02:00
2009-06-11 17:03:28 +01:00
2009-06-10 11:48:39 +03:00
2009-04-06 16:06:26 +01:00
2009-06-16 19:47:57 -07:00
2009-04-28 07:37:28 +02:00
2009-04-14 09:00:19 +10:00
2009-06-16 19:47:48 -07:00
2009-06-16 08:40:20 +02:00
2009-04-29 17:32:35 -07:00
2009-06-11 19:05:32 +02:00
2009-05-25 00:55:45 -07:00
2009-06-16 19:50:13 -07:00
2009-06-18 13:03:57 -07:00
2009-06-11 21:36:02 -04:00
2009-06-11 21:36:01 -04:00
2009-04-03 17:41:23 -07:00
2009-04-01 13:28:15 -04:00
2009-04-03 17:41:12 -07:00
2009-06-15 21:44:43 -07:00
2009-04-01 08:59:13 -07:00
2009-04-01 08:59:13 -07:00
2009-06-15 21:44:44 -07:00
2009-04-24 08:54:21 +02:00
2009-04-01 08:59:13 -07:00
2009-06-18 13:04:04 -07:00
2009-06-18 13:04:04 -07:00
2009-06-11 21:36:12 -04:00
2009-03-30 14:28:58 -07:00
2009-05-09 10:49:41 -04:00
2009-04-01 08:59:24 -07:00
2009-04-08 14:33:38 -07:00
2009-06-11 08:50:58 -07:00
2009-04-13 15:04:29 -07:00
2009-06-15 15:50:49 +02:00
2009-04-21 19:40:00 -07:00
2009-06-16 19:47:48 -07:00
2009-04-27 02:45:02 -07:00
2009-05-12 11:11:48 +02:00
2009-06-18 13:03:47 -07:00
2009-04-02 19:05:01 -07:00
2009-06-11 08:50:59 -07:00
2009-06-11 08:51:01 -07:00