From: Saurabh Sengar <saurabh.truth@gmail.com>
To: dmitry.torokhov@gmail.com, marex@denx.de,
viresh.kumar@linaro.org, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Saurabh Sengar <saurabh.truth@gmail.com>
Subject: [PATCH] Input: smtpe-ts: better way of using of_property_read_u32()
Date: Tue, 24 Nov 2015 12:36:38 +0530 [thread overview]
Message-ID: <1448348798-5950-1-git-send-email-saurabh.truth@gmail.com> (raw)
better way of using of_property_read_u32(), helps remove one variable
and many 'if' conditions
Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
---
drivers/input/touchscreen/stmpe-ts.c | 29 ++++++++++-------------------
1 file changed, 10 insertions(+), 19 deletions(-)
diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c
index e414d43..51abe62 100644
--- a/drivers/input/touchscreen/stmpe-ts.c
+++ b/drivers/input/touchscreen/stmpe-ts.c
@@ -268,27 +268,18 @@ static void stmpe_ts_get_platform_info(struct platform_device *pdev,
struct stmpe_touch *ts)
{
struct device_node *np = pdev->dev.of_node;
- u32 val;
if (np) {
- if (!of_property_read_u32(np, "st,sample-time", &val))
- ts->sample_time = val;
- if (!of_property_read_u32(np, "st,mod-12b", &val))
- ts->mod_12b = val;
- if (!of_property_read_u32(np, "st,ref-sel", &val))
- ts->ref_sel = val;
- if (!of_property_read_u32(np, "st,adc-freq", &val))
- ts->adc_freq = val;
- if (!of_property_read_u32(np, "st,ave-ctrl", &val))
- ts->ave_ctrl = val;
- if (!of_property_read_u32(np, "st,touch-det-delay", &val))
- ts->touch_det_delay = val;
- if (!of_property_read_u32(np, "st,settling", &val))
- ts->settling = val;
- if (!of_property_read_u32(np, "st,fraction-z", &val))
- ts->fraction_z = val;
- if (!of_property_read_u32(np, "st,i-drive", &val))
- ts->i_drive = val;
+ of_property_read_u32(np, "st,sample-time", &ts->sample_time);
+ of_property_read_u32(np, "st,mod-12b", &ts->mod_12b);
+ of_property_read_u32(np, "st,ref-sel", &ts->ref_sel);
+ of_property_read_u32(np, "st,adc-freq", &ts->adc_freq);
+ of_property_read_u32(np, "st,ave-ctrl", &ts->ave_ctrl);
+ of_property_read_u32(np, "st,touch-det-delay",
+ &ts->touch_det_delay);
+ of_property_read_u32(np, "st,settling", &ts->settling = val);
+ of_property_read_u32(np, "st,fraction-z", &ts->fraction_z);
+ of_property_read_u32(np, "st,i-drive", &ts->i_drive);
}
}
--
1.9.1
next reply other threads:[~2015-11-24 7:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-24 7:06 Saurabh Sengar [this message]
2015-11-24 7:13 ` [PATCH] Input: smtpe-ts: better way of using of_property_read_u32() Viresh Kumar
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=1448348798-5950-1-git-send-email-saurabh.truth@gmail.com \
--to=saurabh.truth@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marex@denx.de \
--cc=viresh.kumar@linaro.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).