Message ID | 20230310144725.1545315-1-robh@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp944441wrd; Fri, 10 Mar 2023 07:45:26 -0800 (PST) X-Google-Smtp-Source: AK7set+L1ncDraukPOa07azzkjGxw26BEvW8GnOyNXVUziV1hSb6AAM2q5NCY+zgpPpE62pqSHbs X-Received: by 2002:a62:5b87:0:b0:61d:f3a8:aff0 with SMTP id p129-20020a625b87000000b0061df3a8aff0mr9233922pfb.12.1678463125836; Fri, 10 Mar 2023 07:45:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678463125; cv=none; d=google.com; s=arc-20160816; b=jVKhPhd21YxubVpEPBD4dPQTGdpvnj7fRlZIxsKhXzWYy5D99N6qsRGWuwa3JV7Zmp exWvQqUiejTTKSiheVSe69F4QV2aWs6uLZdUN0pY2n1m7BC4g9h2kjRWqo6dcFYBpZ2U Vwu9yAjVQ88TuUguTwt8qjpuUWyoS2uFK3CZJmmX0WjG3CjRkPUwlMWpBYT9ym3QRi+R KdfyAn1QgGgh8LLx7b4491RLwmqzqaVE27TUJjH0oJu1f+z5y/L9H3S9ZzAh5gEYi0lO Qjm1gCOEKPWvx/HLQc4vwyzYV/HpLdQUbxNTCBMImlgQz7uIfjeniEWwaXVbl4VWknRv aiGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=9ufsybUkbmkBZT7Reugv4yMUeSADY5agPgq6hpQcf+Q=; b=fHrZvA+Kq6Hi+QSVRvfANCALKZM9qT9gX/Kaa88RkD6uVrmeVWJ8Qiqe9bRhOfHOKw ox+01iIHhjHri8fKZlivcuNYeJqbadokk7KNp+/BLeCzxas1bVE0CUX1vpiZ/xqVXmQ9 Qcekm5IGiPKrSvwLMh/Kf3K5GrPvhDvTUaTwbcmSFGQ6PKi4egFqL0DVdafyb5eRGijm OqTQWna26sXYy8mB/WJAhpFhimo3LiankAzHUGdSRIjdGoJ6EF2UhRTYl1S8DO5yJ1hd bCbFpEtcf7BbGhImn4dQoEDjvNaHv2+zFwrDxaET8RiA16NG/Hjmnrx0gl6J6RFyF66Z tG2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l185-20020a6388c2000000b00502e38f7cefsi83243pgd.686.2023.03.10.07.45.12; Fri, 10 Mar 2023 07:45:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233376AbjCJOvE (ORCPT <rfc822;carlos.wei.hk@gmail.com> + 99 others); Fri, 10 Mar 2023 09:51:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233348AbjCJOt4 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 10 Mar 2023 09:49:56 -0500 Received: from mail-ot1-f41.google.com (mail-ot1-f41.google.com [209.85.210.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C59C2728E; Fri, 10 Mar 2023 06:47:57 -0800 (PST) Received: by mail-ot1-f41.google.com with SMTP id l15-20020a9d7a8f000000b0069447f0db6fso3046757otn.4; Fri, 10 Mar 2023 06:47:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678459669; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9ufsybUkbmkBZT7Reugv4yMUeSADY5agPgq6hpQcf+Q=; b=fXOqHEq27q7Nfg5k80wlWgFRkVkHn/HVK/Va/Az8Z5RlwNmSV4A4hwV+4C7fBejmcR uUrnulJhFhPL2P0GD4N7/oZGV/A6sahdG4k7MXxbwPJLnpHyNTbZ4cr4XQ0LZBUSKUvu ZS2Xo0ZvkwRwUf6qNNQAAbchKRjcZIvo+luBS3iliOqnuVLP36RplzyN/Nn0i7cq6Gyw gkqsD4bEjsd9qHbBSWDFD3W7HzZEDTQKRab1+mHaLLNWUyIb9NGcs1kPmeklgLPlo1ff j4ZRs9iz8ZlbCSLgA1HSUIiha/IFMc1OAmRs5gtKuWkOUwPh38MfxutQoQ2sJnWRvHzv ejcg== X-Gm-Message-State: AO0yUKWGhDomcyPhxosZulg3+/zC7ytvnnHNWC1WuecbHt0VVGbwcNfZ cSlfHNdLpHads/h8tOA5TA== X-Received: by 2002:a05:6830:449e:b0:690:dbb5:df32 with SMTP id r30-20020a056830449e00b00690dbb5df32mr15274511otv.25.1678459669215; Fri, 10 Mar 2023 06:47:49 -0800 (PST) Received: from robh_at_kernel.org (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id e12-20020a9d730c000000b0068bb7bd2668sm97181otk.73.2023.03.10.06.47.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 06:47:48 -0800 (PST) Received: (nullmailer pid 1545341 invoked by uid 1000); Fri, 10 Mar 2023 14:47:25 -0000 From: Rob Herring <robh@kernel.org> To: Michal Simek <michal.simek@xilinx.com> Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] soc: xilinx: Use of_property_present() for testing DT property presence Date: Fri, 10 Mar 2023 08:47:24 -0600 Message-Id: <20230310144725.1545315-1-robh@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759996150647447980?= X-GMAIL-MSGID: =?utf-8?q?1759996150647447980?= |
Series |
soc: xilinx: Use of_property_present() for testing DT property presence
|
|
Commit Message
Rob Herring
March 10, 2023, 2:47 p.m. UTC
It is preferred to use typed property access functions (i.e.
of_property_read_<type> functions) rather than low-level
of_get_property/of_find_property functions for reading properties. As
part of this, convert of_get_property/of_find_property calls to the
recently added of_property_present() helper when we just want to test
for presence of a property and nothing more.
Signed-off-by: Rob Herring <robh@kernel.org>
---
drivers/soc/xilinx/zynqmp_power.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
Hi Rob, I love your patch! Yet something to improve: [auto build test ERROR on xilinx-xlnx/master] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Rob-Herring/soc-xilinx-Use-of_property_present-for-testing-DT-property-presence/20230310-225437 base: https://github.com/Xilinx/linux-xlnx master patch link: https://lore.kernel.org/r/20230310144725.1545315-1-robh%40kernel.org patch subject: [PATCH] soc: xilinx: Use of_property_present() for testing DT property presence config: arm64-allyesconfig (https://download.01.org/0day-ci/archive/20230312/202303120017.BIw01Y21-lkp@intel.com/config) compiler: aarch64-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/7d21b118deba11d338baf0365e962a8889f3ac68 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Rob-Herring/soc-xilinx-Use-of_property_present-for-testing-DT-property-presence/20230310-225437 git checkout 7d21b118deba11d338baf0365e962a8889f3ac68 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm64 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/soc/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202303120017.BIw01Y21-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/soc/xilinx/zynqmp_power.c: In function 'zynqmp_pm_probe': >> drivers/soc/xilinx/zynqmp_power.c:221:20: error: implicit declaration of function 'of_property_present'; did you mean 'fwnode_property_present'? [-Werror=implicit-function-declaration] 221 | } else if (of_property_present(pdev->dev.of_node, "mboxes")) { | ^~~~~~~~~~~~~~~~~~~ | fwnode_property_present cc1: some warnings being treated as errors vim +221 drivers/soc/xilinx/zynqmp_power.c 183 184 static int zynqmp_pm_probe(struct platform_device *pdev) 185 { 186 int ret, irq; 187 u32 pm_api_version; 188 struct mbox_client *client; 189 190 zynqmp_pm_get_api_version(&pm_api_version); 191 192 /* Check PM API version number */ 193 if (pm_api_version < ZYNQMP_PM_VERSION) 194 return -ENODEV; 195 196 /* 197 * First try to use Xilinx Event Manager by registering suspend_event_callback 198 * for suspend/shutdown event. 199 * If xlnx_register_event() returns -EACCES (Xilinx Event Manager 200 * is not available to use) or -ENODEV(Xilinx Event Manager not compiled), 201 * then use ipi-mailbox or interrupt method. 202 */ 203 ret = xlnx_register_event(PM_INIT_SUSPEND_CB, 0, 0, false, 204 suspend_event_callback, NULL); 205 if (!ret) { 206 zynqmp_pm_init_suspend_work = devm_kzalloc(&pdev->dev, 207 sizeof(struct zynqmp_pm_work_struct), 208 GFP_KERNEL); 209 if (!zynqmp_pm_init_suspend_work) { 210 xlnx_unregister_event(PM_INIT_SUSPEND_CB, 0, 0, 211 suspend_event_callback, NULL); 212 return -ENOMEM; 213 } 214 event_registered = true; 215 216 INIT_WORK(&zynqmp_pm_init_suspend_work->callback_work, 217 zynqmp_pm_init_suspend_work_fn); 218 } else if (ret != -EACCES && ret != -ENODEV) { 219 dev_err(&pdev->dev, "Failed to Register with Xilinx Event manager %d\n", ret); 220 return ret; > 221 } else if (of_property_present(pdev->dev.of_node, "mboxes")) { 222 zynqmp_pm_init_suspend_work = 223 devm_kzalloc(&pdev->dev, 224 sizeof(struct zynqmp_pm_work_struct), 225 GFP_KERNEL); 226 if (!zynqmp_pm_init_suspend_work) 227 return -ENOMEM; 228 229 INIT_WORK(&zynqmp_pm_init_suspend_work->callback_work, 230 zynqmp_pm_init_suspend_work_fn); 231 client = devm_kzalloc(&pdev->dev, sizeof(*client), GFP_KERNEL); 232 if (!client) 233 return -ENOMEM; 234 235 client->dev = &pdev->dev; 236 client->rx_callback = ipi_receive_callback; 237 238 rx_chan = mbox_request_channel_byname(client, "rx"); 239 if (IS_ERR(rx_chan)) { 240 dev_err(&pdev->dev, "Failed to request rx channel\n"); 241 return PTR_ERR(rx_chan); 242 } 243 } else if (of_property_present(pdev->dev.of_node, "interrupts")) { 244 irq = platform_get_irq(pdev, 0); 245 if (irq <= 0) 246 return -ENXIO; 247 248 ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, 249 zynqmp_pm_isr, 250 IRQF_NO_SUSPEND | IRQF_ONESHOT, 251 dev_name(&pdev->dev), 252 &pdev->dev); 253 if (ret) { 254 dev_err(&pdev->dev, "devm_request_threaded_irq '%d' failed with %d\n", 255 irq, ret); 256 return ret; 257 } 258 } else { 259 dev_err(&pdev->dev, "Required property not found in DT node\n"); 260 return -ENOENT; 261 } 262 263 ret = sysfs_create_file(&pdev->dev.kobj, &dev_attr_suspend_mode.attr); 264 if (ret) { 265 if (event_registered) { 266 xlnx_unregister_event(PM_INIT_SUSPEND_CB, 0, 0, suspend_event_callback, 267 NULL); 268 event_registered = false; 269 } 270 dev_err(&pdev->dev, "unable to create sysfs interface\n"); 271 return ret; 272 } 273 274 return 0; 275 } 276
On 3/10/23 15:47, Rob Herring wrote: > It is preferred to use typed property access functions (i.e. > of_property_read_<type> functions) rather than low-level > of_get_property/of_find_property functions for reading properties. As > part of this, convert of_get_property/of_find_property calls to the > recently added of_property_present() helper when we just want to test > for presence of a property and nothing more. > > Signed-off-by: Rob Herring <robh@kernel.org> > --- > drivers/soc/xilinx/zynqmp_power.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/soc/xilinx/zynqmp_power.c b/drivers/soc/xilinx/zynqmp_power.c > index 78a8a7545d1e..641dcc958911 100644 > --- a/drivers/soc/xilinx/zynqmp_power.c > +++ b/drivers/soc/xilinx/zynqmp_power.c > @@ -218,7 +218,7 @@ static int zynqmp_pm_probe(struct platform_device *pdev) > } else if (ret != -EACCES && ret != -ENODEV) { > dev_err(&pdev->dev, "Failed to Register with Xilinx Event manager %d\n", ret); > return ret; > - } else if (of_find_property(pdev->dev.of_node, "mboxes", NULL)) { > + } else if (of_property_present(pdev->dev.of_node, "mboxes")) { > zynqmp_pm_init_suspend_work = > devm_kzalloc(&pdev->dev, > sizeof(struct zynqmp_pm_work_struct), > @@ -240,7 +240,7 @@ static int zynqmp_pm_probe(struct platform_device *pdev) > dev_err(&pdev->dev, "Failed to request rx channel\n"); > return PTR_ERR(rx_chan); > } > - } else if (of_find_property(pdev->dev.of_node, "interrupts", NULL)) { > + } else if (of_property_present(pdev->dev.of_node, "interrupts")) { > irq = platform_get_irq(pdev, 0); > if (irq <= 0) > return -ENXIO; > -- > 2.39.2 > Waiting for v2 because of missing of.h header reported by lkp. https://lore.kernel.org/all/202303120017.BIw01Y21-lkp@intel.com/ M
On Mon, Mar 13, 2023 at 5:19 AM Michal Simek <michal.simek@amd.com> wrote: > > > > On 3/10/23 15:47, Rob Herring wrote: > > It is preferred to use typed property access functions (i.e. > > of_property_read_<type> functions) rather than low-level > > of_get_property/of_find_property functions for reading properties. As > > part of this, convert of_get_property/of_find_property calls to the > > recently added of_property_present() helper when we just want to test > > for presence of a property and nothing more. > > > > Signed-off-by: Rob Herring <robh@kernel.org> > > --- > > drivers/soc/xilinx/zynqmp_power.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/soc/xilinx/zynqmp_power.c b/drivers/soc/xilinx/zynqmp_power.c > > index 78a8a7545d1e..641dcc958911 100644 > > --- a/drivers/soc/xilinx/zynqmp_power.c > > +++ b/drivers/soc/xilinx/zynqmp_power.c > > @@ -218,7 +218,7 @@ static int zynqmp_pm_probe(struct platform_device *pdev) > > } else if (ret != -EACCES && ret != -ENODEV) { > > dev_err(&pdev->dev, "Failed to Register with Xilinx Event manager %d\n", ret); > > return ret; > > - } else if (of_find_property(pdev->dev.of_node, "mboxes", NULL)) { > > + } else if (of_property_present(pdev->dev.of_node, "mboxes")) { > > zynqmp_pm_init_suspend_work = > > devm_kzalloc(&pdev->dev, > > sizeof(struct zynqmp_pm_work_struct), > > @@ -240,7 +240,7 @@ static int zynqmp_pm_probe(struct platform_device *pdev) > > dev_err(&pdev->dev, "Failed to request rx channel\n"); > > return PTR_ERR(rx_chan); > > } > > - } else if (of_find_property(pdev->dev.of_node, "interrupts", NULL)) { > > + } else if (of_property_present(pdev->dev.of_node, "interrupts")) { > > irq = platform_get_irq(pdev, 0); > > if (irq <= 0) > > return -ENXIO; > > -- > > 2.39.2 > > > > Waiting for v2 because of missing of.h header reported by lkp. > https://lore.kernel.org/all/202303120017.BIw01Y21-lkp@intel.com/ It's a false positive. The header change is in v6.3-rc1, but 0-day is applying these to branches not yet updated to rc1. Rob
On 3/14/23 14:23, Rob Herring wrote: > On Mon, Mar 13, 2023 at 5:19 AM Michal Simek <michal.simek@amd.com> wrote: >> >> >> >> On 3/10/23 15:47, Rob Herring wrote: >>> It is preferred to use typed property access functions (i.e. >>> of_property_read_<type> functions) rather than low-level >>> of_get_property/of_find_property functions for reading properties. As >>> part of this, convert of_get_property/of_find_property calls to the >>> recently added of_property_present() helper when we just want to test >>> for presence of a property and nothing more. >>> >>> Signed-off-by: Rob Herring <robh@kernel.org> >>> --- >>> drivers/soc/xilinx/zynqmp_power.c | 4 ++-- >>> 1 file changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/soc/xilinx/zynqmp_power.c b/drivers/soc/xilinx/zynqmp_power.c >>> index 78a8a7545d1e..641dcc958911 100644 >>> --- a/drivers/soc/xilinx/zynqmp_power.c >>> +++ b/drivers/soc/xilinx/zynqmp_power.c >>> @@ -218,7 +218,7 @@ static int zynqmp_pm_probe(struct platform_device *pdev) >>> } else if (ret != -EACCES && ret != -ENODEV) { >>> dev_err(&pdev->dev, "Failed to Register with Xilinx Event manager %d\n", ret); >>> return ret; >>> - } else if (of_find_property(pdev->dev.of_node, "mboxes", NULL)) { >>> + } else if (of_property_present(pdev->dev.of_node, "mboxes")) { >>> zynqmp_pm_init_suspend_work = >>> devm_kzalloc(&pdev->dev, >>> sizeof(struct zynqmp_pm_work_struct), >>> @@ -240,7 +240,7 @@ static int zynqmp_pm_probe(struct platform_device *pdev) >>> dev_err(&pdev->dev, "Failed to request rx channel\n"); >>> return PTR_ERR(rx_chan); >>> } >>> - } else if (of_find_property(pdev->dev.of_node, "interrupts", NULL)) { >>> + } else if (of_property_present(pdev->dev.of_node, "interrupts")) { >>> irq = platform_get_irq(pdev, 0); >>> if (irq <= 0) >>> return -ENXIO; >>> -- >>> 2.39.2 >>> >> >> Waiting for v2 because of missing of.h header reported by lkp. >> https://lore.kernel.org/all/202303120017.BIw01Y21-lkp@intel.com/ > > It's a false positive. The header change is in v6.3-rc1, but 0-day is > applying these to branches not yet updated to rc1. ok. applied. Thanks, Michal
diff --git a/drivers/soc/xilinx/zynqmp_power.c b/drivers/soc/xilinx/zynqmp_power.c index 78a8a7545d1e..641dcc958911 100644 --- a/drivers/soc/xilinx/zynqmp_power.c +++ b/drivers/soc/xilinx/zynqmp_power.c @@ -218,7 +218,7 @@ static int zynqmp_pm_probe(struct platform_device *pdev) } else if (ret != -EACCES && ret != -ENODEV) { dev_err(&pdev->dev, "Failed to Register with Xilinx Event manager %d\n", ret); return ret; - } else if (of_find_property(pdev->dev.of_node, "mboxes", NULL)) { + } else if (of_property_present(pdev->dev.of_node, "mboxes")) { zynqmp_pm_init_suspend_work = devm_kzalloc(&pdev->dev, sizeof(struct zynqmp_pm_work_struct), @@ -240,7 +240,7 @@ static int zynqmp_pm_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Failed to request rx channel\n"); return PTR_ERR(rx_chan); } - } else if (of_find_property(pdev->dev.of_node, "interrupts", NULL)) { + } else if (of_property_present(pdev->dev.of_node, "interrupts")) { irq = platform_get_irq(pdev, 0); if (irq <= 0) return -ENXIO;