From patchwork Fri Mar 10 14:47:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 13169362 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 6B51AC6FD1F for ; Fri, 10 Mar 2023 14:53:20 +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=t9jsFlLMvuWmqptLa/KZU/YLhQZ1LVORuguhFg8y0uI=; b=d5Z43rCVT8aPpK o7MPiW9dTQu2mdDqArSbd89fLqvuydKxIzjbS6Ex6BdjOR4m3A4wHvOjiP0SkQ19xqFN12bmsg03z 2em+zydnmu8EBPPfzZdrrtQmoFtNPaC4SDjnZIJt36jJ64LS7PXqO2KdxhF1MKnALT/MzTr1I10D0 x/JwuDDVUhS5R3K+7NR/8p/ItHjCSH/AH4SpoRfqt5ZnqixyQDb3MFfxMGIWDltjHZojoKHt6zEyI edQ6SrAzq/i1NjCVCP9jQ3taylSU69/RH0hBkzSW0cl1NZxiB9+YLQLdKrA4aIUOz1vmJ4ETIpm+m XnW1X1Ay6UW3YIfWyOag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pae6S-00EpMc-5f; Fri, 10 Mar 2023 14:52:16 +0000 Received: from mail-ot1-f43.google.com ([209.85.210.43]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pae2y-00EnI2-1G for linux-arm-kernel@lists.infradead.org; Fri, 10 Mar 2023 14:48:41 +0000 Received: by mail-ot1-f43.google.com with SMTP id o4-20020a9d6d04000000b00694127788f4so3038505otp.6 for ; Fri, 10 Mar 2023 06:48:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678459718; 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=vK9rI6mTHq76BhXmDPa7BjkMjKI93uQSgJiPM86yG6U=; b=2x2uLZO7yjgPZYAy66ZY4fmrrhq67Lz+1eIPts3HnzMjFOWN4ifJaYWQlFS81XoJHE 1OyVxcJgY7ZUWNLdB1wC4KqlWxH/qh8QSIZa/jaCU2Bg2XqCz7n9D2i8ZNKmQeUZyvdm U9VWo/MXmHkPG3e+POZK0FV/NwbYo55rvPJzVdCMcH2KN1J2z8x8jxwrRRaQCyvrkflB LvEgAcq+rct4MyG5IuOU/oD6ALlsBo/NM7AXfM5kP7FFuxtunqyS0sf93xafEb2atjrJ 0PbDxsqjbFK6FhyAf3VBd10AWDvS0JhHQogxaE+4tqHYTG1uRbCJtI3zEq903b6QHFk8 M0LQ== X-Gm-Message-State: AO0yUKWsw+xhYf7N3KhK8H866YDZimC80n05xLBQYz9qVzIzI4+b9uh+ u6E02YTbQzHvlm2+lAXCLw== X-Google-Smtp-Source: AK7set+EbOmyZ/AksMSYYEuG7lFqQ6jiaAPpDlPQ5Tum+fcZZiV0qWudibu3pk/iibkSVwuFhfXHxg== X-Received: by 2002:a9d:2e9:0:b0:684:dbfd:f239 with SMTP id 96-20020a9d02e9000000b00684dbfdf239mr1088619otl.9.1678459718677; Fri, 10 Mar 2023 06:48:38 -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 t18-20020a9d7292000000b0068bc476d777sm132335otj.13.2023.03.10.06.48.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 06:48:38 -0800 (PST) Received: (nullmailer pid 1545743 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 , Timur Tabi Cc: devicetree@vger.kernel.org, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH] serial: Use of_property_read_bool() for boolean properties Date: Fri, 10 Mar 2023 08:47:27 -0600 Message-Id: <20230310144727.1545699-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_064840_134372_42B4DC87 X-CRM114-Status: GOOD ( 14.75 ) 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. Convert reading boolean properties to to of_property_read_bool(). Signed-off-by: Rob Herring Acked-by: Uwe Kleine-König Acked-by: Timur Tabi --- drivers/tty/serial/imx.c | 14 +++++--------- drivers/tty/serial/mxs-auart.c | 4 ++-- drivers/tty/serial/ucc_uart.c | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 5712a4f29607..be168792b635 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -2262,20 +2262,16 @@ static int imx_uart_probe(struct platform_device *pdev) } sport->port.line = ret; - if (of_get_property(np, "uart-has-rtscts", NULL) || - of_get_property(np, "fsl,uart-has-rtscts", NULL) /* deprecated */) - sport->have_rtscts = 1; + sport->have_rtscts = of_property_read_bool(np, "uart-has-rtscts") || + of_property_read_bool(np, "fsl,uart-has-rtscts"); /* deprecated */ - if (of_get_property(np, "fsl,dte-mode", NULL)) - sport->dte_mode = 1; + sport->dte_mode = of_property_read_bool(np, "fsl,dte-mode"); sport->have_rtsgpio = of_property_present(np, "rts-gpios"); - if (of_get_property(np, "fsl,inverted-tx", NULL)) - sport->inverted_tx = 1; + sport->inverted_tx = of_property_read_bool(np, "fsl,inverted-tx"); - if (of_get_property(np, "fsl,inverted-rx", NULL)) - sport->inverted_rx = 1; + sport->inverted_rx = of_property_read_bool(np, "fsl,inverted-rx"); if (!of_property_read_u32_array(np, "fsl,dma-info", dma_buf_conf, 2)) { sport->rx_period_length = dma_buf_conf[0]; diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index ef6e7bb6105c..a368f4293967 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c @@ -1587,8 +1587,8 @@ static int mxs_auart_probe(struct platform_device *pdev) } s->port.line = ret; - if (of_get_property(np, "uart-has-rtscts", NULL) || - of_get_property(np, "fsl,uart-has-rtscts", NULL) /* deprecated */) + if (of_property_read_bool(np, "uart-has-rtscts") || + of_property_read_bool(np, "fsl,uart-has-rtscts") /* deprecated */) set_bit(MXS_AUART_RTSCTS, &s->flags); if (s->port.line >= ARRAY_SIZE(auart_port)) { diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c index 32c7a5b43f8e..676840847962 100644 --- a/drivers/tty/serial/ucc_uart.c +++ b/drivers/tty/serial/ucc_uart.c @@ -1179,7 +1179,7 @@ static int soft_uart_init(struct platform_device *ofdev) struct qe_firmware_info *qe_fw_info; int ret; - if (of_find_property(np, "soft-uart", NULL)) { + if (of_property_read_bool(np, "soft-uart")) { dev_dbg(&ofdev->dev, "using Soft-UART mode\n"); soft_uart = 1; } else {