From: Rob Herring <robh@kernel.org>
To: Eric Piel <eric.piel@tremplin-utc.net>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] misc: lis3lv02d: Use of_property_read_bool() for boolean properties
Date: Fri, 10 Mar 2023 08:47:13 -0600 [thread overview]
Message-ID: <20230310144713.1543683-1-robh@kernel.org> (raw)
It is preferred to use typed property access functions (i.e.
of_property_read_<type> functions) rather than low-level
of_get_property/of_find_property functions for reading properties.
Convert reading boolean properties to to of_property_read_bool().
Signed-off-by: Rob Herring <robh@kernel.org>
---
drivers/misc/lis3lv02d/lis3lv02d.c | 64 +++++++++++++++---------------
1 file changed, 32 insertions(+), 32 deletions(-)
diff --git a/drivers/misc/lis3lv02d/lis3lv02d.c b/drivers/misc/lis3lv02d/lis3lv02d.c
index efed515d7b50..299d316f1bda 100644
--- a/drivers/misc/lis3lv02d/lis3lv02d.c
+++ b/drivers/misc/lis3lv02d/lis3lv02d.c
@@ -965,19 +965,19 @@ int lis3lv02d_init_dt(struct lis3lv02d *lis3)
if (!pdata)
return -ENOMEM;
- if (of_get_property(np, "st,click-single-x", NULL))
+ if (of_property_read_bool(np, "st,click-single-x"))
pdata->click_flags |= LIS3_CLICK_SINGLE_X;
- if (of_get_property(np, "st,click-double-x", NULL))
+ if (of_property_read_bool(np, "st,click-double-x"))
pdata->click_flags |= LIS3_CLICK_DOUBLE_X;
- if (of_get_property(np, "st,click-single-y", NULL))
+ if (of_property_read_bool(np, "st,click-single-y"))
pdata->click_flags |= LIS3_CLICK_SINGLE_Y;
- if (of_get_property(np, "st,click-double-y", NULL))
+ if (of_property_read_bool(np, "st,click-double-y"))
pdata->click_flags |= LIS3_CLICK_DOUBLE_Y;
- if (of_get_property(np, "st,click-single-z", NULL))
+ if (of_property_read_bool(np, "st,click-single-z"))
pdata->click_flags |= LIS3_CLICK_SINGLE_Z;
- if (of_get_property(np, "st,click-double-z", NULL))
+ if (of_property_read_bool(np, "st,click-double-z"))
pdata->click_flags |= LIS3_CLICK_DOUBLE_Z;
if (!of_property_read_u32(np, "st,click-threshold-x", &val))
@@ -994,31 +994,31 @@ int lis3lv02d_init_dt(struct lis3lv02d *lis3)
if (!of_property_read_u32(np, "st,click-window", &val))
pdata->click_window = val;
- if (of_get_property(np, "st,irq1-disable", NULL))
+ if (of_property_read_bool(np, "st,irq1-disable"))
pdata->irq_cfg |= LIS3_IRQ1_DISABLE;
- if (of_get_property(np, "st,irq1-ff-wu-1", NULL))
+ if (of_property_read_bool(np, "st,irq1-ff-wu-1"))
pdata->irq_cfg |= LIS3_IRQ1_FF_WU_1;
- if (of_get_property(np, "st,irq1-ff-wu-2", NULL))
+ if (of_property_read_bool(np, "st,irq1-ff-wu-2"))
pdata->irq_cfg |= LIS3_IRQ1_FF_WU_2;
- if (of_get_property(np, "st,irq1-data-ready", NULL))
+ if (of_property_read_bool(np, "st,irq1-data-ready"))
pdata->irq_cfg |= LIS3_IRQ1_DATA_READY;
- if (of_get_property(np, "st,irq1-click", NULL))
+ if (of_property_read_bool(np, "st,irq1-click"))
pdata->irq_cfg |= LIS3_IRQ1_CLICK;
- if (of_get_property(np, "st,irq2-disable", NULL))
+ if (of_property_read_bool(np, "st,irq2-disable"))
pdata->irq_cfg |= LIS3_IRQ2_DISABLE;
- if (of_get_property(np, "st,irq2-ff-wu-1", NULL))
+ if (of_property_read_bool(np, "st,irq2-ff-wu-1"))
pdata->irq_cfg |= LIS3_IRQ2_FF_WU_1;
- if (of_get_property(np, "st,irq2-ff-wu-2", NULL))
+ if (of_property_read_bool(np, "st,irq2-ff-wu-2"))
pdata->irq_cfg |= LIS3_IRQ2_FF_WU_2;
- if (of_get_property(np, "st,irq2-data-ready", NULL))
+ if (of_property_read_bool(np, "st,irq2-data-ready"))
pdata->irq_cfg |= LIS3_IRQ2_DATA_READY;
- if (of_get_property(np, "st,irq2-click", NULL))
+ if (of_property_read_bool(np, "st,irq2-click"))
pdata->irq_cfg |= LIS3_IRQ2_CLICK;
- if (of_get_property(np, "st,irq-open-drain", NULL))
+ if (of_property_read_bool(np, "st,irq-open-drain"))
pdata->irq_cfg |= LIS3_IRQ_OPEN_DRAIN;
- if (of_get_property(np, "st,irq-active-low", NULL))
+ if (of_property_read_bool(np, "st,irq-active-low"))
pdata->irq_cfg |= LIS3_IRQ_ACTIVE_LOW;
if (!of_property_read_u32(np, "st,wu-duration-1", &val))
@@ -1026,32 +1026,32 @@ int lis3lv02d_init_dt(struct lis3lv02d *lis3)
if (!of_property_read_u32(np, "st,wu-duration-2", &val))
pdata->duration2 = val;
- if (of_get_property(np, "st,wakeup-x-lo", NULL))
+ if (of_property_read_bool(np, "st,wakeup-x-lo"))
pdata->wakeup_flags |= LIS3_WAKEUP_X_LO;
- if (of_get_property(np, "st,wakeup-x-hi", NULL))
+ if (of_property_read_bool(np, "st,wakeup-x-hi"))
pdata->wakeup_flags |= LIS3_WAKEUP_X_HI;
- if (of_get_property(np, "st,wakeup-y-lo", NULL))
+ if (of_property_read_bool(np, "st,wakeup-y-lo"))
pdata->wakeup_flags |= LIS3_WAKEUP_Y_LO;
- if (of_get_property(np, "st,wakeup-y-hi", NULL))
+ if (of_property_read_bool(np, "st,wakeup-y-hi"))
pdata->wakeup_flags |= LIS3_WAKEUP_Y_HI;
- if (of_get_property(np, "st,wakeup-z-lo", NULL))
+ if (of_property_read_bool(np, "st,wakeup-z-lo"))
pdata->wakeup_flags |= LIS3_WAKEUP_Z_LO;
- if (of_get_property(np, "st,wakeup-z-hi", NULL))
+ if (of_property_read_bool(np, "st,wakeup-z-hi"))
pdata->wakeup_flags |= LIS3_WAKEUP_Z_HI;
if (of_get_property(np, "st,wakeup-threshold", &val))
pdata->wakeup_thresh = val;
- if (of_get_property(np, "st,wakeup2-x-lo", NULL))
+ if (of_property_read_bool(np, "st,wakeup2-x-lo"))
pdata->wakeup_flags2 |= LIS3_WAKEUP_X_LO;
- if (of_get_property(np, "st,wakeup2-x-hi", NULL))
+ if (of_property_read_bool(np, "st,wakeup2-x-hi"))
pdata->wakeup_flags2 |= LIS3_WAKEUP_X_HI;
- if (of_get_property(np, "st,wakeup2-y-lo", NULL))
+ if (of_property_read_bool(np, "st,wakeup2-y-lo"))
pdata->wakeup_flags2 |= LIS3_WAKEUP_Y_LO;
- if (of_get_property(np, "st,wakeup2-y-hi", NULL))
+ if (of_property_read_bool(np, "st,wakeup2-y-hi"))
pdata->wakeup_flags2 |= LIS3_WAKEUP_Y_HI;
- if (of_get_property(np, "st,wakeup2-z-lo", NULL))
+ if (of_property_read_bool(np, "st,wakeup2-z-lo"))
pdata->wakeup_flags2 |= LIS3_WAKEUP_Z_LO;
- if (of_get_property(np, "st,wakeup2-z-hi", NULL))
+ if (of_property_read_bool(np, "st,wakeup2-z-hi"))
pdata->wakeup_flags2 |= LIS3_WAKEUP_Z_HI;
if (of_get_property(np, "st,wakeup2-threshold", &val))
pdata->wakeup_thresh2 = val;
@@ -1073,9 +1073,9 @@ int lis3lv02d_init_dt(struct lis3lv02d *lis3)
}
}
- if (of_get_property(np, "st,hipass1-disable", NULL))
+ if (of_property_read_bool(np, "st,hipass1-disable"))
pdata->hipass_ctrl |= LIS3_HIPASS1_DISABLE;
- if (of_get_property(np, "st,hipass2-disable", NULL))
+ if (of_property_read_bool(np, "st,hipass2-disable"))
pdata->hipass_ctrl |= LIS3_HIPASS2_DISABLE;
if (of_property_read_s32(np, "st,axis-x", &sval) == 0)
--
2.39.2
next reply other threads:[~2023-03-10 14:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-10 14:47 Rob Herring [this message]
2023-03-11 10:01 ` [PATCH] misc: lis3lv02d: Use of_property_read_bool() for boolean properties Arnd Bergmann
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=20230310144713.1543683-1-robh@kernel.org \
--to=robh@kernel.org \
--cc=arnd@arndb.de \
--cc=devicetree@vger.kernel.org \
--cc=eric.piel@tremplin-utc.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@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