Skip to content

Commit 6b6ff4a

Browse files
committed
device: property: add helpers to count items in string arrays
Instead of doing the following: count = device_property_read_string_array(dev, propname, NULL, 0); Let's provide inline helpers with hardcoded arguments for counting strings in property arrays. Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
1 parent 8d4a85b commit 6b6ff4a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

include/linux/property.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@ static inline int device_property_count_u64(struct device *dev, const char *prop
170170
return device_property_read_u64_array(dev, propname, NULL, 0);
171171
}
172172

173+
static inline int device_property_string_array_count(struct device *dev,
174+
const char *propname)
175+
{
176+
return device_property_read_string_array(dev, propname, NULL, 0);
177+
}
178+
173179
static inline bool fwnode_property_read_bool(const struct fwnode_handle *fwnode,
174180
const char *propname)
175181
{
@@ -224,6 +230,13 @@ static inline int fwnode_property_count_u64(const struct fwnode_handle *fwnode,
224230
return fwnode_property_read_u64_array(fwnode, propname, NULL, 0);
225231
}
226232

233+
static inline int
234+
fwnode_property_string_array_count(const struct fwnode_handle *fwnode,
235+
const char *propname)
236+
{
237+
return fwnode_property_read_string_array(fwnode, propname, NULL, 0);
238+
}
239+
227240
struct software_node;
228241

229242
/**

0 commit comments

Comments
 (0)