Skip to contentSkip to conversation

device property: make device_property functions take const device *

PATCH In review Guenter Roeck 4 participants 4 messages Apr 19, 2023 – Apr 20, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 device property: make device_property functions take const device *

device_property functions do not modify the device pointer passed to them. The underlying of_device and fwnode_ functions actually already take const * arguments. Mark the parameter constant to simplify conversion from of_property to device_property functions, and to let the calling code use const device pointers where possible.

---
Found by Chris when trying to convert a driver from of_property_ to device_property_ functions. I don't really see a reason why the device parameter to device_property functions should not be const. Please let me know if I am missing sonething.

 drivers/base/property.c  | 16 ++++++++--------
 include/linux/property.h | 36 ++++++++++++++++++------------------
 2 files changed, 26 insertions(+), 26 deletions(-)
drivers/base/property.c +8 -8
index 083a95791d3b..21d7a5d13e05 100644
@@ -38,7 +38,7 @@ EXPORT_SYMBOL_GPL(__dev_fwnode_const);
  *
  * Check if property @propname is present in the device firmware description.
  */
-bool device_property_present(struct device *dev, const char *propname)
+bool device_property_present(const struct device *dev, const char *propname)
 {
 	return fwnode_property_present(dev_fwnode(dev), propname);
 }
@@ -86,7 +86,7 @@ EXPORT_SYMBOL_GPL(fwnode_property_present);
  *	   %-EOVERFLOW if the size of the property is not as expected.
  *	   %-ENXIO if no suitable firmware interface is present.
  */
-int device_property_read_u8_array(struct device *dev, const char *propname,
+int device_property_read_u8_array(const struct device *dev, const char *propname,
 				  u8 *val, size_t nval)
 {
 	return fwnode_property_read_u8_array(dev_fwnode(dev), propname, val, nval);
@@ -114,7 +114,7 @@ EXPORT_SYMBOL_GPL(device_property_read_u8_array);
  *	   %-EOVERFLOW if the size of the property is not as expected.
  *	   %-ENXIO if no suitable firmware interface is present.
  */
-int device_property_read_u16_array(struct device *dev, const char *propname,
+int device_property_read_u16_array(const struct device *dev, const char *propname,
 				   u16 *val, size_t nval)
 {
 	return fwnode_property_read_u16_array(dev_fwnode(dev), propname, val, nval);
@@ -142,7 +142,7 @@ EXPORT_SYMBOL_GPL(device_property_read_u16_array);
  *	   %-EOVERFLOW if the size of the property is not as expected.
  *	   %-ENXIO if no suitable firmware interface is present.
  */
-int device_property_read_u32_array(struct device *dev, const char *propname,
+int device_property_read_u32_array(const struct device *dev, const char *propname,
 				   u32 *val, size_t nval)
 {
 	return fwnode_property_read_u32_array(dev_fwnode(dev), propname, val, nval);
@@ -170,7 +170,7 @@ EXPORT_SYMBOL_GPL(device_property_read_u32_array);
  *	   %-EOVERFLOW if the size of the property is not as expected.
  *	   %-ENXIO if no suitable firmware interface is present.
  */
-int device_property_read_u64_array(struct device *dev, const char *propname,
+int device_property_read_u64_array(const struct device *dev, const char *propname,
 				   u64 *val, size_t nval)
 {
 	return fwnode_property_read_u64_array(dev_fwnode(dev), propname, val, nval);
@@ -198,7 +198,7 @@ EXPORT_SYMBOL_GPL(device_property_read_u64_array);
  *	   %-EOVERFLOW if the size of the property is not as expected.
  *	   %-ENXIO if no suitable firmware interface is present.
  */
-int device_property_read_string_array(struct device *dev, const char *propname,
+int device_property_read_string_array(const struct device *dev, const char *propname,
 				      const char **val, size_t nval)
 {
 	return fwnode_property_read_string_array(dev_fwnode(dev), propname, val, nval);
@@ -220,7 +220,7 @@ EXPORT_SYMBOL_GPL(device_property_read_string_array);
  *	   %-EPROTO or %-EILSEQ if the property type is not a string.
  *	   %-ENXIO if no suitable firmware interface is present.
  */
-int device_property_read_string(struct device *dev, const char *propname,
+int device_property_read_string(const struct device *dev, const char *propname,
 				const char **val)
 {
 	return fwnode_property_read_string(dev_fwnode(dev), propname, val);
@@ -242,7 +242,7 @@ EXPORT_SYMBOL_GPL(device_property_read_string);
  *	   %-EPROTO if the property is not an array of strings,
  *	   %-ENXIO if no suitable firmware interface is present.
  */
-int device_property_match_string(struct device *dev, const char *propname,
+int device_property_match_string(const struct device *dev, const char *propname,
 				 const char *string)
 {
 	return fwnode_property_match_string(dev_fwnode(dev), propname, string);
include/linux/property.h +18 -18
index 0a29db15ff34..66fe73ee430d 100644
@@ -40,20 +40,20 @@ struct fwnode_handle *__dev_fwnode(struct device *dev);
 		 const struct device *: __dev_fwnode_const,	\
 		 struct device *: __dev_fwnode)(dev)
 
-bool device_property_present(struct device *dev, const char *propname);
-int device_property_read_u8_array(struct device *dev, const char *propname,
+bool device_property_present(const struct device *dev, const char *propname);
+int device_property_read_u8_array(const struct device *dev, const char *propname,
 				  u8 *val, size_t nval);
-int device_property_read_u16_array(struct device *dev, const char *propname,
+int device_property_read_u16_array(const struct device *dev, const char *propname,
 				   u16 *val, size_t nval);
-int device_property_read_u32_array(struct device *dev, const char *propname,
+int device_property_read_u32_array(const struct device *dev, const char *propname,
 				   u32 *val, size_t nval);
-int device_property_read_u64_array(struct device *dev, const char *propname,
+int device_property_read_u64_array(const struct device *dev, const char *propname,
 				   u64 *val, size_t nval);
-int device_property_read_string_array(struct device *dev, const char *propname,
+int device_property_read_string_array(const struct device *dev, const char *propname,
 				      const char **val, size_t nval);
-int device_property_read_string(struct device *dev, const char *propname,
+int device_property_read_string(const struct device *dev, const char *propname,
 				const char **val);
-int device_property_match_string(struct device *dev,
+int device_property_match_string(const struct device *dev,
 				 const char *propname, const char *string);
 
 bool fwnode_property_present(const struct fwnode_handle *fwnode,
@@ -143,57 +143,57 @@ int fwnode_irq_get_byname(const struct fwnode_handle *fwnode, const char *name);
 
 unsigned int device_get_child_node_count(const struct device *dev);
 
-static inline bool device_property_read_bool(struct device *dev,
+static inline bool device_property_read_bool(const struct device *dev,
 					     const char *propname)
 {
 	return device_property_present(dev, propname);
 }
 
-static inline int device_property_read_u8(struct device *dev,
+static inline int device_property_read_u8(const struct device *dev,
 					  const char *propname, u8 *val)
 {
 	return device_property_read_u8_array(dev, propname, val, 1);
 }
 
-static inline int device_property_read_u16(struct device *dev,
+static inline int device_property_read_u16(const struct device *dev,
 					   const char *propname, u16 *val)
 {
 	return device_property_read_u16_array(dev, propname, val, 1);
 }
 
-static inline int device_property_read_u32(struct device *dev,
+static inline int device_property_read_u32(const struct device *dev,
 					   const char *propname, u32 *val)
 {
 	return device_property_read_u32_array(dev, propname, val, 1);
 }
 
-static inline int device_property_read_u64(struct device *dev,
+static inline int device_property_read_u64(const struct device *dev,
 					   const char *propname, u64 *val)
 {
 	return device_property_read_u64_array(dev, propname, val, 1);
 }
 
-static inline int device_property_count_u8(struct device *dev, const char *propname)
+static inline int device_property_count_u8(const struct device *dev, const char *propname)
 {
 	return device_property_read_u8_array(dev, propname, NULL, 0);
 }
 
-static inline int device_property_count_u16(struct device *dev, const char *propname)
+static inline int device_property_count_u16(const struct device *dev, const char *propname)
 {
 	return device_property_read_u16_array(dev, propname, NULL, 0);
 }
 
-static inline int device_property_count_u32(struct device *dev, const char *propname)
+static inline int device_property_count_u32(const struct device *dev, const char *propname)
 {
 	return device_property_read_u32_array(dev, propname, NULL, 0);
 }
 
-static inline int device_property_count_u64(struct device *dev, const char *propname)
+static inline int device_property_count_u64(const struct device *dev, const char *propname)
 {
 	return device_property_read_u64_array(dev, propname, NULL, 0);
 }
 
-static inline int device_property_string_array_count(struct device *dev,
+static inline int device_property_string_array_count(const struct device *dev,
 						     const char *propname)
 {
 	return device_property_read_string_array(dev, propname, NULL, 0);
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw

Hi Guenter,

Quoted 8 lines · Guenter Roeck

device_property functions do not modify the device pointer passed to them. The underlying of_device and fwnode_ functions actually already take const * arguments. Mark the parameter constant to simplify conversion from of_property to device_property functions, and to let the calling code use const device pointers where possible.

Looks good to me. It eliminates the compiler warnings with my conversion patch.

For what it's worth

Quoted 187 lines

---
Found by Chris when trying to convert a driver from of_property_ to device_property_ functions. I don't really see a reason why the device parameter to device_property functions should not be const. Please let me know if I am missing sonething.

  drivers/base/property.c  | 16 ++++++++--------
  include/linux/property.h | 36 ++++++++++++++++++------------------
  2 files changed, 26 insertions(+), 26 deletions(-)
drivers/base/property.c +8 -8
index 083a95791d3b..21d7a5d13e05 100644
@@ -38,7 +38,7 @@ EXPORT_SYMBOL_GPL(__dev_fwnode_const);
   *
   * Check if property @propname is present in the device firmware description.
   */
-bool device_property_present(struct device *dev, const char *propname)
+bool device_property_present(const struct device *dev, const char *propname)
  {
  	return fwnode_property_present(dev_fwnode(dev), propname);
  }
@@ -86,7 +86,7 @@ EXPORT_SYMBOL_GPL(fwnode_property_present);
   *	   %-EOVERFLOW if the size of the property is not as expected.
   *	   %-ENXIO if no suitable firmware interface is present.
   */
-int device_property_read_u8_array(struct device *dev, const char *propname,
+int device_property_read_u8_array(const struct device *dev, const char *propname,
  				  u8 *val, size_t nval)
  {
  	return fwnode_property_read_u8_array(dev_fwnode(dev), propname, val, nval);
@@ -114,7 +114,7 @@ EXPORT_SYMBOL_GPL(device_property_read_u8_array);
   *	   %-EOVERFLOW if the size of the property is not as expected.
   *	   %-ENXIO if no suitable firmware interface is present.
   */
-int device_property_read_u16_array(struct device *dev, const char *propname,
+int device_property_read_u16_array(const struct device *dev, const char *propname,
  				   u16 *val, size_t nval)
  {
  	return fwnode_property_read_u16_array(dev_fwnode(dev), propname, val, nval);
@@ -142,7 +142,7 @@ EXPORT_SYMBOL_GPL(device_property_read_u16_array);
   *	   %-EOVERFLOW if the size of the property is not as expected.
   *	   %-ENXIO if no suitable firmware interface is present.
   */
-int device_property_read_u32_array(struct device *dev, const char *propname,
+int device_property_read_u32_array(const struct device *dev, const char *propname,
  				   u32 *val, size_t nval)
  {
  	return fwnode_property_read_u32_array(dev_fwnode(dev), propname, val, nval);
@@ -170,7 +170,7 @@ EXPORT_SYMBOL_GPL(device_property_read_u32_array);
   *	   %-EOVERFLOW if the size of the property is not as expected.
   *	   %-ENXIO if no suitable firmware interface is present.
   */
-int device_property_read_u64_array(struct device *dev, const char *propname,
+int device_property_read_u64_array(const struct device *dev, const char *propname,
  				   u64 *val, size_t nval)
  {
  	return fwnode_property_read_u64_array(dev_fwnode(dev), propname, val, nval);
@@ -198,7 +198,7 @@ EXPORT_SYMBOL_GPL(device_property_read_u64_array);
   *	   %-EOVERFLOW if the size of the property is not as expected.
   *	   %-ENXIO if no suitable firmware interface is present.
   */
-int device_property_read_string_array(struct device *dev, const char *propname,
+int device_property_read_string_array(const struct device *dev, const char *propname,
  				      const char **val, size_t nval)
  {
  	return fwnode_property_read_string_array(dev_fwnode(dev), propname, val, nval);
@@ -220,7 +220,7 @@ EXPORT_SYMBOL_GPL(device_property_read_string_array);
   *	   %-EPROTO or %-EILSEQ if the property type is not a string.
   *	   %-ENXIO if no suitable firmware interface is present.
   */
-int device_property_read_string(struct device *dev, const char *propname,
+int device_property_read_string(const struct device *dev, const char *propname,
  				const char **val)
  {
  	return fwnode_property_read_string(dev_fwnode(dev), propname, val);
@@ -242,7 +242,7 @@ EXPORT_SYMBOL_GPL(device_property_read_string);
   *	   %-EPROTO if the property is not an array of strings,
   *	   %-ENXIO if no suitable firmware interface is present.
   */
-int device_property_match_string(struct device *dev, const char *propname,
+int device_property_match_string(const struct device *dev, const char *propname,
  				 const char *string)
  {
  	return fwnode_property_match_string(dev_fwnode(dev), propname, string);
include/linux/property.h +18 -18
index 0a29db15ff34..66fe73ee430d 100644
@@ -40,20 +40,20 @@ struct fwnode_handle *__dev_fwnode(struct device *dev);
  		 const struct device *: __dev_fwnode_const,	\
  		 struct device *: __dev_fwnode)(dev)
 
-bool device_property_present(struct device *dev, const char *propname);
-int device_property_read_u8_array(struct device *dev, const char *propname,
+bool device_property_present(const struct device *dev, const char *propname);
+int device_property_read_u8_array(const struct device *dev, const char *propname,
  				  u8 *val, size_t nval);
-int device_property_read_u16_array(struct device *dev, const char *propname,
+int device_property_read_u16_array(const struct device *dev, const char *propname,
  				   u16 *val, size_t nval);
-int device_property_read_u32_array(struct device *dev, const char *propname,
+int device_property_read_u32_array(const struct device *dev, const char *propname,
  				   u32 *val, size_t nval);
-int device_property_read_u64_array(struct device *dev, const char *propname,
+int device_property_read_u64_array(const struct device *dev, const char *propname,
  				   u64 *val, size_t nval);
-int device_property_read_string_array(struct device *dev, const char *propname,
+int device_property_read_string_array(const struct device *dev, const char *propname,
  				      const char **val, size_t nval);
-int device_property_read_string(struct device *dev, const char *propname,
+int device_property_read_string(const struct device *dev, const char *propname,
  				const char **val);
-int device_property_match_string(struct device *dev,
+int device_property_match_string(const struct device *dev,
  				 const char *propname, const char *string);
 
  bool fwnode_property_present(const struct fwnode_handle *fwnode,
@@ -143,57 +143,57 @@ int fwnode_irq_get_byname(const struct fwnode_handle *fwnode, const char *name);
 
  unsigned int device_get_child_node_count(const struct device *dev);
 
-static inline bool device_property_read_bool(struct device *dev,
+static inline bool device_property_read_bool(const struct device *dev,
  					     const char *propname)
  {
  	return device_property_present(dev, propname);
  }
 
-static inline int device_property_read_u8(struct device *dev,
+static inline int device_property_read_u8(const struct device *dev,
  					  const char *propname, u8 *val)
  {
  	return device_property_read_u8_array(dev, propname, val, 1);
  }
 
-static inline int device_property_read_u16(struct device *dev,
+static inline int device_property_read_u16(const struct device *dev,
  					   const char *propname, u16 *val)
  {
  	return device_property_read_u16_array(dev, propname, val, 1);
  }
 
-static inline int device_property_read_u32(struct device *dev,
+static inline int device_property_read_u32(const struct device *dev,
  					   const char *propname, u32 *val)
  {
  	return device_property_read_u32_array(dev, propname, val, 1);
  }
 
-static inline int device_property_read_u64(struct device *dev,
+static inline int device_property_read_u64(const struct device *dev,
  					   const char *propname, u64 *val)
  {
  	return device_property_read_u64_array(dev, propname, val, 1);
  }
 
-static inline int device_property_count_u8(struct device *dev, const char *propname)
+static inline int device_property_count_u8(const struct device *dev, const char *propname)
  {
  	return device_property_read_u8_array(dev, propname, NULL, 0);
  }
 
-static inline int device_property_count_u16(struct device *dev, const char *propname)
+static inline int device_property_count_u16(const struct device *dev, const char *propname)
  {
  	return device_property_read_u16_array(dev, propname, NULL, 0);
  }
 
-static inline int device_property_count_u32(struct device *dev, const char *propname)
+static inline int device_property_count_u32(const struct device *dev, const char *propname)
  {
  	return device_property_read_u32_array(dev, propname, NULL, 0);
  }
 
-static inline int device_property_count_u64(struct device *dev, const char *propname)
+static inline int device_property_count_u64(const struct device *dev, const char *propname)
  {
  	return device_property_read_u64_array(dev, propname, NULL, 0);
  }
 
-static inline int device_property_string_array_count(struct device *dev,
+static inline int device_property_string_array_count(const struct device *dev,
  						     const char *propname)
  {
  	return device_property_read_string_array(dev, propname, NULL, 0);
reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Guenter Roeck
Quoted 6 lines · Guenter Roeck

device_property functions do not modify the device pointer passed to them. The underlying of_device and fwnode_ functions actually already take const * arguments. Mark the parameter constant to simplify conversion from of_property to device_property functions, and to let the calling code use const device pointers where possible.

Quoted 7 lines

---
Found by Chris when trying to convert a driver from of_property_ to device_property_ functions. I don't really see a reason why the device parameter to device_property functions should not be const. Please let me know if I am missing sonething.

Thanks!

Signature · 1 line
Sakari Ailus
maintainer Acked-by on v1 1/1
#3 lore raw
In reply to Guenter Roeck
Quoted 9 lines · Guenter Roeck

device_property functions do not modify the device pointer passed to them. The underlying of_device and fwnode_ functions actually already take const * arguments. Mark the parameter constant to simplify conversion from of_property to device_property functions, and to let the calling code use const device pointers where possible.

Quoted 190 lines

---
Found by Chris when trying to convert a driver from of_property_ to device_property_ functions. I don't really see a reason why the device parameter to device_property functions should not be const. Please let me know if I am missing sonething.

 drivers/base/property.c  | 16 ++++++++--------
 include/linux/property.h | 36 ++++++++++++++++++------------------
 2 files changed, 26 insertions(+), 26 deletions(-)
drivers/base/property.c +8 -8
index 083a95791d3b..21d7a5d13e05 100644
@@ -38,7 +38,7 @@ EXPORT_SYMBOL_GPL(__dev_fwnode_const);
  *
  * Check if property @propname is present in the device firmware description.
  */
-bool device_property_present(struct device *dev, const char *propname)
+bool device_property_present(const struct device *dev, const char *propname)
 {
        return fwnode_property_present(dev_fwnode(dev), propname);
 }
@@ -86,7 +86,7 @@ EXPORT_SYMBOL_GPL(fwnode_property_present);
  *        %-EOVERFLOW if the size of the property is not as expected.
  *        %-ENXIO if no suitable firmware interface is present.
  */
-int device_property_read_u8_array(struct device *dev, const char *propname,
+int device_property_read_u8_array(const struct device *dev, const char *propname,
                                  u8 *val, size_t nval)
 {
        return fwnode_property_read_u8_array(dev_fwnode(dev), propname, val, nval);
@@ -114,7 +114,7 @@ EXPORT_SYMBOL_GPL(device_property_read_u8_array);
  *        %-EOVERFLOW if the size of the property is not as expected.
  *        %-ENXIO if no suitable firmware interface is present.
  */
-int device_property_read_u16_array(struct device *dev, const char *propname,
+int device_property_read_u16_array(const struct device *dev, const char *propname,
                                   u16 *val, size_t nval)
 {
        return fwnode_property_read_u16_array(dev_fwnode(dev), propname, val, nval);
@@ -142,7 +142,7 @@ EXPORT_SYMBOL_GPL(device_property_read_u16_array);
  *        %-EOVERFLOW if the size of the property is not as expected.
  *        %-ENXIO if no suitable firmware interface is present.
  */
-int device_property_read_u32_array(struct device *dev, const char *propname,
+int device_property_read_u32_array(const struct device *dev, const char *propname,
                                   u32 *val, size_t nval)
 {
        return fwnode_property_read_u32_array(dev_fwnode(dev), propname, val, nval);
@@ -170,7 +170,7 @@ EXPORT_SYMBOL_GPL(device_property_read_u32_array);
  *        %-EOVERFLOW if the size of the property is not as expected.
  *        %-ENXIO if no suitable firmware interface is present.
  */
-int device_property_read_u64_array(struct device *dev, const char *propname,
+int device_property_read_u64_array(const struct device *dev, const char *propname,
                                   u64 *val, size_t nval)
 {
        return fwnode_property_read_u64_array(dev_fwnode(dev), propname, val, nval);
@@ -198,7 +198,7 @@ EXPORT_SYMBOL_GPL(device_property_read_u64_array);
  *        %-EOVERFLOW if the size of the property is not as expected.
  *        %-ENXIO if no suitable firmware interface is present.
  */
-int device_property_read_string_array(struct device *dev, const char *propname,
+int device_property_read_string_array(const struct device *dev, const char *propname,
                                      const char **val, size_t nval)
 {
        return fwnode_property_read_string_array(dev_fwnode(dev), propname, val, nval);
@@ -220,7 +220,7 @@ EXPORT_SYMBOL_GPL(device_property_read_string_array);
  *        %-EPROTO or %-EILSEQ if the property type is not a string.
  *        %-ENXIO if no suitable firmware interface is present.
  */
-int device_property_read_string(struct device *dev, const char *propname,
+int device_property_read_string(const struct device *dev, const char *propname,
                                const char **val)
 {
        return fwnode_property_read_string(dev_fwnode(dev), propname, val);
@@ -242,7 +242,7 @@ EXPORT_SYMBOL_GPL(device_property_read_string);
  *        %-EPROTO if the property is not an array of strings,
  *        %-ENXIO if no suitable firmware interface is present.
  */
-int device_property_match_string(struct device *dev, const char *propname,
+int device_property_match_string(const struct device *dev, const char *propname,
                                 const char *string)
 {
        return fwnode_property_match_string(dev_fwnode(dev), propname, string);
include/linux/property.h +18 -19
index 0a29db15ff34..66fe73ee430d 100644
@@ -40,20 +40,20 @@ struct fwnode_handle *__dev_fwnode(struct device *dev);
                 const struct device *: __dev_fwnode_const,     \
                 struct device *: __dev_fwnode)(dev)
 
-bool device_property_present(struct device *dev, const char *propname);
-int device_property_read_u8_array(struct device *dev, const char *propname,
+bool device_property_present(const struct device *dev, const char *propname);
+int device_property_read_u8_array(const struct device *dev, const char *propname,
                                  u8 *val, size_t nval);
-int device_property_read_u16_array(struct device *dev, const char *propname,
+int device_property_read_u16_array(const struct device *dev, const char *propname,
                                   u16 *val, size_t nval);
-int device_property_read_u32_array(struct device *dev, const char *propname,
+int device_property_read_u32_array(const struct device *dev, const char *propname,
                                   u32 *val, size_t nval);
-int device_property_read_u64_array(struct device *dev, const char *propname,
+int device_property_read_u64_array(const struct device *dev, const char *propname,
                                   u64 *val, size_t nval);
-int device_property_read_string_array(struct device *dev, const char *propname,
+int device_property_read_string_array(const struct device *dev, const char *propname,
                                      const char **val, size_t nval);
-int device_property_read_string(struct device *dev, const char *propname,
+int device_property_read_string(const struct device *dev, const char *propname,
                                const char **val);
-int device_property_match_string(struct device *dev,
+int device_property_match_string(const struct device *dev,
                                 const char *propname, const char *string);
 
 bool fwnode_property_present(const struct fwnode_handle *fwnode,
@@ -143,57 +143,57 @@ int fwnode_irq_get_byname(const struct fwnode_handle *fwnode, const char *name);
 
 unsigned int device_get_child_node_count(const struct device *dev);
 
-static inline bool device_property_read_bool(struct device *dev,
+static inline bool device_property_read_bool(const struct device *dev,
                                             const char *propname)
 {
        return device_property_present(dev, propname);
 }
 
-static inline int device_property_read_u8(struct device *dev,
+static inline int device_property_read_u8(const struct device *dev,
                                          const char *propname, u8 *val)
 {
        return device_property_read_u8_array(dev, propname, val, 1);
 }
 
-static inline int device_property_read_u16(struct device *dev,
+static inline int device_property_read_u16(const struct device *dev,
                                           const char *propname, u16 *val)
 {
        return device_property_read_u16_array(dev, propname, val, 1);
 }
 
-static inline int device_property_read_u32(struct device *dev,
+static inline int device_property_read_u32(const struct device *dev,
                                           const char *propname, u32 *val)
 {
        return device_property_read_u32_array(dev, propname, val, 1);
 }
 
-static inline int device_property_read_u64(struct device *dev,
+static inline int device_property_read_u64(const struct device *dev,
                                           const char *propname, u64 *val)
 {
        return device_property_read_u64_array(dev, propname, val, 1);
 }
 
-static inline int device_property_count_u8(struct device *dev, const char *propname)
+static inline int device_property_count_u8(const struct device *dev, const char *propname)
 {
        return device_property_read_u8_array(dev, propname, NULL, 0);
 }
 
-static inline int device_property_count_u16(struct device *dev, const char *propname)
+static inline int device_property_count_u16(const struct device *dev, const char *propname)
 {
        return device_property_read_u16_array(dev, propname, NULL, 0);
 }
 
-static inline int device_property_count_u32(struct device *dev, const char *propname)
+static inline int device_property_count_u32(const struct device *dev, const char *propname)
 {
        return device_property_read_u32_array(dev, propname, NULL, 0);
 }
 
-static inline int device_property_count_u64(struct device *dev, const char *propname)
+static inline int device_property_count_u64(const struct device *dev, const char *propname)
 {
        return device_property_read_u64_array(dev, propname, NULL, 0);
 }
 
-static inline int device_property_string_array_count(struct device *dev,
+static inline int device_property_string_array_count(const struct device *dev,
                                                     const char *propname)
 {
        return device_property_read_string_array(dev, propname, NULL, 0);
--

2.39.2