From: John de la Garza <john-RXdYNANpVgkAvxtiuMwx3w@public.gmane.org>
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: jean-michel.hautbois-B+Q8N6RmIDZBDgjK7y7TUQ@public.gmane.org
Subject: Re: [PATCH 1/2] i2c: Add generic support passing secondary devices addresses
Date: Wed, 22 Oct 2014 16:05:00 -0400 [thread overview]
Message-ID: <20141022200457.GA3200@vega.jjdev.com> (raw)
instead of:
+ np = client->dev.of_node;
+
+ if (np) {
+ i = of_property_match_string(np, "reg-names", name);
+ if (i >= 0)
+ of_property_read_u32_index(np, "reg", i, &addr);
+ else if (default_addr != 0)
+ addr = default_addr;
+ else
+ addr = NULL;
+ } else {
+ addr = default_addr;
+ }
how about making the middle part like this to remove the repeated code
np = client->dev.of_node;
addr = default_addr;
if (np) {
i = of_property_match_string(np, "reg-names", name);
if (i >= 0)
of_property_read_u32_index(np, "reg", i, &addr);
else if (default_addr == 0)
addr = NULL;
}
next reply other threads:[~2014-10-22 20:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-22 20:05 John de la Garza [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-10-22 15:30 [PATCH 1/2] i2c: Add generic support passing secondary devices addresses Jean-Michel Hautbois
2014-10-22 23:37 ` Laurent Pinchart
2014-10-23 5:59 ` Jean-Michel Hautbois
[not found] ` <CAL8zT=hM+ua3hdzVXAvQF9EcKbjou3HpHivfntJWYD1E+Ts8Xg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-10-26 23:25 ` Laurent Pinchart
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=20141022200457.GA3200@vega.jjdev.com \
--to=john-rxdynanpvgkavxtiumwx3w@public.gmane.org \
--cc=jean-michel.hautbois-B+Q8N6RmIDZBDgjK7y7TUQ@public.gmane.org \
--cc=linux-i2c-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).