From patchwork Fri Mar 10 14:47:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 13169467 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 07F2AC6FA99 for ; Fri, 10 Mar 2023 16:03:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=RXqW7GewBgVnYiWxpWS3yyaWTgL6OiQDLlruaHA7rqk=; b=XUSG+wBnVKV3bp 2nrI5pG4Igt8xG8zaIcxA728+Yvny1n4NDjNenYSXc0MZVKmn+IhwohxoVqDiRzl7u2itzRIddZdf bU5J8HU7hm+HFvllyl6pn+XxJuDQW2y6ILyVzmFD/V4ym6S6h1qvBN2UZr9QL6tvgr1fS2zmvKVi1 AYecH38sKyfGLpv6B7TNXxYHZwGHLJp/clTo/O0OdDkpkqRXpS5ebg3W/Q1FYi4EuGRv9IktjCEHm 0cYmZW5VrTbNwhzmxsjl5PppaiN71hVwN1V08ZiICj8da0CwUk3mYvQt/4RiqMz7izpJaw0hC1dW6 XvwurjeZWo/cMymkgx/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pafCX-00FAbK-RL; Fri, 10 Mar 2023 16:02:37 +0000 Received: from mail-oi1-f181.google.com ([209.85.167.181]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pae22-00Emjz-5T; Fri, 10 Mar 2023 14:47:43 +0000 Received: by mail-oi1-f181.google.com with SMTP id c11so4409593oiw.2; Fri, 10 Mar 2023 06:47:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678459661; 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=lRN0jAfi5iqcqL3ePabHiQPwHcWvAmjJJvRbEXcLzU0=; b=IWpYseYKU3+3V/8qC0JtmxuSWAKuZX0oW6NmSgJu3NmAAS+1OwmcZcgddCcqDxfksn DJFHY9afCKdDtSAGYO20osz3mpe0qNMxcdsplRk3x915MsW2nDp37G3gustLuWkicU+q VjiTJtrWdLfk9GCbP29+w28q8jZotmSAErYpqRXyAWnp415Gch0YxGbXXn186Qsc75Vv /biqXNh3M7KlFW/qR9stiybYqnECBb0dn7EyGMfC1XjOyoPvH9mooA0EBisox5ZaMg9p h4K+mCo7A08AvrVmJwVtDmhAu9amgxfWveRcTSd9RHj6lfr7IT/Y9IpCf+msDyYbiw8+ bCbw== X-Gm-Message-State: AO0yUKU6qxahoPjUi7ncQbKurZr8sZAGLBijsabB8/3ZLAIu/f2xCXtT magWoEjiOU3PurGfRMqHxw== X-Google-Smtp-Source: AK7set8NyE9pelZcNVRqymxGqcdHaorNLGYGKwkwEPG5NWZLihqksz6QnJRuEAnZN8WQX6FSLVz58g== X-Received: by 2002:a05:6808:2805:b0:37a:f32f:730c with SMTP id et5-20020a056808280500b0037af32f730cmr10660264oib.35.1678459660802; Fri, 10 Mar 2023 06:47:40 -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 y63-20020aca3242000000b00383eaea5e88sm953962oiy.38.2023.03.10.06.47.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 06:47:40 -0800 (PST) Received: (nullmailer pid 1543406 invoked by uid 1000); Fri, 10 Mar 2023 14:47:12 -0000 From: Rob Herring To: Lee Jones , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Neil Armstrong , Maxime Coquelin , Alexandre Torgue Cc: devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH] mfd: Use of_property_present() for testing DT property presence Date: Fri, 10 Mar 2023 08:47:12 -0600 Message-Id: <20230310144712.1543379-1-robh@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230310_064742_241473_6F881267 X-CRM114-Status: GOOD ( 13.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org It is preferred to use typed property access functions (i.e. of_property_read_ 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 --- drivers/mfd/bcm2835-pm.c | 2 +- drivers/mfd/khadas-mcu.c | 2 +- drivers/mfd/stmpe.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mfd/bcm2835-pm.c b/drivers/mfd/bcm2835-pm.c index 49cd1f03884a..aa1263d22249 100644 --- a/drivers/mfd/bcm2835-pm.c +++ b/drivers/mfd/bcm2835-pm.c @@ -28,7 +28,7 @@ static const struct mfd_cell bcm2835_power_devs[] = { static int bcm2835_pm_get_pdata(struct platform_device *pdev, struct bcm2835_pm *pm) { - if (of_find_property(pm->dev->of_node, "reg-names", NULL)) { + if (of_property_present(pm->dev->of_node, "reg-names")) { struct resource *res; pm->base = devm_platform_ioremap_resource_byname(pdev, "pm"); diff --git a/drivers/mfd/khadas-mcu.c b/drivers/mfd/khadas-mcu.c index 7338cc16f327..1c807c0e6d25 100644 --- a/drivers/mfd/khadas-mcu.c +++ b/drivers/mfd/khadas-mcu.c @@ -112,7 +112,7 @@ static int khadas_mcu_probe(struct i2c_client *client) if (ret) return ret; - if (of_find_property(dev->of_node, "#cooling-cells", NULL)) + if (of_property_present(dev->of_node, "#cooling-cells")) return devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE, khadas_mcu_fan_cells, ARRAY_SIZE(khadas_mcu_fan_cells), diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c index c304d20bb988..a92301dfc712 100644 --- a/drivers/mfd/stmpe.c +++ b/drivers/mfd/stmpe.c @@ -1378,7 +1378,7 @@ int stmpe_probe(struct stmpe_client_info *ci, enum stmpe_partnum partnum) stmpe_of_probe(pdata, np); - if (of_find_property(np, "interrupts", NULL) == NULL) + if (!of_property_present(np, "interrupts")) ci->irq = -1; stmpe = devm_kzalloc(ci->dev, sizeof(struct stmpe), GFP_KERNEL);