From patchwork Fri Mar 10 14:47:26 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: 13169528 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 604D3C6FA99 for ; Fri, 10 Mar 2023 16:03:58 +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=pzt9XN7mEW0VMpwOeN3p061/c2wxmb8m6Iioe7BKKiY=; b=DPLgad+y5eui1t DGq2LPGsy5BtwS9Vx9fDnVheNLzGts91s3C2dKsDFRFt6ILF5HYl+AAzj5zCey8fTPdK8VMjPwpdT Y4+ydbCBxaGq1H/CPXYUYoazFWmMb5vIwKkjnnzTBahnen10PaDn50jzFjhZv9G+uOs2VWi/Rpsqb H6Tengw77LFN6Owh5lGZfW6MQpoS5nbG7EoMioR5fh/uXnlsGMJTrO18mdPIYDoWc/wlLw8yWyZIm VF8S/dVXgm1IkXaRaCGq64XV1hAUmfHbo02xZFTNm5NGo/LISGuadPCP09BG90Dl15G1j/aAflbmB alLJww/P5eUqagAv/KLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pafD2-00FAt2-Qt; Fri, 10 Mar 2023 16:03:09 +0000 Received: from mail-ot1-f45.google.com ([209.85.210.45]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pae29-00Emoc-3C for linux-arm-kernel@lists.infradead.org; Fri, 10 Mar 2023 14:47:50 +0000 Received: by mail-ot1-f45.google.com with SMTP id f19-20020a9d5f13000000b00693ce5a2f3eso3035838oti.8 for ; Fri, 10 Mar 2023 06:47:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678459668; 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=BnkBIbnz4vOeZORUW8cnuffMpZ7B9RlqYee18NB6XoY=; b=nBxNIdiNbKyb4pqMHfVgmh+MRD/1yluYABVKKriJQNL+KDLb7vyF5hG4MGfV+D6d4M t6jG1dj9kAjBzZHH/FvKGF+P6IcqvcOe5HA6w5GWuJzMB+XE7z/LNIPIYVHARQNbe0SN nVIVuvxe+j+lbkBBhkNPlHbCcRG5y+gOu8t1wf6l2fevf5+kFhfELs/bZX+xYWoEjy0t 4MIjHX1q9jVHWGxZdX0IOzbcAgQfu5XlalvTK/SJfXAPIw2vP0Q6lgcTjhsxM0mbvKLo KEMI6vy8SZqfpYhWxVhRMNY6mNC3KhLD18GVSQOms5xT7ZYHPN6xmaC13TbEC2HhnUco 16dg== X-Gm-Message-State: AO0yUKW25aXZ5MQpqwJZpcntwatxZQrpoQxcCG/inkCiYdqpfbrrR7LM wGPzcGcH/csuqn1vfP4t8Q== X-Google-Smtp-Source: AK7set/5K9xkOxRXHTghD5+c/dagxGmwvMLb3ksbgoSl8gw3zLJtj8L8jtL7TmDHtKFFm8q9QTWPPg== X-Received: by 2002:a05:6830:1f42:b0:68d:41b2:5b75 with SMTP id u2-20020a0568301f4200b0068d41b25b75mr11972670oth.11.1678459668155; Fri, 10 Mar 2023 06:47:48 -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 q19-20020a05683022d300b0068bd20cf07dsm115038otc.48.2023.03.10.06.47.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 06:47:47 -0800 (PST) Received: (nullmailer pid 1545656 invoked by uid 1000); Fri, 10 Mar 2023 14:47:27 -0000 From: Rob Herring To: Greg Kroah-Hartman , Jiri Slaby , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , "David S. Miller" Cc: devicetree@vger.kernel.org, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org Subject: [PATCH] serial: Use of_property_present() for testing DT property presence Date: Fri, 10 Mar 2023 08:47:26 -0600 Message-Id: <20230310144727.1545630-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_064749_195233_7F7B700D X-CRM114-Status: GOOD ( 17.25 ) 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/tty/serial/imx.c | 3 +-- drivers/tty/serial/sh-sci.c | 2 +- drivers/tty/serial/sunzilog.c | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 523f296d5747..5712a4f29607 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -2269,8 +2269,7 @@ static int imx_uart_probe(struct platform_device *pdev) if (of_get_property(np, "fsl,dte-mode", NULL)) sport->dte_mode = 1; - if (of_get_property(np, "rts-gpios", NULL)) - sport->have_rtsgpio = 1; + sport->have_rtsgpio = of_property_present(np, "rts-gpios"); if (of_get_property(np, "fsl,inverted-tx", NULL)) sport->inverted_tx = 1; diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 7bd080720929..a3e12e985e0d 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1573,7 +1573,7 @@ static void sci_request_dma(struct uart_port *port) * Don't request a dma channel if no channel was specified * in the device tree. */ - if (!of_find_property(port->dev->of_node, "dmas", NULL)) + if (!of_property_present(port->dev->of_node, "dmas")) return; chan = sci_request_dma_chan(port, DMA_MEM_TO_DEV); diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c index ccb809216e94..0fbeb3dbd843 100644 --- a/drivers/tty/serial/sunzilog.c +++ b/drivers/tty/serial/sunzilog.c @@ -1403,7 +1403,7 @@ static int zs_probe(struct platform_device *op) int keyboard_mouse = 0; int err; - if (of_find_property(op->dev.of_node, "keyboard", NULL)) + if (of_property_present(op->dev.of_node, "keyboard")) keyboard_mouse = 1; /* uarts must come before keyboards/mice */ @@ -1553,7 +1553,7 @@ static int __init sunzilog_init(void) for_each_node_by_name(dp, "zs") { num_sunzilog++; - if (of_find_property(dp, "keyboard", NULL)) + if (of_property_present(dp, "keyboard")) num_keybms++; }