linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jon Smirl <jonsmirl@gmail.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-i2c@vger.kernel.org, linux-media@vger.kernel.org
Subject: Re: RFC: proposal for new i2c.h macro to initialize i2c address lists on the fly
Date: Sat, 6 Jun 2009 18:20:26 -0400	[thread overview]
Message-ID: <9e4733910906061520o7b0b2858wf4530cf672b1adc9@mail.gmail.com> (raw)
In-Reply-To: <200906061500.49338.hverkuil@xs4all.nl>

On Sat, Jun 6, 2009 at 9:00 AM, Hans Verkuil<hverkuil@xs4all.nl> wrote:
> Hi all,
>
> For video4linux we sometimes need to probe for a single i2c address.
> Normally you would do it like this:

Why does video4linux need to probe to find i2c devices? Can't the
address be determined by knowing the PCI ID of the board?


>
> 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?
>
> Regards,
>
>        Hans
>
> --
> Hans Verkuil - video4linux developer - sponsored by TANDBERG Telecom
> --
> To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



-- 
Jon Smirl
jonsmirl@gmail.com
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2009-06-06 22:20 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 [this message]
     [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
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=9e4733910906061520o7b0b2858wf4530cf672b1adc9@mail.gmail.com \
    --to=jonsmirl@gmail.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-media@vger.kernel.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).