11
11
#include <linux/export.h>
12
12
#include <linux/mutex.h>
13
13
#include <linux/err.h>
14
- #include <linux/of .h>
14
+ #include <linux/property .h>
15
15
#include <linux/rbtree.h>
16
16
#include <linux/sched.h>
17
17
#include <linux/delay.h>
@@ -631,7 +631,7 @@ enum regmap_endian regmap_get_val_endian(struct device *dev,
631
631
const struct regmap_bus * bus ,
632
632
const struct regmap_config * config )
633
633
{
634
- struct device_node * np ;
634
+ struct fwnode_handle * fwnode = dev ? dev_fwnode ( dev ) : NULL ;
635
635
enum regmap_endian endian ;
636
636
637
637
/* Retrieve the endianness specification from the regmap config */
@@ -641,22 +641,17 @@ enum regmap_endian regmap_get_val_endian(struct device *dev,
641
641
if (endian != REGMAP_ENDIAN_DEFAULT )
642
642
return endian ;
643
643
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 ;
660
655
661
656
/* Retrieve the endianness specification from the bus config */
662
657
if (bus && bus -> val_format_endian_default )
0 commit comments