From patchwork Wed Feb 10 11:43:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 380285 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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 C2CC5C433E0 for ; Wed, 10 Feb 2021 11:48:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6384264E40 for ; Wed, 10 Feb 2021 11:48:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230347AbhBJLru (ORCPT ); Wed, 10 Feb 2021 06:47:50 -0500 Received: from mga02.intel.com ([134.134.136.20]:64421 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230155AbhBJLpl (ORCPT ); Wed, 10 Feb 2021 06:45:41 -0500 IronPort-SDR: 1aYOGg/K/Ex3vHeDXzuozZwtk0JrzUZ3DruK0+HDrJMI/2jMRN6jgqdro7iGV/Fd7soMmUf3UH CLQGztS5vZ2Q== X-IronPort-AV: E=McAfee;i="6000,8403,9890"; a="169181910" X-IronPort-AV: E=Sophos;i="5.81,168,1610438400"; d="scan'208";a="169181910" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2021 03:43:34 -0800 IronPort-SDR: hzriPaiTvPDGjGnUl4bRhI8m1Oq29jgVSXM808k8fIuX9gZl2HzVVE3fPWbJySWVkUlDIoLVVf qWJSOYZ4hv7A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,168,1610438400"; d="scan'208";a="488729857" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 10 Feb 2021 03:43:33 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 35C32DE; Wed, 10 Feb 2021 13:43:31 +0200 (EET) From: Andy Shevchenko To: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Len Brown , Andy Shevchenko Subject: [PATCH v1 1/7] ACPI: property: Remove dead code Date: Wed, 10 Feb 2021 13:43:14 +0200 Message-Id: <20210210114320.3478-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org After the commit 3a7a2ab839ad couple of functions became a dead code. Moreover, for all these years nobody used them. Remove. Fixes: 3a7a2ab839ad ("ACPI / property: Extend fwnode_property_* to data-only subnodes") Signed-off-by: Andy Shevchenko --- drivers/acpi/property.c | 20 -------------------- include/linux/acpi.h | 21 --------------------- 2 files changed, 41 deletions(-) diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index 24e87b630573..d9f3132466b5 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -829,20 +829,6 @@ static int acpi_data_prop_read_single(const struct acpi_device_data *data, return ret; } -int acpi_dev_prop_read_single(struct acpi_device *adev, const char *propname, - enum dev_prop_type proptype, void *val) -{ - int ret; - - if (!adev) - return -EINVAL; - - ret = acpi_data_prop_read_single(&adev->data, propname, proptype, val); - if (ret < 0 || proptype != ACPI_TYPE_STRING) - return ret; - return 0; -} - static int acpi_copy_property_array_u8(const union acpi_object *items, u8 *val, size_t nval) { @@ -973,12 +959,6 @@ static int acpi_data_prop_read(const struct acpi_device_data *data, return ret; } -int acpi_dev_prop_read(const struct acpi_device *adev, const char *propname, - enum dev_prop_type proptype, void *val, size_t nval) -{ - return adev ? acpi_data_prop_read(&adev->data, propname, proptype, val, nval) : -EINVAL; -} - /** * acpi_node_prop_read - retrieve the value of an ACPI property with given name. * @fwnode: Firmware node to get the property from. diff --git a/include/linux/acpi.h b/include/linux/acpi.h index ea296289a94c..14ac25165ae1 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -1121,14 +1121,9 @@ acpi_data_add_props(struct acpi_device_data *data, const guid_t *guid, int acpi_node_prop_get(const struct fwnode_handle *fwnode, const char *propname, void **valptr); -int acpi_dev_prop_read_single(struct acpi_device *adev, - const char *propname, enum dev_prop_type proptype, - void *val); int acpi_node_prop_read(const struct fwnode_handle *fwnode, const char *propname, enum dev_prop_type proptype, void *val, size_t nval); -int acpi_dev_prop_read(const struct acpi_device *adev, const char *propname, - enum dev_prop_type proptype, void *val, size_t nval); struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode, struct fwnode_handle *child); @@ -1230,14 +1225,6 @@ static inline int acpi_node_prop_get(const struct fwnode_handle *fwnode, return -ENXIO; } -static inline int acpi_dev_prop_read_single(const struct acpi_device *adev, - const char *propname, - enum dev_prop_type proptype, - void *val) -{ - return -ENXIO; -} - static inline int acpi_node_prop_read(const struct fwnode_handle *fwnode, const char *propname, enum dev_prop_type proptype, @@ -1246,14 +1233,6 @@ static inline int acpi_node_prop_read(const struct fwnode_handle *fwnode, return -ENXIO; } -static inline int acpi_dev_prop_read(const struct acpi_device *adev, - const char *propname, - enum dev_prop_type proptype, - void *val, size_t nval) -{ - return -ENXIO; -} - static inline struct fwnode_handle * acpi_get_next_subnode(const struct fwnode_handle *fwnode, struct fwnode_handle *child) From patchwork Wed Feb 10 11:43:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 381111 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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 E9533C433DB for ; Wed, 10 Feb 2021 11:48:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8E05F64E57 for ; Wed, 10 Feb 2021 11:48:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229651AbhBJLry (ORCPT ); Wed, 10 Feb 2021 06:47:54 -0500 Received: from mga09.intel.com ([134.134.136.24]:33771 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230328AbhBJLpk (ORCPT ); Wed, 10 Feb 2021 06:45:40 -0500 IronPort-SDR: OCJ4FrDaBJwLu/MAgh0WNGKfTO9k4FyPBMHBfLJuGMCHzGY6DZR5p26oGeKj4RwXJHIz1EYdLG i6Ee2wWZxnSg== X-IronPort-AV: E=McAfee;i="6000,8403,9890"; a="182197777" X-IronPort-AV: E=Sophos;i="5.81,168,1610438400"; d="scan'208";a="182197777" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2021 03:43:35 -0800 IronPort-SDR: NXMVZ80IcihnIlKnMWebkJkjEfI81rjTJNeIvg6l8MUTQDpS+93mPgj164SqQgqNNhqrxW+y75 srvjGFX5q+0A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,168,1610438400"; d="scan'208";a="380026988" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 10 Feb 2021 03:43:33 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 45FE66B; Wed, 10 Feb 2021 13:43:32 +0200 (EET) From: Andy Shevchenko To: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Len Brown , Andy Shevchenko Subject: [PATCH v1 2/7] ACPI: property: Make acpi_node_prop_read() static Date: Wed, 10 Feb 2021 13:43:15 +0200 Message-Id: <20210210114320.3478-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210210114320.3478-1-andriy.shevchenko@linux.intel.com> References: <20210210114320.3478-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org There is no users outside of property.c. No need to export acpi_node_prop_read(), hence make it static. Fixes: 3708184afc77 ("device property: Move FW type specific functionality to FW specific files") Signed-off-by: Andy Shevchenko --- drivers/acpi/property.c | 6 +++--- include/linux/acpi.h | 11 ----------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index d9f3132466b5..9304c88ce446 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -971,9 +971,9 @@ static int acpi_data_prop_read(const struct acpi_device_data *data, * of the property. Otherwise, read at most @nval values to the array at the * location pointed to by @val. */ -int acpi_node_prop_read(const struct fwnode_handle *fwnode, - const char *propname, enum dev_prop_type proptype, - void *val, size_t nval) +static int acpi_node_prop_read(const struct fwnode_handle *fwnode, + const char *propname, enum dev_prop_type proptype, + void *val, size_t nval) { return acpi_data_prop_read(acpi_device_data_of_node(fwnode), propname, proptype, val, nval); diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 14ac25165ae1..3c5757d539ab 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -1121,9 +1121,6 @@ acpi_data_add_props(struct acpi_device_data *data, const guid_t *guid, int acpi_node_prop_get(const struct fwnode_handle *fwnode, const char *propname, void **valptr); -int acpi_node_prop_read(const struct fwnode_handle *fwnode, - const char *propname, enum dev_prop_type proptype, - void *val, size_t nval); struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode, struct fwnode_handle *child); @@ -1225,14 +1222,6 @@ static inline int acpi_node_prop_get(const struct fwnode_handle *fwnode, return -ENXIO; } -static inline int acpi_node_prop_read(const struct fwnode_handle *fwnode, - const char *propname, - enum dev_prop_type proptype, - void *val, size_t nval) -{ - return -ENXIO; -} - static inline struct fwnode_handle * acpi_get_next_subnode(const struct fwnode_handle *fwnode, struct fwnode_handle *child) From patchwork Wed Feb 10 11:43:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 380282 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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 01803C433E9 for ; Wed, 10 Feb 2021 11:51:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BB4A764DE3 for ; Wed, 10 Feb 2021 11:51:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231310AbhBJLvW (ORCPT ); Wed, 10 Feb 2021 06:51:22 -0500 Received: from mga07.intel.com ([134.134.136.100]:24123 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231253AbhBJLtB (ORCPT ); Wed, 10 Feb 2021 06:49:01 -0500 IronPort-SDR: QUd48rqjBXst2QXEx5j2x77Aq/JLO9/ONQ+zw+Q6S6Mcl9RVqgfsQ6m9JaxpigZjLY10hjE/jA 9+H/HLykmswA== X-IronPort-AV: E=McAfee;i="6000,8403,9890"; a="246122909" X-IronPort-AV: E=Sophos;i="5.81,168,1610438400"; d="scan'208";a="246122909" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2021 03:43:34 -0800 IronPort-SDR: fmT3ddd9slATGK1BkhnsvO+nHZRfHFKqO2xUDALiZdOuFbK0gsZ+3lhpZD5IGXTFyoRI9uF3rY qynayBIBqBgQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,168,1610438400"; d="scan'208";a="396674874" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 10 Feb 2021 03:43:33 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 4EF4A2BE; Wed, 10 Feb 2021 13:43:32 +0200 (EET) From: Andy Shevchenko To: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Len Brown , Andy Shevchenko Subject: [PATCH v1 3/7] ACPI: property: Satisfy kernel doc validator (part 1) Date: Wed, 10 Feb 2021 13:43:16 +0200 Message-Id: <20210210114320.3478-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210210114320.3478-1-andriy.shevchenko@linux.intel.com> References: <20210210114320.3478-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org CHECK drivers/acpi/property.c warning: Function parameter or member 'data' not described in 'acpi_data_get_property_array' warning: Excess function parameter 'adev' description in 'acpi_data_get_property_array' Fixes: 3a7a2ab839ad ("ACPI / property: Extend fwnode_property_* to data-only subnodes") Signed-off-by: Andy Shevchenko --- drivers/acpi/property.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index 9304c88ce446..a6b096575fc8 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -564,7 +564,7 @@ int acpi_node_prop_get(const struct fwnode_handle *fwnode, /** * acpi_data_get_property_array - return an ACPI array property with given name - * @adev: ACPI data object to get the property from + * @data: ACPI data object to get the property from * @name: Name of the property * @type: Expected type of array elements * @obj: Location to store a pointer to the property value (if not NULL) From patchwork Wed Feb 10 11:43:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 381112 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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 2672BC433DB for ; Wed, 10 Feb 2021 11:47:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B419D64E3B for ; Wed, 10 Feb 2021 11:47:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230213AbhBJLrt (ORCPT ); Wed, 10 Feb 2021 06:47:49 -0500 Received: from mga07.intel.com ([134.134.136.100]:24123 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230161AbhBJLpl (ORCPT ); Wed, 10 Feb 2021 06:45:41 -0500 IronPort-SDR: EKCXni8O5E4v4lFPfjAvwo8zyr922PfGLUXCGXxWxlGkuav/eFKW1IYvwezpB+xWTfHsvbC8yp Keh+ZL2yd/lw== X-IronPort-AV: E=McAfee;i="6000,8403,9890"; a="246122912" X-IronPort-AV: E=Sophos;i="5.81,168,1610438400"; d="scan'208";a="246122912" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2021 03:43:34 -0800 IronPort-SDR: Lc9PJZFDPYuC33GHRYjdu45H7Dxod7Lgb3mXlP+SgqcGO69J3AxZjp6z1CeS2tkEUDl8FlzEAV IZtFVVD/DOXQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,168,1610438400"; d="scan'208";a="399136329" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 10 Feb 2021 03:43:33 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 579CE35A; Wed, 10 Feb 2021 13:43:32 +0200 (EET) From: Andy Shevchenko To: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Len Brown , Andy Shevchenko Subject: [PATCH v1 4/7] ACPI: property: Satisfy kernel doc validator (part 2) Date: Wed, 10 Feb 2021 13:43:17 +0200 Message-Id: <20210210114320.3478-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210210114320.3478-1-andriy.shevchenko@linux.intel.com> References: <20210210114320.3478-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org CHECK drivers/acpi/property.c warning: Function parameter or member '__fwnode' not described in 'acpi_graph_get_remote_endpoint' warning: Excess function parameter 'fwnode' description in 'acpi_graph_get_remote_endpoint' warning: Excess function parameter 'endpoint' description in 'acpi_graph_get_remote_endpoint' Fixes: 0ef7478639c5 ("ACPI: property: Make the ACPI graph API private") Signed-off-by: Andy Shevchenko --- drivers/acpi/property.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index a6b096575fc8..167338fe9b04 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -1190,8 +1190,7 @@ static struct fwnode_handle *acpi_graph_get_child_prop_value( /** * acpi_graph_get_remote_endpoint - Parses and returns remote end of an endpoint - * @fwnode: Endpoint firmware node pointing to a remote device - * @endpoint: Firmware node of remote endpoint is filled here if not %NULL + * @__fwnode: Endpoint firmware node pointing to a remote device * * Returns the remote endpoint corresponding to @__fwnode. NULL on error. */ From patchwork Wed Feb 10 11:43:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 381110 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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 14367C433E6 for ; Wed, 10 Feb 2021 11:48:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BC67864E58 for ; Wed, 10 Feb 2021 11:48:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230245AbhBJLr5 (ORCPT ); Wed, 10 Feb 2021 06:47:57 -0500 Received: from mga02.intel.com ([134.134.136.20]:64430 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230388AbhBJLpk (ORCPT ); Wed, 10 Feb 2021 06:45:40 -0500 IronPort-SDR: wSheto1sOsf4cVLgtdomFFgtfAe3a8Tg6kX3ts0pqY0nNi6j5Ip5Ivlyg4sEE4v3B0Qr1kK4Yf KmkvHIpb53wg== X-IronPort-AV: E=McAfee;i="6000,8403,9890"; a="169181911" X-IronPort-AV: E=Sophos;i="5.81,168,1610438400"; d="scan'208";a="169181911" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2021 03:43:34 -0800 IronPort-SDR: 1EEOWmLHG9eeh7iZ+/W2gJzwBCcl3cmva7DnQ3zFVjiueCBigrBqOO6PdDMNCgiP5ZazAIjcOv mkz29nzXwLew== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,168,1610438400"; d="scan'208";a="488729858" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 10 Feb 2021 03:43:33 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5FDF235E; Wed, 10 Feb 2021 13:43:32 +0200 (EET) From: Andy Shevchenko To: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Len Brown , Andy Shevchenko Subject: [PATCH v1 5/7] ACPI: property: Refactor acpi_data_prop_read_single() Date: Wed, 10 Feb 2021 13:43:18 +0200 Message-Id: <20210210114320.3478-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210210114320.3478-1-andriy.shevchenko@linux.intel.com> References: <20210210114320.3478-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Refactor acpi_data_prop_read_single() for less LOCs and better maintenance. Signed-off-by: Andy Shevchenko --- drivers/acpi/property.c | 59 +++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index 167338fe9b04..f2386ef32ff1 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -785,47 +785,44 @@ static int acpi_data_prop_read_single(const struct acpi_device_data *data, enum dev_prop_type proptype, void *val) { const union acpi_object *obj; - int ret; + int ret = 0; if (!val) return -EINVAL; - if (proptype >= DEV_PROP_U8 && proptype <= DEV_PROP_U64) { + if (proptype >= DEV_PROP_U8 && proptype <= DEV_PROP_U64) ret = acpi_data_get_property(data, propname, ACPI_TYPE_INTEGER, &obj); - if (ret) - return ret; - - switch (proptype) { - case DEV_PROP_U8: - if (obj->integer.value > U8_MAX) - return -EOVERFLOW; - *(u8 *)val = obj->integer.value; - break; - case DEV_PROP_U16: - if (obj->integer.value > U16_MAX) - return -EOVERFLOW; - *(u16 *)val = obj->integer.value; - break; - case DEV_PROP_U32: - if (obj->integer.value > U32_MAX) - return -EOVERFLOW; - *(u32 *)val = obj->integer.value; - break; - default: - *(u64 *)val = obj->integer.value; - break; - } - } else if (proptype == DEV_PROP_STRING) { + else if (proptype == DEV_PROP_STRING) ret = acpi_data_get_property(data, propname, ACPI_TYPE_STRING, &obj); - if (ret) - return ret; + if (ret) + return ret; + switch (proptype) { + case DEV_PROP_U8: + if (obj->integer.value > U8_MAX) + return -EOVERFLOW; + *(u8 *)val = obj->integer.value; + break; + case DEV_PROP_U16: + if (obj->integer.value > U16_MAX) + return -EOVERFLOW; + *(u16 *)val = obj->integer.value; + break; + case DEV_PROP_U32: + if (obj->integer.value > U32_MAX) + return -EOVERFLOW; + *(u32 *)val = obj->integer.value; + break; + case DEV_PROP_U64: + *(u64 *)val = obj->integer.value; + break; + case DEV_PROP_STRING: *(char **)val = obj->string.pointer; - return 1; - } else { - ret = -EINVAL; + default: + return -EINVAL; } + return ret; } From patchwork Wed Feb 10 11:43:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 380284 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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 48858C433E9 for ; Wed, 10 Feb 2021 11:48:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E70C264E40 for ; Wed, 10 Feb 2021 11:48:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231425AbhBJLsB (ORCPT ); Wed, 10 Feb 2021 06:48:01 -0500 Received: from mga14.intel.com ([192.55.52.115]:35842 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230409AbhBJLpq (ORCPT ); Wed, 10 Feb 2021 06:45:46 -0500 IronPort-SDR: mRqAMFhw9wnHudgI/f8KPpsmjWQu7XLKBJLOJq8TYWP4AHASMwhJjKJ2rUOFyTotVdjva1An6S 194UYHSW1/Iw== X-IronPort-AV: E=McAfee;i="6000,8403,9890"; a="181283663" X-IronPort-AV: E=Sophos;i="5.81,168,1610438400"; d="scan'208";a="181283663" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2021 03:43:36 -0800 IronPort-SDR: bbPMqO0O8CLgv1cqYS7a6OjiNs3DZBAvu1C6NRzyeJ3H7KDbr1mSHDjnxNc8fwpP6n0maCn2ei 1xFbCEilQdfQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,168,1610438400"; d="scan'208";a="436645535" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga001.jf.intel.com with ESMTP; 10 Feb 2021 03:43:35 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 683AA4BE; Wed, 10 Feb 2021 13:43:32 +0200 (EET) From: Andy Shevchenko To: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Len Brown , Andy Shevchenko Subject: [PATCH v1 6/7] ACPI: property: Allow to validate a single value Date: Wed, 10 Feb 2021 13:43:19 +0200 Message-Id: <20210210114320.3478-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210210114320.3478-1-andriy.shevchenko@linux.intel.com> References: <20210210114320.3478-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org acpi_data_prop_read_single() doesn't accept a NULL parameter for the value. Let's modify it to accept NULL pointer in order to validate the single value. This will be needed for the further changes. Signed-off-by: Andy Shevchenko --- drivers/acpi/property.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index f2386ef32ff1..236316ee0e25 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -787,9 +787,6 @@ static int acpi_data_prop_read_single(const struct acpi_device_data *data, const union acpi_object *obj; int ret = 0; - if (!val) - return -EINVAL; - if (proptype >= DEV_PROP_U8 && proptype <= DEV_PROP_U64) ret = acpi_data_get_property(data, propname, ACPI_TYPE_INTEGER, &obj); else if (proptype == DEV_PROP_STRING) @@ -801,23 +798,28 @@ static int acpi_data_prop_read_single(const struct acpi_device_data *data, case DEV_PROP_U8: if (obj->integer.value > U8_MAX) return -EOVERFLOW; - *(u8 *)val = obj->integer.value; + if (val) + *(u8 *)val = obj->integer.value; break; case DEV_PROP_U16: if (obj->integer.value > U16_MAX) return -EOVERFLOW; - *(u16 *)val = obj->integer.value; + if (val) + *(u16 *)val = obj->integer.value; break; case DEV_PROP_U32: if (obj->integer.value > U32_MAX) return -EOVERFLOW; - *(u32 *)val = obj->integer.value; + if (val) + *(u32 *)val = obj->integer.value; break; case DEV_PROP_U64: - *(u64 *)val = obj->integer.value; + if (val) + *(u64 *)val = obj->integer.value; break; case DEV_PROP_STRING: - *(char **)val = obj->string.pointer; + if (val) + *(char **)val = obj->string.pointer; return 1; default: return -EINVAL; From patchwork Wed Feb 10 11:43:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 381108 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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 DE74FC433E6 for ; Wed, 10 Feb 2021 11:51:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B46864DF6 for ; Wed, 10 Feb 2021 11:51:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230494AbhBJLvS (ORCPT ); Wed, 10 Feb 2021 06:51:18 -0500 Received: from mga02.intel.com ([134.134.136.20]:64430 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230412AbhBJLtB (ORCPT ); Wed, 10 Feb 2021 06:49:01 -0500 IronPort-SDR: SSi05y+sTmDcrqvLKPVbUwy0FDgO97qkKbu+fLxx+EMnPUfI+8F2xbkBx+eGsWLn5aMMO1G8nq eRAKblJNDHgg== X-IronPort-AV: E=McAfee;i="6000,8403,9890"; a="169181917" X-IronPort-AV: E=Sophos;i="5.81,168,1610438400"; d="scan'208";a="169181917" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2021 03:43:36 -0800 IronPort-SDR: vsAvMH9/oRNgKCElQhKCw64FRSzP8p8ckNi6QPc3GTgVrLW0AKEOMExsh94BJpuvuHS/1LhcvH Am/cYDa4ZyYg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,168,1610438400"; d="scan'208";a="488729862" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 10 Feb 2021 03:43:35 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 71064525; Wed, 10 Feb 2021 13:43:32 +0200 (EET) From: Andy Shevchenko To: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Len Brown , Andy Shevchenko , Calvin Johnson Subject: [PATCH v1 7/7] ACPI: property: Allow counting a single value as an array of 1 element Date: Wed, 10 Feb 2021 13:43:20 +0200 Message-Id: <20210210114320.3478-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210210114320.3478-1-andriy.shevchenko@linux.intel.com> References: <20210210114320.3478-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org We allow to read the single value as a first element in the array. Unfortunately the counting doesn't work in this case and we can't call fwnode_property_count_*() API without getting an error. Modify acpi_data_prop_read() to always try the single value read and thus allow counting the single value as an array of 1 element. Reported-by: Calvin Johnson Signed-off-by: Andy Shevchenko --- drivers/acpi/property.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index 236316ee0e25..d6100585fceb 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -913,12 +913,14 @@ static int acpi_data_prop_read(const struct acpi_device_data *data, const union acpi_object *items; int ret; - if (val && nval == 1) { + /* Try to read as a single value first */ + if (!val || nval == 1) { ret = acpi_data_prop_read_single(data, propname, proptype, val); if (ret >= 0) - return ret; + return val ? ret : 1; } + /* It's not the single value, get an array instead */ ret = acpi_data_get_property_array(data, propname, ACPI_TYPE_ANY, &obj); if (ret) return ret;