linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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: Mon, 8 Jun 2009 14:39:32 +0200	[thread overview]
Message-ID: <20090608143932.36cd1b4f@hyperion.delvare> (raw)
In-Reply-To: <200906061500.49338.hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>

Hi Hans,

On Sat, 6 Jun 2009 15:00:48 +0200, Hans Verkuil wrote:
> 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));
> 
> Comments?

I'm not a big fan of macros which hide how things work, but if this
makes your life easier, why not. Just send a patch and I'll queue it up
for 2.6.31.

-- 
Jean Delvare

  parent reply	other threads:[~2009-06-08 12:39 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
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
     [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 [this message]
2009-06-09 13:04     ` Hans Verkuil
     [not found]       ` <200906091504.37330.hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2009-06-09 14:54         ` Jean Delvare

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=20090608143932.36cd1b4f@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).