diff options
author | Bartosz Golaszewski <bgolaszewski@baylibre.com> | 2020-09-09 10:54:24 +0200 |
---|---|---|
committer | Bartosz Golaszewski <bgolaszewski@baylibre.com> | 2020-09-14 10:53:43 +0200 |
commit | 6b6ff4acb310a0351005474673f1e09a90020efd (patch) | |
tree | ff0f2ee99dfe3988897fa86be2dc6501d0baecaa /include/linux/property.h | |
parent | 8d4a85b6abd3cd91234d1760c0dda780767d3b84 (diff) | |
download | linux-stable-6b6ff4acb310a0351005474673f1e09a90020efd.tar.gz linux-stable-6b6ff4acb310a0351005474673f1e09a90020efd.tar.bz2 linux-stable-6b6ff4acb310a0351005474673f1e09a90020efd.zip |
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>
Diffstat (limited to 'include/linux/property.h')
-rw-r--r-- | include/linux/property.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/property.h b/include/linux/property.h index 9f805c442819..75c178055bc9 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -170,6 +170,12 @@ static inline int device_property_count_u64(struct device *dev, const char *prop return device_property_read_u64_array(dev, propname, NULL, 0); } +static inline int device_property_string_array_count(struct device *dev, + const char *propname) +{ + return device_property_read_string_array(dev, propname, NULL, 0); +} + static inline bool fwnode_property_read_bool(const struct fwnode_handle *fwnode, const char *propname) { @@ -224,6 +230,13 @@ static inline int fwnode_property_count_u64(const struct fwnode_handle *fwnode, return fwnode_property_read_u64_array(fwnode, propname, NULL, 0); } +static inline int +fwnode_property_string_array_count(const struct fwnode_handle *fwnode, + const char *propname) +{ + return fwnode_property_read_string_array(fwnode, propname, NULL, 0); +} + struct software_node; /** |