From patchwork Thu Sep 3 14:27:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lad Prabhakar X-Patchwork-Id: 11753735 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A1B9814E3 for ; Thu, 3 Sep 2020 14:27:25 +0000 (UTC) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 79E722072A for ; Thu, 3 Sep 2020 14:27:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=lists.cip-project.org header.i=@lists.cip-project.org header.b="IsoLU1pK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 79E722072A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bp.renesas.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=bounce+64572+5392+4520428+8129116@lists.cip-project.org X-Received: by 127.0.0.2 with SMTP id uILpYY4521763x34zUMwb4l6; Thu, 03 Sep 2020 07:27:25 -0700 X-Received: from relmlie5.idc.renesas.com (relmlie5.idc.renesas.com [210.160.252.171]) by mx.groups.io with SMTP id smtpd.web12.15229.1599143244490577166 for ; Thu, 03 Sep 2020 07:27:24 -0700 X-IronPort-AV: E=Sophos;i="5.76,387,1592838000"; d="scan'208";a="56296901" X-Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 03 Sep 2020 23:27:22 +0900 X-Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id E59AC40062AB; Thu, 3 Sep 2020 23:27:21 +0900 (JST) From: "Lad Prabhakar" To: cip-dev@lists.cip-project.org, Nobuhiro Iwamatsu , Pavel Machek Cc: Biju Das Subject: [cip-dev] [PATCH 4.4.y-cip 1/4] serial: mctrl_gpio: Check if GPIO property exisits before requesting it Date: Thu, 3 Sep 2020 15:27:16 +0100 Message-Id: <20200903142719.13010-2-prabhakar.mahadev-lad.rj@bp.renesas.com> In-Reply-To: <20200903142719.13010-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20200903142719.13010-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: Bulk List-Unsubscribe: Sender: cip-dev@lists.cip-project.org List-Id: Mailing-List: list cip-dev@lists.cip-project.org; contact cip-dev+owner@lists.cip-project.org Delivered-To: mailing list cip-dev@lists.cip-project.org Reply-To: cip-dev@lists.cip-project.org X-Gm-Message-State: vGhtqU7A35OAWkZ629GyOvJqx4520428AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.cip-project.org; q=dns/txt; s=20140610; t=1599143245; bh=BpTuSlaKIQvr5FqoJZddV2bwu1NUjanoO15jZJ+6db0=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=IsoLU1pKx7F+oiLohFiJhOeU0YQB82m4FMUzIqrcT39M3kdg5P1d3IsbHZsgCSulQG8 f1h5oxxI4PqPb8i4Rx9IDsFWf/IUyOheYoSoz7ossCypP0YZc79GGUA9H9naQjUA9Pe5t GoydXC+BIXlELhShj8j4y8KKxp1mupo1M9A= From: Stefan Roese commit d99482673f950817b30caf3fcdfb31179b050ce1 upstream. This patch adds a check for the GPIOs property existence, before the GPIO is requested. This fixes an issue seen when the 8250 mctrl_gpio support is added (2nd patch in this patch series) on x86 platforms using ACPI. Here Mika's comments from 2016-08-09: " I noticed that with v4.8-rc1 serial console of some of our Broxton systems does not work properly anymore. I'm able to see output but input does not work. I bisected it down to commit 4ef03d328769eddbfeca1f1c958fdb181a69c341 ("tty/serial/8250: use mctrl_gpio helpers"). The reason why it fails is that in ACPI we do not have names for GPIOs (except when _DSD is used) so we use the "idx" to index into _CRS GPIO resources. Now mctrl_gpio_init_noauto() goes through a list of GPIOs calling devm_gpiod_get_index_optional() passing "idx" of 0 for each. The UART device in Broxton has following (simplified) ACPI description: Device (URT4) { ... Name (_CRS, ResourceTemplate () { GpioIo (Exclusive, PullDefault, 0x0000, 0x0000, IoRestrictionOutputOnly, "\\_SB.GPO0", 0x00, ResourceConsumer) { 0x003A } GpioIo (Exclusive, PullDefault, 0x0000, 0x0000, IoRestrictionOutputOnly, "\\_SB.GPO0", 0x00, ResourceConsumer) { 0x003D } }) In this case it finds the first GPIO (0x003A which happens to be RX pin for that UART), turns it into GPIO which then breaks input for the UART device. This also breaks systems with bluetooth connected to UART (those typically have some GPIOs in their _CRS). Any ideas how to fix this? We cannot just drop the _CRS index lookup fallback because that would break many existing machines out there so maybe we can limit this to only DT enabled machines. Or alternatively probe if the property first exists before trying to acquire the GPIOs (using device_property_present()). " This patch implements the fix suggested by Mika in his statement above. Signed-off-by: Stefan Roese Reviewed-by: Mika Westerberg Reviewed-by: Andy Shevchenko Tested-by: Yegor Yefremov Cc: Mika Westerberg Cc: Andy Shevchenko Cc: Yegor Yefremov Cc: Greg Kroah-Hartman Cc: Giulio Benetti Signed-off-by: Greg Kroah-Hartman [PL: Included slab.h for build error] Signed-off-by: Lad Prabhakar --- drivers/tty/serial/serial_mctrl_gpio.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c index 2b5329a3d716..18dfba725239 100644 --- a/drivers/tty/serial/serial_mctrl_gpio.c +++ b/drivers/tty/serial/serial_mctrl_gpio.c @@ -20,7 +20,9 @@ #include #include #include +#include #include +#include #include "serial_mctrl_gpio.h" @@ -102,6 +104,19 @@ struct mctrl_gpios *mctrl_gpio_init_noauto(struct device *dev, unsigned int idx) for (i = 0; i < UART_GPIO_MAX; i++) { enum gpiod_flags flags; + char *gpio_str; + bool present; + + /* Check if GPIO property exists and continue if not */ + gpio_str = kasprintf(GFP_KERNEL, "%s-gpios", + mctrl_gpios_desc[i].name); + if (!gpio_str) + continue; + + present = device_property_present(dev, gpio_str); + kfree(gpio_str); + if (!present) + continue; if (mctrl_gpios_desc[i].dir_out) flags = GPIOD_OUT_LOW; From patchwork Thu Sep 3 14:27:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lad Prabhakar X-Patchwork-Id: 11753733 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6DBB7618 for ; Thu, 3 Sep 2020 14:27:25 +0000 (UTC) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4612F2072A for ; Thu, 3 Sep 2020 14:27:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=lists.cip-project.org header.i=@lists.cip-project.org header.b="i70z/AKR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4612F2072A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bp.renesas.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=bounce+64572+5391+4520428+8129116@lists.cip-project.org X-Received: by 127.0.0.2 with SMTP id qx7UYY4521763x4qWIjOnWqx; Thu, 03 Sep 2020 07:27:24 -0700 X-Received: from relmlie6.idc.renesas.com (relmlie6.idc.renesas.com []) by mx.groups.io with SMTP id smtpd.web11.15150.1599143242092612777 for ; Thu, 03 Sep 2020 07:27:24 -0700 X-IronPort-AV: E=Sophos;i="5.76,387,1592838000"; d="scan'208";a="56080646" X-Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 03 Sep 2020 23:27:24 +0900 X-Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 3B47040062CD; Thu, 3 Sep 2020 23:27:23 +0900 (JST) From: "Lad Prabhakar" To: cip-dev@lists.cip-project.org, Nobuhiro Iwamatsu , Pavel Machek Cc: Biju Das Subject: [cip-dev] [PATCH 4.4.y-cip 2/4] serial: sh-sci: Terminate TX DMA during buffer flushing Date: Thu, 3 Sep 2020 15:27:17 +0100 Message-Id: <20200903142719.13010-3-prabhakar.mahadev-lad.rj@bp.renesas.com> In-Reply-To: <20200903142719.13010-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20200903142719.13010-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: Bulk List-Unsubscribe: Sender: cip-dev@lists.cip-project.org List-Id: Mailing-List: list cip-dev@lists.cip-project.org; contact cip-dev+owner@lists.cip-project.org Delivered-To: mailing list cip-dev@lists.cip-project.org Reply-To: cip-dev@lists.cip-project.org X-Gm-Message-State: zqYTuHzG2JJxFQEQncNevWjLx4520428AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.cip-project.org; q=dns/txt; s=20140610; t=1599143244; bh=CDeSPUjS5FiSghDCuInDzENW8fVdaXFGqNUjPr8wulY=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=i70z/AKR6qMpGVcyGz3CLR+bFuCwvI5YtyVRdlgdzZGEGAragF+CMWK4/sg9CXRiWeG aCrFMzFYwFtsSwONldhgtabRj7qIkH51imdS7vz87FovOuoZkbU9V58KoAA5583klcMCY 49NnzJA1TSON7TUK3ddjmE2JB+GWi5Dv0ao= From: Geert Uytterhoeven commit 775b7ffd7d6d5db320d99b0a485c51e04dfcf9f1 upstream. While the .flush_buffer() callback clears sci_port.tx_dma_len since commit 1cf4a7efdc71cab8 ("serial: sh-sci: Fix race condition causing garbage during shutdown"), it does not terminate a transmit DMA operation that may be in progress. Fix this by terminating any pending DMA operations, and resetting the corresponding cookie. Signed-off-by: Geert Uytterhoeven Reviewed-by: Eugeniu Rosca Tested-by: Eugeniu Rosca Link: https://lore.kernel.org/r/20190624123540.20629-3-geert+renesas@glider.be Signed-off-by: Greg Kroah-Hartman Signed-off-by: Lad Prabhakar --- drivers/tty/serial/sh-sci.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 2b5b342b7462..166ca04aad4e 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1475,11 +1475,18 @@ static void sci_free_dma(struct uart_port *port) static void sci_flush_buffer(struct uart_port *port) { + struct sci_port *s = to_sci_port(port); + /* * In uart_flush_buffer(), the xmit circular buffer has just been - * cleared, so we have to reset tx_dma_len accordingly. + * cleared, so we have to reset tx_dma_len accordingly, and stop any + * pending transfers */ - to_sci_port(port)->tx_dma_len = 0; + s->tx_dma_len = 0; + if (s->chan_tx) { + dmaengine_terminate_async(s->chan_tx); + s->cookie_tx = -EINVAL; + } } #else /* !CONFIG_SERIAL_SH_SCI_DMA */ static inline void sci_request_dma(struct uart_port *port) From patchwork Thu Sep 3 14:27:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lad Prabhakar X-Patchwork-Id: 11753737 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ACF5914E3 for ; Thu, 3 Sep 2020 14:27:26 +0000 (UTC) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 885382072A for ; Thu, 3 Sep 2020 14:27:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=lists.cip-project.org header.i=@lists.cip-project.org header.b="Dt9AO7RM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 885382072A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bp.renesas.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=bounce+64572+5393+4520428+8129116@lists.cip-project.org X-Received: by 127.0.0.2 with SMTP id tV4SYY4521763xHvinIu5dfH; Thu, 03 Sep 2020 07:27:26 -0700 X-Received: from relmlie5.idc.renesas.com (relmlie5.idc.renesas.com []) by mx.groups.io with SMTP id smtpd.web12.15229.1599143244490577166 for ; Thu, 03 Sep 2020 07:27:25 -0700 X-IronPort-AV: E=Sophos;i="5.76,387,1592838000"; d="scan'208";a="56296904" X-Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 03 Sep 2020 23:27:25 +0900 X-Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 853A040062CD; Thu, 3 Sep 2020 23:27:24 +0900 (JST) From: "Lad Prabhakar" To: cip-dev@lists.cip-project.org, Nobuhiro Iwamatsu , Pavel Machek Cc: Biju Das Subject: [cip-dev] [PATCH 4.4.y-cip 3/4] serial: sh-sci: Don't check for mctrl_gpio_init() returning -ENOSYS Date: Thu, 3 Sep 2020 15:27:18 +0100 Message-Id: <20200903142719.13010-4-prabhakar.mahadev-lad.rj@bp.renesas.com> In-Reply-To: <20200903142719.13010-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20200903142719.13010-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: Bulk List-Unsubscribe: Sender: cip-dev@lists.cip-project.org List-Id: Mailing-List: list cip-dev@lists.cip-project.org; contact cip-dev+owner@lists.cip-project.org Delivered-To: mailing list cip-dev@lists.cip-project.org Reply-To: cip-dev@lists.cip-project.org X-Gm-Message-State: BcbUWqz2MXWpGCFmEkkxuDF2x4520428AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.cip-project.org; q=dns/txt; s=20140610; t=1599143246; bh=AwNQ9VvBqJR1vHpfKpqZCeCAKWBo3j7UR4cavCwyMSk=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=Dt9AO7RM7cqXIJYmc9eH/dHRc+Og5C10QQnbGa2Fu+8HNBjLz75jsCzFrhQ/eF9bpQY 5Q4prcw6tIzufcX1NZa0rzCpRG91+fgErN2Z9To7EtN29IvUfCcJm522PaS1gIeE90X3q MgGcQerV1+T8jCyGKsjplvznw57/Ck6agZ4= From: Frieder Schrempf commit e55a09732be9b4e13cf3b5d2b9bb41b3e60e5ea6 upstream. Now that the mctrl_gpio code returns NULL instead of ERR_PTR(-ENOSYS) if CONFIG_GPIOLIB is disabled, we can safely remove this check. Signed-off-by: Frieder Schrempf Acked-by: Uwe Kleine-Knig Link: https://lore.kernel.org/r/20190802100349.8659-3-frieder.schrempf@kontron.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Lad Prabhakar --- drivers/tty/serial/sh-sci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 166ca04aad4e..7d7008e4dc75 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -2778,7 +2778,7 @@ static int sci_probe_single(struct platform_device *dev, return ret; sciport->gpios = mctrl_gpio_init(&sciport->port, 0); - if (IS_ERR(sciport->gpios) && PTR_ERR(sciport->gpios) != -ENOSYS) + if (IS_ERR(sciport->gpios)) return PTR_ERR(sciport->gpios); if (p->capabilities & SCIx_HAVE_RTSCTS) { From patchwork Thu Sep 3 14:27:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lad Prabhakar X-Patchwork-Id: 11753739 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E72CE14E3 for ; Thu, 3 Sep 2020 14:27:27 +0000 (UTC) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C0CEF206EB for ; Thu, 3 Sep 2020 14:27:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=lists.cip-project.org header.i=@lists.cip-project.org header.b="QQg+2As5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0CEF206EB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bp.renesas.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=bounce+64572+5394+4520428+8129116@lists.cip-project.org X-Received: by 127.0.0.2 with SMTP id W1A5YY4521763xAbkOlluXN3; Thu, 03 Sep 2020 07:27:27 -0700 X-Received: from relmlie6.idc.renesas.com (relmlie6.idc.renesas.com []) by mx.groups.io with SMTP id smtpd.web11.15150.1599143242092612777 for ; Thu, 03 Sep 2020 07:27:27 -0700 X-IronPort-AV: E=Sophos;i="5.76,387,1592838000"; d="scan'208";a="56080650" X-Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 03 Sep 2020 23:27:26 +0900 X-Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id CCBA340062AB; Thu, 3 Sep 2020 23:27:25 +0900 (JST) From: "Lad Prabhakar" To: cip-dev@lists.cip-project.org, Nobuhiro Iwamatsu , Pavel Machek Cc: Biju Das Subject: [cip-dev] [PATCH 4.4.y-cip 4/4] serial: sh-sci: Don't check for mctrl_gpio_to_gpiod() returning error Date: Thu, 3 Sep 2020 15:27:19 +0100 Message-Id: <20200903142719.13010-5-prabhakar.mahadev-lad.rj@bp.renesas.com> In-Reply-To: <20200903142719.13010-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20200903142719.13010-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: Bulk List-Unsubscribe: Sender: cip-dev@lists.cip-project.org List-Id: Mailing-List: list cip-dev@lists.cip-project.org; contact cip-dev+owner@lists.cip-project.org Delivered-To: mailing list cip-dev@lists.cip-project.org Reply-To: cip-dev@lists.cip-project.org X-Gm-Message-State: GmJ6DsIbiIaZEsK7g4MbZFQax4520428AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.cip-project.org; q=dns/txt; s=20140610; t=1599143247; bh=2tqR2s1WC3pcAbwvazQ5hXNnA2yraGPEAlb0vWElncc=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=QQg+2As5z6cQZ8pXQoKz6pa97mEgG3/930vC0t+xBi1u1AwWltPsQlzDnJmXkyZWGfc UYrq+GiZAd6fYqYt2U5plMkrDs2TpUe+VZbhdtWN5ik1MCWTniCN+b+rHQzzhAQ0sTvHW kylFZi0bh11ZXwlxVHnCdlAnAU/LRQIEVH0= From: Geert Uytterhoeven commit a16c4c5a9cb6368a08c457b6b2dc0be25958dfc0 upstream. Since commit 1d267ea6539f2663 ("serial: mctrl-gpio: simplify init routine"), mctrl_gpio_init() returns failure if the assignment to any member of the gpio array results in an error pointer. Since commit c359522194593815 ("serial: mctrl_gpio: Avoid probe failures in case of missing gpiolib"), mctrl_gpio_to_gpiod() returns NULL in the !CONFIG_GPIOLIB case. Hence there is no longer a need to check for mctrl_gpio_to_gpiod() returning an error value. A simple NULL check is sufficient. This follows the spirit of commit 445df7ff3fd1a0a9 ("serial: mctrl-gpio: drop usages of IS_ERR_OR_NULL") in the mctrl-gpio core. Signed-off-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/20190814092924.13857-4-geert+renesas@glider.be Signed-off-by: Greg Kroah-Hartman Signed-off-by: Lad Prabhakar --- drivers/tty/serial/sh-sci.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 7d7008e4dc75..c40cf1cb45d2 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1871,12 +1871,12 @@ static unsigned int sci_get_mctrl(struct uart_port *port) if (s->autorts) { if (sci_get_cts(port)) mctrl |= TIOCM_CTS; - } else if (IS_ERR_OR_NULL(mctrl_gpio_to_gpiod(gpios, UART_GPIO_CTS))) { + } else if (!mctrl_gpio_to_gpiod(gpios, UART_GPIO_CTS)) { mctrl |= TIOCM_CTS; } - if (IS_ERR_OR_NULL(mctrl_gpio_to_gpiod(gpios, UART_GPIO_DSR))) + if (!mctrl_gpio_to_gpiod(gpios, UART_GPIO_DSR)) mctrl |= TIOCM_DSR; - if (IS_ERR_OR_NULL(mctrl_gpio_to_gpiod(gpios, UART_GPIO_DCD))) + if (!mctrl_gpio_to_gpiod(gpios, UART_GPIO_DCD)) mctrl |= TIOCM_CAR; return mctrl; @@ -2782,10 +2782,8 @@ static int sci_probe_single(struct platform_device *dev, return PTR_ERR(sciport->gpios); if (p->capabilities & SCIx_HAVE_RTSCTS) { - if (!IS_ERR_OR_NULL(mctrl_gpio_to_gpiod(sciport->gpios, - UART_GPIO_CTS)) || - !IS_ERR_OR_NULL(mctrl_gpio_to_gpiod(sciport->gpios, - UART_GPIO_RTS))) { + if (mctrl_gpio_to_gpiod(sciport->gpios, UART_GPIO_CTS) || + mctrl_gpio_to_gpiod(sciport->gpios, UART_GPIO_RTS)) { dev_err(&dev->dev, "Conflicting RTS/CTS config\n"); return -EINVAL; }