Skip to content

Commit c916d6e

Browse files
andy-shevbroonie
authored andcommitted
regmap: Switch to use fwnode instead of OF one
Make regmap firmware node type agnostic by switching it to use fwnode. Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 31cf2c3 commit c916d6e

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

drivers/base/regmap/regmap.c

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <linux/export.h>
1212
#include <linux/mutex.h>
1313
#include <linux/err.h>
14-
#include <linux/of.h>
14+
#include <linux/property.h>
1515
#include <linux/rbtree.h>
1616
#include <linux/sched.h>
1717
#include <linux/delay.h>
@@ -631,7 +631,7 @@ enum regmap_endian regmap_get_val_endian(struct device *dev,
631631
const struct regmap_bus *bus,
632632
const struct regmap_config *config)
633633
{
634-
struct device_node *np;
634+
struct fwnode_handle *fwnode = dev ? dev_fwnode(dev) : NULL;
635635
enum regmap_endian endian;
636636

637637
/* Retrieve the endianness specification from the regmap config */
@@ -641,22 +641,17 @@ enum regmap_endian regmap_get_val_endian(struct device *dev,
641641
if (endian != REGMAP_ENDIAN_DEFAULT)
642642
return endian;
643643

644-
/* If the dev and dev->of_node exist try to get endianness from DT */
645-
if (dev && dev->of_node) {
646-
np = dev->of_node;
647-
648-
/* Parse the device's DT node for an endianness specification */
649-
if (of_property_read_bool(np, "big-endian"))
650-
endian = REGMAP_ENDIAN_BIG;
651-
else if (of_property_read_bool(np, "little-endian"))
652-
endian = REGMAP_ENDIAN_LITTLE;
653-
else if (of_property_read_bool(np, "native-endian"))
654-
endian = REGMAP_ENDIAN_NATIVE;
655-
656-
/* If the endianness was specified in DT, use that */
657-
if (endian != REGMAP_ENDIAN_DEFAULT)
658-
return endian;
659-
}
644+
/* If the firmware node exist try to get endianness from it */
645+
if (fwnode_property_read_bool(fwnode, "big-endian"))
646+
endian = REGMAP_ENDIAN_BIG;
647+
else if (fwnode_property_read_bool(fwnode, "little-endian"))
648+
endian = REGMAP_ENDIAN_LITTLE;
649+
else if (fwnode_property_read_bool(fwnode, "native-endian"))
650+
endian = REGMAP_ENDIAN_NATIVE;
651+
652+
/* If the endianness was specified in fwnode, use that */
653+
if (endian != REGMAP_ENDIAN_DEFAULT)
654+
return endian;
660655

661656
/* Retrieve the endianness specification from the bus config */
662657
if (bus && bus->val_format_endian_default)

0 commit comments

Comments
 (0)