From: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
To: Doug Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Cc: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
Naveen Krishna Chatradhi
<ch.naveen-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
Grant Likely
<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
Yuvaraj Kumar
<yuvaraj.cd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Ben Dooks <ben.dooks-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>,
u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
Mark Brown
<broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>,
Girish Shivananjappa
<girish.shivananjappa-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
bhushan.r-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
sreekumar.c-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
Prashanth G <prashanth.g-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>,
Daniel Kurtz <djkurtz-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
Grant Grundler <grundler-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
"Ben Dooks (embedded platforms)"
<ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>,
Peter Korsgaard
<peter.korsgaard-ob4gmnvZ1/cAvxtiuMwx3w@public.gmane.org>,
Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>,
Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>,
David Daney <david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>,
Axel Lin <axel.lin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
Barry Song <baohua.song>
Subject: Re: [PATCH v1 4/4] i2c-mux: i2c_add_mux_adapter() should use -1 for auto bus num
Date: Wed, 13 Feb 2013 14:09:08 -0700 [thread overview]
Message-ID: <511C00F4.4080708@wwwdotorg.org> (raw)
In-Reply-To: <1360778532-7480-4-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
On 02/13/2013 11:02 AM, Doug Anderson wrote:
> The force_nr parameter to i2c_add_mux_adapter() uses 0 to signify that
> we don't want to force the bus number of the adapter. This is
> non-ideal because:
> * 0 is actually a valid bus number to request
> * i2c_add_numbered_adapter() (which i2c_add_mux_adapter() calls) uses
> -1 to mean the same thing. That means extra logic in
> i2c_add_mux_adapter().
>
> Fix i2c_add_mux_adapter() to use -1 and update all mux drivers
> accordingly.
>
> Signed-off-by: Doug Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> ---
> Notes:
> - If there's a good reason that force_nr uses 0 for auto then feel
> free to drop this patch. I've place it at the end of the series to
> make it easy to just drop it.
IIRC (and I only vaguely do...) it's because:
> diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c
> index 9f50ef0..301ed0b 100644
> --- a/drivers/i2c/muxes/i2c-mux-gpio.c
> +++ b/drivers/i2c/muxes/i2c-mux-gpio.c
> @@ -208,7 +208,7 @@ static int i2c_mux_gpio_probe(struct platform_device *pdev)
> }
>
> for (i = 0; i < mux->data.n_values; i++) {
> - u32 nr = mux->data.base_nr ? (mux->data.base_nr + i) : 0;
> + int nr = mux->data.base_nr ? (mux->data.base_nr + i) : -1;
Here, mux->data.base_nr is platform data (or copied directly from it),
and any field in a platform data struct stored in a global variable not
explicitly initialized would be 0, hence 0 would typically mean "no
explicit bus number desired". Since a mux can't exist without a parent
I2C bus, it's unlikely anyone would want a mux to be I2C bus 0, but
rather the parent to have that number.
next prev parent reply other threads:[~2013-02-13 21:09 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-13 18:02 [PATCH v1 1/4] i2c: mux: Add i2c-arbitrator 'mux' driver Doug Anderson
2013-02-13 18:02 ` [PATCH v1 4/4] i2c-mux: i2c_add_mux_adapter() should use -1 for auto bus num Doug Anderson
[not found] ` <1360778532-7480-4-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2013-02-13 20:34 ` Guenter Roeck
2013-02-13 21:09 ` Stephen Warren [this message]
[not found] ` <511C00F4.4080708-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-02-14 7:15 ` Jean Delvare
[not found] ` <1360778532-7480-1-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2013-02-13 18:45 ` [PATCH v1 1/4] i2c: mux: Add i2c-arbitrator 'mux' driver Olof Johansson
2013-02-13 18:49 ` Olof Johansson
2013-02-13 21:02 ` Stephen Warren
[not found] ` <511BFF77.2090202-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-02-14 0:34 ` Doug Anderson
[not found] ` <CAD=FV=XUEcUx3NGCm+KijRGujECVTSJ9X5fY=arq-4U_RUdxCQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-14 0:41 ` Stephen Warren
[not found] ` <511C32B5.20600-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-02-14 0:54 ` Doug Anderson
[not found] ` <CAD=FV=X=BPQo245kAtPvNUgKjypOYnheYJWcBkq6AA19z99V0w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-14 21:40 ` Doug Anderson
[not found] ` <CAD=FV=UYEqreNbUAxHydmWH+66pOORMB_uFokivLitsavzTcsQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-14 23:35 ` Stephen Warren
[not found] ` <511D74DD.9070600-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-02-14 23:59 ` Doug Anderson
[not found] ` <CAD=FV=Uri9O=iuuUKB9nPKW+6C+A_WsqW0sXB2nS5i7+=NtFKA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-15 0:16 ` Stephen Warren
[not found] ` <511D7E5D.1030003-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-02-15 1:14 ` Doug Anderson
[not found] ` <CAD=FV=USf_YSzW1ZN2NWZKnLk_LPpnFpxRy=AGVyn_YHjRpKyw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-15 10:26 ` Mark Brown
2013-02-15 10:24 ` Mark Brown
[not found] ` <20130215102420.GA22283-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2013-02-15 19:56 ` Linus Walleij
[not found] ` <CACRpkdav8WO5yOSLPLtpUCeM41nttrbspRb7YrsqGXJ01ebMhw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-17 16:03 ` Mark Brown
2013-02-15 21:05 ` Doug Anderson
2013-02-14 10:01 ` Linus Walleij
[not found] ` <CACRpkdaUtOe9g7+T=cWPepeGae6RcJ1nTeGc9opTijcYzfMedQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-14 17:37 ` Stephen Warren
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=511C00F4.4080708@wwwdotorg.org \
--to=swarren-3lzwwm7+weoh9zmkesr00q@public.gmane.org \
--cc=axel.lin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
--cc=ben.dooks-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org \
--cc=bhushan.r-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
--cc=ch.naveen-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org \
--cc=dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=djkurtz-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=girish.shivananjappa-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
--cc=grundler-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
--cc=linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org \
--cc=olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org \
--cc=peter.korsgaard-ob4gmnvZ1/cAvxtiuMwx3w@public.gmane.org \
--cc=prashanth.g-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=sreekumar.c-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
--cc=w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
--cc=yuvaraj.cd-Re5JQEeQqe8AvxtiuMwx3w@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).