[PATCH] sbus: display7seg: Use of_property_read_bool() for boolean properties

From: Rob Herring
Date: Fri Mar 10 2023 - 10:01:17 EST


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@xxxxxxxxxx>
---
drivers/sbus/char/display7seg.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c
index d93595b39afa..8bee31f03126 100644
--- a/drivers/sbus/char/display7seg.c
+++ b/drivers/sbus/char/display7seg.c
@@ -31,8 +31,8 @@ static int sol_compat = 0; /* Solaris compatibility mode */

/* Solaris compatibility flag -
* The Solaris implementation omits support for several
- * documented driver features (ref Sun doc 806-0180-03).
- * By default, this module supports the documented driver
+ * documented driver features (ref Sun doc 806-0180-03).
+ * By default, this module supports the documented driver
* abilities, rather than the Solaris implementation:
*
* 1) Device ALWAYS reverts to OBP-specified FLIPPED mode
@@ -44,7 +44,7 @@ static int sol_compat = 0; /* Solaris compatibility mode */
* omitting above features, set this parameter to non-zero.
*/
module_param(sol_compat, int, 0);
-MODULE_PARM_DESC(sol_compat,
+MODULE_PARM_DESC(sol_compat,
"Disables documented functionality omitted from Solaris driver");

MODULE_AUTHOR("Eric Brower <ebrower@xxxxxxx>");
@@ -63,7 +63,7 @@ struct d7s *d7s_device;
* | DP | ALARM | FLIP | 4 | 3 | 2 | 1 | 0 |
* -----------------------------------------
*
- * DP - Toggles decimal point on/off
+ * DP - Toggles decimal point on/off
* ALARM - Toggles "Alarm" LED green/red
* FLIP - Inverts display for upside-down mounted board
* bits 0-4 - 7-segment display contents
@@ -200,9 +200,8 @@ static int d7s_probe(struct platform_device *op)
*/
regs = readb(p->regs);
opts = of_find_node_by_path("/options");
- if (opts &&
- of_get_property(opts, "d7s-flipped?", NULL))
- p->flipped = true;
+ if (opts)
+ p->flipped = of_property_read_bool(opts, "d7s-flipped?");

if (p->flipped)
regs |= D7S_FLIP;
--
2.39.2