Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1276095 > unrolled thread
| Started by | Saurabh Sengar <saurabh.truth@gmail.com> |
|---|---|
| First post | 2015-11-24 08:10 +0100 |
| Last post | 2015-11-24 08:20 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] Input: smtpe-ts: better way of using of_property_read_u32() Saurabh Sengar <saurabh.truth@gmail.com> - 2015-11-24 08:10 +0100
Re: [PATCH] Input: smtpe-ts: better way of using of_property_read_u32() Viresh Kumar <viresh.kumar@linaro.org> - 2015-11-24 08:20 +0100
| From | Saurabh Sengar <saurabh.truth@gmail.com> |
|---|---|
| Date | 2015-11-24 08:10 +0100 |
| Subject | [PATCH] Input: smtpe-ts: better way of using of_property_read_u32() |
| Message-ID | <qyfTH-4UT-9@gated-at.bofh.it> |
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2015-11-24 08:20 +0100 |
| Subject | Re: [PATCH] Input: smtpe-ts: better way of using of_property_read_u32() |
| Message-ID | <qyg3o-4Yt-11@gated-at.bofh.it> |
| In reply to | #1276095 |
On 24-11-15, 12:36, Saurabh Sengar wrote:
> 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);
NAK.
You just broke it, all the pointers you passed were of type u8 *..
--
viresh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web