alistair23-linux/include
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
..
acpi
asm-generic dma-mapping: add asm-generic/dma-mapping-common.h 2009-06-18 13:03:58 -07:00
crypto
drm Merge branch 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6 2009-06-16 21:20:39 -07:00
keys
linux i2c: New macro to initialize i2c address lists on the fly 2009-06-19 16:58:21 +02:00
math-emu
media V4L/DVB (11933): tuner-simple, tveeprom: Add Philips FQ1216LME MK3 analog tuner 2009-06-16 19:07:25 -03:00
mtd
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2009-06-18 14:07:15 -07:00
pcmcia
rdma
rxrpc
scsi Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2009-06-17 09:50:44 -07:00
sound
trace ext4: convert instrumentation from markers to tracepoints 2009-06-17 11:48:11 -04:00
video fbdev: s1d13xxxfb: add accelerated bitblt functions 2009-06-16 19:48:00 -07:00
xen
Kbuild [SCSI] FC Pass Thru support 2009-06-12 14:20:05 -05:00