mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Kent Gibson <warthog618@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-acpi@vger.kernel.org,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>
Subject: Re: [PATCH 1/3] device: property: add helpers to count items in string arrays
Date: Tue, 8 Sep 2020 16:47:06 +0300	[thread overview]
Message-ID: <20200908134706.GZ1891694@smile.fi.intel.com> (raw)
In-Reply-To: <20200908125813.8809-2-brgl@bgdev.pl>

On Tue, Sep 08, 2020 at 02:58:11PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> 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.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thanks!

> Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>  include/linux/property.h | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/include/linux/property.h b/include/linux/property.h
> index 9f805c442819..1fa5e250a8ea 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_count_strings(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_count_strings(const struct fwnode_handle *fwnode,
> +			      const char *propname)
> +{
> +	return fwnode_property_read_string_array(fwnode, propname, NULL, 0);
> +}
> +
>  struct software_node;
>  
>  /**
> -- 
> 2.26.1
> 

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2020-09-08 14:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-08 12:58 [PATCH 0/3] gpiolib: generalize GPIO line names property Bartosz Golaszewski
2020-09-08 12:58 ` [PATCH 1/3] device: property: add helpers to count items in string arrays Bartosz Golaszewski
2020-09-08 13:47   ` Andy Shevchenko [this message]
2020-09-08 12:58 ` [PATCH 2/3] gpiolib: generalize devprop_gpiochip_set_names() for device properties Bartosz Golaszewski
2020-09-08 12:58 ` [PATCH 3/3] gpiolib: unexport devprop_gpiochip_set_names() Bartosz Golaszewski
2020-09-08 13:49   ` Andy Shevchenko
2020-09-08 14:01     ` Bartosz Golaszewski
2020-09-15 12:01 ` [PATCH 0/3] gpiolib: generalize GPIO line names property Anders Roxell
2020-09-15 13:12   ` Andy Shevchenko
2020-09-15 13:16     ` Bartosz Golaszewski
2020-09-15 15:16       ` Andy Shevchenko
2020-09-15 13:16     ` Andy Shevchenko
2020-09-15 16:03       ` Bartosz Golaszewski
2020-09-16 13:29   ` Bartosz Golaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200908134706.GZ1891694@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=brgl@bgdev.pl \
    --cc=gregkh@linuxfoundation.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=warthog618@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®