From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7998AC43461 for ; Tue, 8 Sep 2020 14:18:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 47FE7229CA for ; Tue, 8 Sep 2020 14:18:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729457AbgIHOSg (ORCPT ); Tue, 8 Sep 2020 10:18:36 -0400 Received: from mga03.intel.com ([134.134.136.65]:52435 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730051AbgIHOQX (ORCPT ); Tue, 8 Sep 2020 10:16:23 -0400 IronPort-SDR: 4m6ZvNCocenMRoQp8WfOK+J3M4llfpkdJcHUXw+YUzwdQasusrZ2QhaaXCXYNVhbPTyphi1E5p 8cq5DADRY8XQ== X-IronPort-AV: E=McAfee;i="6000,8403,9737"; a="158154397" X-IronPort-AV: E=Sophos;i="5.76,405,1592895600"; d="scan'208";a="158154397" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2020 06:49:22 -0700 IronPort-SDR: UVk6x/m63mBVyH71vbfcR5hvGtRm5fgnJc1bMd5sc6UCHlpDtyq2FjtjkWzPPhIvrQE0/YKY7m RrfJ1UHBvFgw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,405,1592895600"; d="scan'208";a="333478612" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga008.jf.intel.com with ESMTP; 08 Sep 2020 06:49:20 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1kFdxi-00FDZG-RE; Tue, 08 Sep 2020 16:47:06 +0300 Date: Tue, 8 Sep 2020 16:47:06 +0300 From: Andy Shevchenko To: Bartosz Golaszewski Cc: Linus Walleij , Mika Westerberg , Kent Gibson , Greg Kroah-Hartman , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Bartosz Golaszewski Subject: Re: [PATCH 1/3] device: property: add helpers to count items in string arrays Message-ID: <20200908134706.GZ1891694@smile.fi.intel.com> References: <20200908125813.8809-1-brgl@bgdev.pl> <20200908125813.8809-2-brgl@bgdev.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200908125813.8809-2-brgl@bgdev.pl> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 08, 2020 at 02:58:11PM +0200, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > 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 Thanks! > Suggested-by: Andy Shevchenko > Signed-off-by: Bartosz Golaszewski > --- > 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