From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
To: Hans Verkuil <hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: RFC: proposal for new i2c.h macro to initialize i2c address lists on the fly
Date: Tue, 9 Jun 2009 16:54:18 +0200 [thread overview]
Message-ID: <20090609165418.70768103@hyperion.delvare> (raw)
In-Reply-To: <200906091504.37330.hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
On Tue, 9 Jun 2009 15:04:36 +0200, Hans Verkuil wrote:
> Here it is:
>
> --- linux-git/include/linux/i2c.h.orig 2009-06-09 14:53:32.000000000 +0200
> +++ linux-git/include/linux/i2c.h 2009-06-09 15:03:24.000000000 +0200
> @@ -412,6 +412,10 @@
> /* The numbers to use to set I2C bus address */
> #define ANY_I2C_BUS 0xffff
>
> +/* Construct an I2C_CLIENT_END-terminated array of i2c addresses */
> +#define I2C_ADDRS(addr, addrs...) \
> + ((const unsigned short []){ addr, ## addrs, I2C_CLIENT_END })
> +
>
> /* ----- functions exported by i2c.o */
>
>
> Signed-off-by: Hans Verkuil <hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
>
> 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).
Applied, thanks.
--
Jean Delvare
next prev parent reply other threads:[~2009-06-09 14:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-06 13:00 RFC: proposal for new i2c.h macro to initialize i2c address lists on the fly Hans Verkuil
2009-06-06 17:32 ` Trent Piepho
[not found] ` <200906061500.49338.hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2009-06-06 21:38 ` Mauro Carvalho Chehab
2009-06-08 12:39 ` Jean Delvare
2009-06-09 13:04 ` Hans Verkuil
[not found] ` <200906091504.37330.hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2009-06-09 14:54 ` Jean Delvare [this message]
2009-06-06 22:20 ` Jon Smirl
[not found] ` <9e4733910906061520o7b0b2858wf4530cf672b1adc9-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-06-06 23:23 ` hermann pitton
2009-06-07 6:35 ` Hans Verkuil
[not found] ` <200906070835.46989.hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2009-06-07 13:25 ` Jon Smirl
[not found] ` <9e4733910906070625i74477c9ma422b061eb61449d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-06-07 13:30 ` Jon Smirl
[not found] ` <9e4733910906070630i1ffcb821xb912f5ea662c7bef-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-06-07 13:38 ` Hans Verkuil
2009-06-07 20:00 ` Andy Walls
[not found] ` <1244404831.3141.33.camel-xioobY1GIEhKttHedORAlB2eb7JE58TQ@public.gmane.org>
2009-06-07 21:01 ` hermann pitton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090609165418.70768103@hyperion.delvare \
--to=khali-puyad+kwke1g9huczpvpmw@public.gmane.org \
--cc=hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).