From patchwork Wed Nov 23 11:07:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24904 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2723999wrr; Wed, 23 Nov 2022 03:14:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Hqp1cHzyG2TqmJDzL14rqNwnThxk3T2sEnRwsxEUPzP4bbQJ5nyWekMlZv78s4Kjh2n5/ X-Received: by 2002:a17:906:a2da:b0:7ad:84d1:5b56 with SMTP id by26-20020a170906a2da00b007ad84d15b56mr24141170ejb.205.1669202043999; Wed, 23 Nov 2022 03:14:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669202043; cv=none; d=google.com; s=arc-20160816; b=ER2P4PqXincWNGcWYhBxyFuBOIKCfiymOM/Cs1Q9sjVzFFXaLf7LNWknyk8a4GzO0u fcdotYgKnDx5IMMwQYng3dJnz7pXckJCCGTemeZZZknyue3Qu+687mxD09txUv14Hmny 6rMmi3xebLZgC4hrns5iUa7jtRyEObxBsV4h5IRLP0wEB0/l4YRkQKInBdm4l7/GPqRK Xbe2RUwFdVgxIfW4xSULb7xqt7ZQHHtCqnLyj5f9KTuxIuQSsHp0wRtRuXfvTGmNFoYf VRuBfEatZ+gIyyOT01BuL4gZgM/CgKavRqaPzWMKcUTAuQ8oEpjc5QcURdZtCB9u0rwb FggQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=x1c6aXOWkMzrvJWb4ybDXSFS8VHGCMiU8NIu3wtX2eo=; b=VHULMI+XPozAyyoy1Cub6grnVuNHsD7PQEkGOOpT4XBMFzdjRzAj9Xx42cLblOlerY 3os/hGhlugX3AsalJoBjB5Q+wUlYsA98XnUAuPxCh/VY4SQqMBOQsTEJtjn+GECDv67H gVLuhYi6xsoz4zAx0RXMehS6YudsiGlppBX+CZGPAqKhrKkojEfsgH1N2r5ezbXKkKVC LrGO1+lhgDo/G0n1JoRgAvuefgrYWYrkcoGPYYE2wMcLQF5asbij69XGDnfc83huoW4S fvH784CXhX+BqRA/Ce7IBaOZQ1j7Qo5MnIFZ3415PyNhc/c9yRxBcEmcp23IAV+6zKLd IjSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=HO6rRErB; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg34-20020a170907a42200b00791a7e441a3si15601837ejc.459.2022.11.23.03.13.39; Wed, 23 Nov 2022 03:14:03 -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; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=HO6rRErB; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235512AbiKWLIw (ORCPT + 99 others); Wed, 23 Nov 2022 06:08:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237346AbiKWLI1 (ORCPT ); Wed, 23 Nov 2022 06:08:27 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E9FE769E3 for ; Wed, 23 Nov 2022 03:08:07 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id t4so12773420wmj.5 for ; Wed, 23 Nov 2022 03:08:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=x1c6aXOWkMzrvJWb4ybDXSFS8VHGCMiU8NIu3wtX2eo=; b=HO6rRErBa5WC4+W0m4lWktk41ZOKtq1l80wJAS6kifVdU/VBWAcpD8W+FIxDrv4Poi JWSsTDzLuhK2OGkA4upMaTSRqpH71EGrfOvFkvkVN9RbRCc6oCByaY+XzbzIRAdBiOzO 88N8JPGvDM5BmMLTyK7huPCWtGyiHFvJsnpYx9R4e0YcyC2LoumSql33RCkEusDLOAI1 AEiTVAA8bAHfQghA0rewIa8uG8RqAkiL4tENg9mJY3vCyUcVRC+92qWPSui9+O7rRSTT UgAaeWu2A3LlvOgDApbyFZCwVb5nwUTAbdujK3QWe6n3GTbhnMZoimQCkoUs9eb+NXgm gA+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=x1c6aXOWkMzrvJWb4ybDXSFS8VHGCMiU8NIu3wtX2eo=; b=mhtwdud0HrKC01UKkeMOUUyWYBZ7r9XNYSwGiazo3lB7M9x1RtGKQnudRRpNxHatav NPxrc9gm/b/Xai6HPPVbphrmxoJX4XZ/wuv8LZfvo61YrP6zhxZ972gb12wLCgMcZeAf FqzcXq9MHVz/TavjcA6RsC6MgltyPtWxMn/0wJXEZL6+7No8BKOIkF+MnqkgfGa8SnJ9 HyQRswIhOE6TCVqXN5Mj4Qm4dDMZBzYn9EWccKqCzdhkpydA5s3v17dGoL906GyN6j/X tHKxR+xTqywFPEc5zY0Tect0P+m/1c5XWOU/XnBRTN5PmPcq3vOhDecafWcuRXxt/0VQ iQHg== X-Gm-Message-State: ANoB5plrZ2cHih/M/zPa+Ohen6F1QKD1e0rBfAKn9uu5swBce5LXRJ1A iUDxnh1tDYUBy7fBp1PNPRdm/w== X-Received: by 2002:a1c:f616:0:b0:3cf:b1c2:c911 with SMTP id w22-20020a1cf616000000b003cfb1c2c911mr12434503wmc.16.1669201685540; Wed, 23 Nov 2022 03:08:05 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:ae74:d94f:4677:3378]) by smtp.gmail.com with ESMTPSA id f13-20020a05600c4e8d00b003c6c182bef9sm2560406wmq.36.2022.11.23.03.08.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 03:08:05 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski , Konrad Dybcio Subject: [PATCH v3 01/13] tty: serial: qcom-geni-serial: drop unneeded forward definitions Date: Wed, 23 Nov 2022 12:07:47 +0100 Message-Id: <20221123110759.1836666-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221123110759.1836666-1-brgl@bgdev.pl> References: <20221123110759.1836666-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750285202631918051?= X-GMAIL-MSGID: =?utf-8?q?1750285202631918051?= From: Bartosz Golaszewski If we shuffle the code a bit, we can drop all forward definitions of various static functions. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- drivers/tty/serial/qcom_geni_serial.c | 79 +++++++++++++-------------- 1 file changed, 37 insertions(+), 42 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 83b66b73303a..9f2212e7b5ec 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -147,11 +147,6 @@ static const struct uart_ops qcom_geni_console_pops; static const struct uart_ops qcom_geni_uart_pops; static struct uart_driver qcom_geni_console_driver; static struct uart_driver qcom_geni_uart_driver; -static int handle_rx_console(struct uart_port *uport, u32 bytes, bool drop); -static int handle_rx_uart(struct uart_port *uport, u32 bytes, bool drop); -static unsigned int qcom_geni_serial_tx_empty(struct uart_port *port); -static void qcom_geni_serial_stop_rx(struct uart_port *uport); -static void qcom_geni_serial_handle_rx(struct uart_port *uport, bool drop); #define to_dev_port(ptr, member) \ container_of(ptr, struct qcom_geni_serial_port, member) @@ -590,6 +585,11 @@ static int handle_rx_uart(struct uart_port *uport, u32 bytes, bool drop) return ret; } +static unsigned int qcom_geni_serial_tx_empty(struct uart_port *uport) +{ + return !readl(uport->membase + SE_GENI_TX_FIFO_STATUS); +} + static void qcom_geni_serial_start_tx(struct uart_port *uport) { u32 irq_en; @@ -635,25 +635,29 @@ static void qcom_geni_serial_stop_tx(struct uart_port *uport) writel(M_CMD_CANCEL_EN, uport->membase + SE_GENI_M_IRQ_CLEAR); } -static void qcom_geni_serial_start_rx(struct uart_port *uport) +static void qcom_geni_serial_handle_rx(struct uart_port *uport, bool drop) { - u32 irq_en; u32 status; + u32 word_cnt; + u32 last_word_byte_cnt; + u32 last_word_partial; + u32 total_bytes; struct qcom_geni_serial_port *port = to_dev_port(uport, uport); - status = readl(uport->membase + SE_GENI_STATUS); - if (status & S_GENI_CMD_ACTIVE) - qcom_geni_serial_stop_rx(uport); - - geni_se_setup_s_cmd(&port->se, UART_START_READ, 0); - - irq_en = readl(uport->membase + SE_GENI_S_IRQ_EN); - irq_en |= S_RX_FIFO_WATERMARK_EN | S_RX_FIFO_LAST_EN; - writel(irq_en, uport->membase + SE_GENI_S_IRQ_EN); + status = readl(uport->membase + SE_GENI_RX_FIFO_STATUS); + word_cnt = status & RX_FIFO_WC_MSK; + last_word_partial = status & RX_LAST; + last_word_byte_cnt = (status & RX_LAST_BYTE_VALID_MSK) >> + RX_LAST_BYTE_VALID_SHFT; - irq_en = readl(uport->membase + SE_GENI_M_IRQ_EN); - irq_en |= M_RX_FIFO_WATERMARK_EN | M_RX_FIFO_LAST_EN; - writel(irq_en, uport->membase + SE_GENI_M_IRQ_EN); + if (!word_cnt) + return; + total_bytes = BYTES_PER_FIFO_WORD * (word_cnt - 1); + if (last_word_partial && last_word_byte_cnt) + total_bytes += last_word_byte_cnt; + else + total_bytes += BYTES_PER_FIFO_WORD; + port->handle_rx(uport, total_bytes, drop); } static void qcom_geni_serial_stop_rx(struct uart_port *uport) @@ -694,29 +698,25 @@ static void qcom_geni_serial_stop_rx(struct uart_port *uport) qcom_geni_serial_abort_rx(uport); } -static void qcom_geni_serial_handle_rx(struct uart_port *uport, bool drop) +static void qcom_geni_serial_start_rx(struct uart_port *uport) { + u32 irq_en; u32 status; - u32 word_cnt; - u32 last_word_byte_cnt; - u32 last_word_partial; - u32 total_bytes; struct qcom_geni_serial_port *port = to_dev_port(uport, uport); - status = readl(uport->membase + SE_GENI_RX_FIFO_STATUS); - word_cnt = status & RX_FIFO_WC_MSK; - last_word_partial = status & RX_LAST; - last_word_byte_cnt = (status & RX_LAST_BYTE_VALID_MSK) >> - RX_LAST_BYTE_VALID_SHFT; + status = readl(uport->membase + SE_GENI_STATUS); + if (status & S_GENI_CMD_ACTIVE) + qcom_geni_serial_stop_rx(uport); - if (!word_cnt) - return; - total_bytes = BYTES_PER_FIFO_WORD * (word_cnt - 1); - if (last_word_partial && last_word_byte_cnt) - total_bytes += last_word_byte_cnt; - else - total_bytes += BYTES_PER_FIFO_WORD; - port->handle_rx(uport, total_bytes, drop); + geni_se_setup_s_cmd(&port->se, UART_START_READ, 0); + + irq_en = readl(uport->membase + SE_GENI_S_IRQ_EN); + irq_en |= S_RX_FIFO_WATERMARK_EN | S_RX_FIFO_LAST_EN; + writel(irq_en, uport->membase + SE_GENI_S_IRQ_EN); + + irq_en = readl(uport->membase + SE_GENI_M_IRQ_EN); + irq_en |= M_RX_FIFO_WATERMARK_EN | M_RX_FIFO_LAST_EN; + writel(irq_en, uport->membase + SE_GENI_M_IRQ_EN); } static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done, @@ -1122,11 +1122,6 @@ static void qcom_geni_serial_set_termios(struct uart_port *uport, qcom_geni_serial_start_rx(uport); } -static unsigned int qcom_geni_serial_tx_empty(struct uart_port *uport) -{ - return !readl(uport->membase + SE_GENI_TX_FIFO_STATUS); -} - #ifdef CONFIG_SERIAL_QCOM_GENI_CONSOLE static int qcom_geni_console_setup(struct console *co, char *options) { From patchwork Wed Nov 23 11:07:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24905 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2724015wrr; Wed, 23 Nov 2022 03:14:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf5DmZZe+WH9M2RkW1NwxNkpKcoK2IawzeznVxDPL9MTVytOHYfLkNIJ3v2oVn7TwJN/6Jkn X-Received: by 2002:a05:6402:5c7:b0:469:6e8f:74c1 with SMTP id n7-20020a05640205c700b004696e8f74c1mr7609431edx.334.1669202045431; Wed, 23 Nov 2022 03:14:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669202045; cv=none; d=google.com; s=arc-20160816; b=ePJn2kmeKhSaARAD78obxLtKUgv84VxG7sIl2O31mHPDg9ALipMxT9ZXVCnkMqXfFA QlurEb3EYqUSb5Gwrs1Xrio099QrRo/3O6chJCgyoiq70ZF0GxY11En/FK8yfPY5679E ENIDhz8oE76+WS0RZY78IyaOAu1Rhx0OKIVS1ws6nklC6tHjIa+v2IOpdx/ZKaRkwXBU UFNAaKQOYtXFBU6FvkjPEixh6XznukhF2jpznQQxzSF9vfOkvEGtIQJgWltZxfiN5bM0 DJ3jqtLr6+M3UrlDPV6IFj8ib8jR//ALq14uGBRUR9j2N+zfMeX/LITEuqffr//vZcln RY9A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=S89n9QHiQI/y9x3/RBBeD2hc63bXZL5TZ/yxbLwZvtk=; b=yIlnxChh4+jXNigxH2RgK3fC5i2DGixX1FZ6rn10n1+bsWi8ndncFmERZWDx3jpzvG tNhk1drE6T51mhv9PUX3Ek20EjNmyHcU/5hVL1Jle6wMul4B7OR8wpM2/TT9yfUIY7ea ju+VEZkH4SM+Es6Rnn1i0Z2urSNQI3rWIWoWkud5pId91XwEDxM/UJjFWJ6HJKy5DPC0 g6yiQTLtIKSrm8BEz4fbPEqPk4x59SzE7ob0WCxMWbl3YFRDcQna/gv0tVwQqgnwIlLx a9KDsoYbWI9leRf65wB1A7PqhvXY7JgVfHn3hZL7M9yt0MScxvd2k0vNyEmTXNmuMev/ 2FNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=YLqfKb2u; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q17-20020a056402519100b004673015ab88si15093373edd.19.2022.11.23.03.13.41; Wed, 23 Nov 2022 03:14:05 -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; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=YLqfKb2u; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236235AbiKWLI5 (ORCPT + 99 others); Wed, 23 Nov 2022 06:08:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237417AbiKWLI2 (ORCPT ); Wed, 23 Nov 2022 06:08:28 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 287046D481 for ; Wed, 23 Nov 2022 03:08:08 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id d1so16732490wrs.12 for ; Wed, 23 Nov 2022 03:08:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=S89n9QHiQI/y9x3/RBBeD2hc63bXZL5TZ/yxbLwZvtk=; b=YLqfKb2uPUZ5u8IKKS8v9dFwT1LJ3cQXBokiRhpYXLPsy0W4TeKCSP0n4hLrJWbmgQ /WyJVHReGFQoibIMoOazDY19AavkjJyJzzYTuW/q+6S3Zl2CwkSRpO0+o/yB11f+Lvlj rxPq23bonpm/1SWbJMHaqMPuecnx/k9wRrjdphPsBoJo+3k2QIVJd/g/mQB4rNWLkWJm pg2DzOdMBSgO08ySMjaT73dhp90A1xPbnCzm5gNwM7kNXW8pE2Pf0APhe8GpIrBYet1o frNq4IxSVxq7jrgFkHkt5DUItvwNqNhXd9gjyv7/yvBDF3mp9XTjCIKfeFGOh/BQxHj0 Co3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S89n9QHiQI/y9x3/RBBeD2hc63bXZL5TZ/yxbLwZvtk=; b=WvrA61zv9TfS01eCYPYZuSjFloYJBFYxd3DMYjvVtwnkxPrfaHlnqYwDJ1u5IksUix oFiJIFh7bs45La8uSWFd6+wvSBrrjBkQUxSjPdv/WAiMBCgGgJ2vvhAvJd/gxI5LnOyy +17A0iTwxfm8pJ/SqB8+tZPK1HY8tBiltx94F+qt9VCK89/68amr15Gg+S8pOM6QGbPC tc2W7vB/IX1PAnsw4u6lnM+qA+OdRdTNQk6x8neP5B2lqwe/rlG3JBZ8Ezx0RwAv2ZMt hNv899o6yweYtWyEIoy35AopQfNg2HeM8penxPHN+KKBSjJlkEc61J8EegO/psMka48F 6bAw== X-Gm-Message-State: ANoB5pk9/26AvReRKa0531A3w3ZM48sznpc4BTbsbt1jxt7qsIS78XYx 88bmQO9D/OAmVB4RcZVqdLqRfQ== X-Received: by 2002:adf:e7ce:0:b0:22e:4864:ee11 with SMTP id e14-20020adfe7ce000000b0022e4864ee11mr5599177wrn.488.1669201686677; Wed, 23 Nov 2022 03:08:06 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:ae74:d94f:4677:3378]) by smtp.gmail.com with ESMTPSA id f13-20020a05600c4e8d00b003c6c182bef9sm2560406wmq.36.2022.11.23.03.08.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 03:08:06 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski , Konrad Dybcio Subject: [PATCH v3 02/13] tty: serial: qcom-geni-serial: remove unused symbols Date: Wed, 23 Nov 2022 12:07:48 +0100 Message-Id: <20221123110759.1836666-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221123110759.1836666-1-brgl@bgdev.pl> References: <20221123110759.1836666-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750285203705058616?= X-GMAIL-MSGID: =?utf-8?q?1750285203705058616?= From: Bartosz Golaszewski Drop all unused symbols from the driver. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- drivers/tty/serial/qcom_geni_serial.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 9f2212e7b5ec..7af5df6833c7 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -42,20 +42,11 @@ #define UART_TX_PAR_EN BIT(0) #define UART_CTS_MASK BIT(1) -/* SE_UART_TX_WORD_LEN */ -#define TX_WORD_LEN_MSK GENMASK(9, 0) - /* SE_UART_TX_STOP_BIT_LEN */ -#define TX_STOP_BIT_LEN_MSK GENMASK(23, 0) #define TX_STOP_BIT_LEN_1 0 -#define TX_STOP_BIT_LEN_1_5 1 #define TX_STOP_BIT_LEN_2 2 -/* SE_UART_TX_TRANS_LEN */ -#define TX_TRANS_LEN_MSK GENMASK(23, 0) - /* SE_UART_RX_TRANS_CFG */ -#define UART_RX_INS_STATUS_BIT BIT(2) #define UART_RX_PAR_EN BIT(3) /* SE_UART_RX_WORD_LEN */ @@ -66,12 +57,9 @@ /* SE_UART_TX_PARITY_CFG/RX_PARITY_CFG */ #define PAR_CALC_EN BIT(0) -#define PAR_MODE_MSK GENMASK(2, 1) -#define PAR_MODE_SHFT 1 #define PAR_EVEN 0x00 #define PAR_ODD 0x01 #define PAR_SPACE 0x10 -#define PAR_MARK 0x11 /* SE_UART_MANUAL_RFR register fields */ #define UART_MANUAL_RFR_EN BIT(31) @@ -80,11 +68,8 @@ /* UART M_CMD OP codes */ #define UART_START_TX 0x1 -#define UART_START_BREAK 0x4 -#define UART_STOP_BREAK 0x5 /* UART S_CMD OP codes */ #define UART_START_READ 0x1 -#define UART_PARAM 0x1 #define UART_OVERSAMPLING 32 #define STALE_TIMEOUT 16 From patchwork Wed Nov 23 11:07:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24901 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2723718wrr; Wed, 23 Nov 2022 03:13:25 -0800 (PST) X-Google-Smtp-Source: AA0mqf5bAMQYT8hlYfr9pgFtzFTuI924wxEqWh8jP3CkVd5ICYDFS2DEeoRktwX5CRZmOB6BZ3y/ X-Received: by 2002:a17:902:aa4a:b0:188:d4ea:2567 with SMTP id c10-20020a170902aa4a00b00188d4ea2567mr8432222plr.155.1669202005488; Wed, 23 Nov 2022 03:13:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669202005; cv=none; d=google.com; s=arc-20160816; b=he+aBnF4Y2MQmUg7DKc/I25J7UWlAN3b6OgC4mzntsts4FapL38GQRic5Kn/UHrZ+/ Vnv/d+mxMmpvnPO/pOia3pxQKwum/8RD0rfd6wxKhQptS2v1Wo636DNvUr8YBPTekq/e QJIfxiGPFdaXAAadyiHD6hliAAci7h6etND/d+XO3zIphSbY2nOuCTMgIrP17kO5c1uk PE5blwW/h/6nRJw9zuOxM0SkQZ/Jj5/hscLJuXifCF+s/X8XkQrUesXGIdep9MjUhL5n IXUvq5pI8Pssz5tbAXDX1NUMEfWki2p1SjZVsHWUr3aEwfdCmbc7cAWyQ0+qnjLnwx7l Qf0A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7EJrTQIS5zIHcJVe/CbMMVgFbpImlTtQ6/Fo8uf0cQs=; b=G7faPDfP8VJFhpugGXToQBFtY1gpKDoGplef1t8Pm8SPx79NwxRm9ArFfUqHLLKynh vJVtOH7krw7/1zDT5JfNVSnkQbqtBW1IQ7MEPP/as0VKunMt/zkbb6fSzZMXp27OViUl wWhFWUoX3cph0V7NfHpbR3VPPlpgPkL6Zrb40UvvkEW4rJtdqVycCp6R6do74LiPMkxu LbTXTzaMT6kBNj5J9grUIAUUraSrumGa7/PzZ7idoTbahqsLntnn4PhklFOxHHFm6Ian Z9TUubrKAVsO6MVNVEDzeT/Ze49vJbNuL+xNQbElL8ReckBZJXFW3OhAb9JCzuw6bqsJ S2vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=rMOx5MBK; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p12-20020a056a000b4c00b0056d7aaaf1eesi16267753pfo.122.2022.11.23.03.13.13; Wed, 23 Nov 2022 03:13: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; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=rMOx5MBK; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237705AbiKWLJH (ORCPT + 99 others); Wed, 23 Nov 2022 06:09:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236632AbiKWLI3 (ORCPT ); Wed, 23 Nov 2022 06:08:29 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 321EE78D69 for ; Wed, 23 Nov 2022 03:08:09 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id j5-20020a05600c410500b003cfa9c0ea76so1036725wmi.3 for ; Wed, 23 Nov 2022 03:08:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7EJrTQIS5zIHcJVe/CbMMVgFbpImlTtQ6/Fo8uf0cQs=; b=rMOx5MBKnoMO8ZWepAQQOy+jX4OvsCjUIHSpwMHYbP+cYsRfQDCfrwAHDWASg8vhhM QMWejBaaSthxX85i5r2D2HCPyG+RK2GGaFDu5TnFXGv8QEF5joobcomJiES1GzOXm43J kBqHbTNoHsrPM/Ld8JJGb7y7czcK3OH72xFWbcaQu3EvTTVymJSbOPfpVmHfrbrKcmjz bLuRaedG5M1RX/nQcCt76WABWb/O5jnZIkMVbJl0BJG6xVdBbHX45uJ8vWVz3sY0yogk gXecqUhOSzuhTBy5RkrBKZDu4WKBUtQfAu2/ZctnJ9nGwJ8HwYO/J2IIAmI+wskAEO+O 2grg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7EJrTQIS5zIHcJVe/CbMMVgFbpImlTtQ6/Fo8uf0cQs=; b=Ih/XzBo51NZFpVr01T0Fv52GDHKiE1Oyh3jjrftaN7TxiqQovHBFMFQjWixWIL8KHh zB8jZdMbXvRYxy5cEuzJAyyCuRAxDYV4qnUDZbCPuyo6mwxRoQlR0/00vd6sCcGiNNGC oFc39AQpHRojQshB6NX9saqnmFiFEdjdv8SPr1PP7CE4VvDM++CxYJQMhx1kT9bUtl/c vZqsytWBYW+XucQoNk/8OqTZ7wcg+IwoF+u7Y7W8Kd6t98KNOlsqFfjgaRit+rn1sqFo yJpYVpB2fULpZVkeXq6Lgffc1+yXrrP5W3fISeRBFMmBXq1mB6tT5Mkb0XJXRxrgxmWd cp8w== X-Gm-Message-State: ANoB5plK3B++TP6DOLGJ6y1RLCXOdK/Sjkn/nvm9mW4KRz8o5oBQGfei 2STFs/dwb/0WuHy0fImGA9ljZQ== X-Received: by 2002:a05:600c:4f93:b0:3cf:a616:ccc0 with SMTP id n19-20020a05600c4f9300b003cfa616ccc0mr23819082wmq.73.1669201687597; Wed, 23 Nov 2022 03:08:07 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:ae74:d94f:4677:3378]) by smtp.gmail.com with ESMTPSA id f13-20020a05600c4e8d00b003c6c182bef9sm2560406wmq.36.2022.11.23.03.08.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 03:08:07 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski , Konrad Dybcio Subject: [PATCH v3 03/13] tty: serial: qcom-geni-serial: align #define values Date: Wed, 23 Nov 2022 12:07:49 +0100 Message-Id: <20221123110759.1836666-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221123110759.1836666-1-brgl@bgdev.pl> References: <20221123110759.1836666-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,UPPERCASE_50_75 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750285161749063637?= X-GMAIL-MSGID: =?utf-8?q?1750285161749063637?= From: Bartosz Golaszewski Keep the #define symbols aligned for better readability. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- drivers/tty/serial/qcom_geni_serial.c | 62 +++++++++++++-------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 7af5df6833c7..97ee7c074b79 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -39,57 +39,57 @@ #define SE_UART_MANUAL_RFR 0x2ac /* SE_UART_TRANS_CFG */ -#define UART_TX_PAR_EN BIT(0) -#define UART_CTS_MASK BIT(1) +#define UART_TX_PAR_EN BIT(0) +#define UART_CTS_MASK BIT(1) /* SE_UART_TX_STOP_BIT_LEN */ -#define TX_STOP_BIT_LEN_1 0 -#define TX_STOP_BIT_LEN_2 2 +#define TX_STOP_BIT_LEN_1 0 +#define TX_STOP_BIT_LEN_2 2 /* SE_UART_RX_TRANS_CFG */ -#define UART_RX_PAR_EN BIT(3) +#define UART_RX_PAR_EN BIT(3) /* SE_UART_RX_WORD_LEN */ -#define RX_WORD_LEN_MASK GENMASK(9, 0) +#define RX_WORD_LEN_MASK GENMASK(9, 0) /* SE_UART_RX_STALE_CNT */ -#define RX_STALE_CNT GENMASK(23, 0) +#define RX_STALE_CNT GENMASK(23, 0) /* SE_UART_TX_PARITY_CFG/RX_PARITY_CFG */ -#define PAR_CALC_EN BIT(0) -#define PAR_EVEN 0x00 -#define PAR_ODD 0x01 -#define PAR_SPACE 0x10 +#define PAR_CALC_EN BIT(0) +#define PAR_EVEN 0x00 +#define PAR_ODD 0x01 +#define PAR_SPACE 0x10 /* SE_UART_MANUAL_RFR register fields */ -#define UART_MANUAL_RFR_EN BIT(31) -#define UART_RFR_NOT_READY BIT(1) -#define UART_RFR_READY BIT(0) +#define UART_MANUAL_RFR_EN BIT(31) +#define UART_RFR_NOT_READY BIT(1) +#define UART_RFR_READY BIT(0) /* UART M_CMD OP codes */ -#define UART_START_TX 0x1 +#define UART_START_TX 0x1 /* UART S_CMD OP codes */ -#define UART_START_READ 0x1 - -#define UART_OVERSAMPLING 32 -#define STALE_TIMEOUT 16 -#define DEFAULT_BITS_PER_CHAR 10 -#define GENI_UART_CONS_PORTS 1 -#define GENI_UART_PORTS 3 -#define DEF_FIFO_DEPTH_WORDS 16 -#define DEF_TX_WM 2 -#define DEF_FIFO_WIDTH_BITS 32 -#define UART_RX_WM 2 +#define UART_START_READ 0x1 + +#define UART_OVERSAMPLING 32 +#define STALE_TIMEOUT 16 +#define DEFAULT_BITS_PER_CHAR 10 +#define GENI_UART_CONS_PORTS 1 +#define GENI_UART_PORTS 3 +#define DEF_FIFO_DEPTH_WORDS 16 +#define DEF_TX_WM 2 +#define DEF_FIFO_WIDTH_BITS 32 +#define UART_RX_WM 2 /* SE_UART_LOOPBACK_CFG */ -#define RX_TX_SORTED BIT(0) -#define CTS_RTS_SORTED BIT(1) -#define RX_TX_CTS_RTS_SORTED (RX_TX_SORTED | CTS_RTS_SORTED) +#define RX_TX_SORTED BIT(0) +#define CTS_RTS_SORTED BIT(1) +#define RX_TX_CTS_RTS_SORTED (RX_TX_SORTED | CTS_RTS_SORTED) /* UART pin swap value */ -#define DEFAULT_IO_MACRO_IO0_IO1_MASK GENMASK(3, 0) +#define DEFAULT_IO_MACRO_IO0_IO1_MASK GENMASK(3, 0) #define IO_MACRO_IO0_SEL 0x3 -#define DEFAULT_IO_MACRO_IO2_IO3_MASK GENMASK(15, 4) +#define DEFAULT_IO_MACRO_IO2_IO3_MASK GENMASK(15, 4) #define IO_MACRO_IO2_IO3_SWAP 0x4640 /* We always configure 4 bytes per FIFO word */ From patchwork Wed Nov 23 11:07:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24906 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2724061wrr; Wed, 23 Nov 2022 03:14:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf6aK9NIq3hrOJxPfIBPONZQEzKaZVZep0/20h4MGjjhM0+NEe+jjqRlz9x+vVFzY4nErtnu X-Received: by 2002:a05:6402:5007:b0:44e:baab:54e7 with SMTP id p7-20020a056402500700b0044ebaab54e7mr8253349eda.265.1669202053513; Wed, 23 Nov 2022 03:14:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669202053; cv=none; d=google.com; s=arc-20160816; b=OZgChHedj5uuakpRO7PDPU9N7M4Q0JArQhZq3red1HIPxmaaEhxpCBNh1PiKA2+Wo7 xAMFYT5H7e5XyCsvcP0z+RGHeALkmD6odTVrHYHuar5w+WNtlb0jUK5Be7TSwxrSUjGr iFiXoEe/qWN73wFaVqSMXAGDC478EpXH/chNU/GQFmWn8i0TB1IcuZEMh+atW9tJ9oAy UWs3xPkviuWkWyqf9Vo5xTpqX0een1PGcjNFY4fGz23M8IvxoCT83+fUIzcSgob2OWu6 DfEKP03zfUxjlzGW9VCiHh8Ux7B+15dr/k3fwx6n/GwpDXRA/7ddmT+TBBhCCx4jeBKh JHIw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DkZacf9TX3zvyVeUrL+nHxYirMYsPuTeW+Zo+lEbcT0=; b=EOU3DTU22BW3ugxWh5pJHUM7lwv6HWI4IK8fHFgV8VB+ok347CzlyJES80GXznYUjG tmThrlVbqRo7dSQNK/myeSi/0SMeiShTPY4v+IzANoknLADxaUj7LqtgeGSOJZbmBOhP wpMesZU+v4w6+z7I1eXb09PMkL/t6ylyntsoAzaaDcVOhGQTYdUO0WNAnGxsK5V4D66x ZToyoujU8loLCSfW8VECEG0aXLM4A7+6h6p9QoaVTQTawfwBRI89EFJNjgCpHUzQ2/3K xmZWmwrjt66JXLF5lUtk9Bzhb/KFVN32KnySCiOo9UhU5BKWh51CeaZ6NnmbYz41DUSs EI1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=TpYK9icu; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v8-20020a170906b00800b0078261fd56efsi11704265ejy.571.2022.11.23.03.13.49; Wed, 23 Nov 2022 03:14:13 -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; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=TpYK9icu; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236613AbiKWLJN (ORCPT + 99 others); Wed, 23 Nov 2022 06:09:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237499AbiKWLIa (ORCPT ); Wed, 23 Nov 2022 06:08:30 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03E3C74CD1 for ; Wed, 23 Nov 2022 03:08:10 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id s5so11652606wru.1 for ; Wed, 23 Nov 2022 03:08:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DkZacf9TX3zvyVeUrL+nHxYirMYsPuTeW+Zo+lEbcT0=; b=TpYK9iculPDZDpoefDVsLJ5lmcUiuXemv6LAXee6UBhJIaFqvJLLheaqxKVECcrWeC f65RSTWvLVmbRRmVQ7P7WE+1MF+bQxVZlkMI3JKeHZOyDh4MLwzyddLPwCkbRQ6ipFU4 MBlx9bpx4VcUUBLqwPCrJCIVudG87uZg0nBeyPqgwwKDOO9XN6/5JFX6/C8AGCo0aaSn iLJXoW6UlACy2IXVJMLyjDnaPLpdY85ps/Fnb81Jsl3isryI+JJzYeYDO359JDGCqjPz wc+OQTwIHTNnyQDgx6jNG4AI1Bv06Yr6IA6WgaorXyyRmW045dVJ0MOhmg/ObZMFxDQv FieA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DkZacf9TX3zvyVeUrL+nHxYirMYsPuTeW+Zo+lEbcT0=; b=lGW7o/gNRjaq+/yN6v5vqlqi/sUwAm2SkvB5gubI7p6Zdfnw+Ig/pRftp+lqPVmlT5 IJ1OE4jH/eO+f+Z6OrpOEIvtCbO6lsqz5o5qqzwqGNTQk3RTOD4UNOtnnyTke9FlQEk9 +81Zw7Cxuwf10tGZlansvSOY6avrfQGBU3g1qPf5SNoeLUhtjdvQXWtnDaWAHA5epeN9 8vTaLl2Q0tM33CRCMvKXfEEyZbwWq4KfXHBi4Pla2TiMujCJJP/kvfKGM3yd3zR3Q1z0 GBVzw+ZHoLdKpd1Ft13LNfQjxqMMOdQ9/20X30D2i2tP0BxO5lco2fTxU6NbSyvEAGZr K2aA== X-Gm-Message-State: ANoB5plijFNcVpNDKlSsiG/VWUZlr8t4Ocjpsz7Pnq6nBLbHrVWAleJQ 5BuxiXime/DKyqUOLdlxy+GZzA== X-Received: by 2002:adf:f3d0:0:b0:241:f721:3ba2 with SMTP id g16-20020adff3d0000000b00241f7213ba2mr399458wrp.681.1669201688557; Wed, 23 Nov 2022 03:08:08 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:ae74:d94f:4677:3378]) by smtp.gmail.com with ESMTPSA id f13-20020a05600c4e8d00b003c6c182bef9sm2560406wmq.36.2022.11.23.03.08.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 03:08:08 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski , Konrad Dybcio Subject: [PATCH v3 04/13] tty: serial: qcom-geni-serial: improve the to_dev_port() macro Date: Wed, 23 Nov 2022 12:07:50 +0100 Message-Id: <20221123110759.1836666-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221123110759.1836666-1-brgl@bgdev.pl> References: <20221123110759.1836666-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750285212063480261?= X-GMAIL-MSGID: =?utf-8?q?1750285212063480261?= From: Bartosz Golaszewski The member we want to resolve in struct qcom_geni_serial_port is called uport so we don't need an additional redundant parameter in this macro. While at it: turn the macro into a static inline function. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- drivers/tty/serial/qcom_geni_serial.c | 36 ++++++++++++++------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 97ee7c074b79..e4139718e084 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -133,8 +133,10 @@ static const struct uart_ops qcom_geni_uart_pops; static struct uart_driver qcom_geni_console_driver; static struct uart_driver qcom_geni_uart_driver; -#define to_dev_port(ptr, member) \ - container_of(ptr, struct qcom_geni_serial_port, member) +static inline struct qcom_geni_serial_port *to_dev_port(struct uart_port *uport) +{ + return container_of(uport, struct qcom_geni_serial_port, uport); +} static struct qcom_geni_serial_port qcom_geni_uart_ports[GENI_UART_PORTS] = { [0] = { @@ -175,7 +177,7 @@ static struct qcom_geni_serial_port qcom_geni_console_port = { static int qcom_geni_serial_request_port(struct uart_port *uport) { struct platform_device *pdev = to_platform_device(uport->dev); - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); uport->membase = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(uport->membase)) @@ -212,7 +214,7 @@ static void qcom_geni_serial_set_mctrl(struct uart_port *uport, unsigned int mctrl) { u32 uart_manual_rfr = 0; - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); if (uart_console(uport)) return; @@ -253,7 +255,7 @@ static bool qcom_geni_serial_poll_bit(struct uart_port *uport, struct qcom_geni_private_data *private_data = uport->private_data; if (private_data->drv) { - port = to_dev_port(uport, uport); + port = to_dev_port(uport); baud = port->baud; if (!baud) baud = 115200; @@ -506,7 +508,7 @@ static int handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) u32 i; unsigned char buf[sizeof(u32)]; struct tty_port *tport; - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); tport = &uport->state->port; for (i = 0; i < bytes; ) { @@ -549,7 +551,7 @@ static int handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) static int handle_rx_uart(struct uart_port *uport, u32 bytes, bool drop) { struct tty_port *tport; - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); u32 num_bytes_pw = port->tx_fifo_width / BITS_PER_BYTE; u32 words = ALIGN(bytes, num_bytes_pw) / num_bytes_pw; int ret; @@ -598,7 +600,7 @@ static void qcom_geni_serial_stop_tx(struct uart_port *uport) { u32 irq_en; u32 status; - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); irq_en = readl(uport->membase + SE_GENI_M_IRQ_EN); irq_en &= ~(M_CMD_DONE_EN | M_TX_FIFO_WATERMARK_EN); @@ -627,7 +629,7 @@ static void qcom_geni_serial_handle_rx(struct uart_port *uport, bool drop) u32 last_word_byte_cnt; u32 last_word_partial; u32 total_bytes; - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); status = readl(uport->membase + SE_GENI_RX_FIFO_STATUS); word_cnt = status & RX_FIFO_WC_MSK; @@ -649,7 +651,7 @@ static void qcom_geni_serial_stop_rx(struct uart_port *uport) { u32 irq_en; u32 status; - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); u32 s_irq_status; irq_en = readl(uport->membase + SE_GENI_S_IRQ_EN); @@ -687,7 +689,7 @@ static void qcom_geni_serial_start_rx(struct uart_port *uport) { u32 irq_en; u32 status; - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); status = readl(uport->membase + SE_GENI_STATUS); if (status & S_GENI_CMD_ACTIVE) @@ -707,7 +709,7 @@ static void qcom_geni_serial_start_rx(struct uart_port *uport) static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done, bool active) { - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); struct circ_buf *xmit = &uport->state->xmit; size_t avail; size_t remaining; @@ -803,7 +805,7 @@ static irqreturn_t qcom_geni_serial_isr(int isr, void *dev) struct uart_port *uport = dev; bool drop_rx = false; struct tty_port *tport = &uport->state->port; - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); if (uport->suspended) return IRQ_NONE; @@ -869,7 +871,7 @@ static void qcom_geni_serial_shutdown(struct uart_port *uport) static int qcom_geni_serial_port_setup(struct uart_port *uport) { - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); u32 rxstale = DEFAULT_BITS_PER_CHAR * STALE_TIMEOUT; u32 proto; u32 pin_swap; @@ -917,7 +919,7 @@ static int qcom_geni_serial_port_setup(struct uart_port *uport) static int qcom_geni_serial_startup(struct uart_port *uport) { int ret; - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); if (!port->setup) { ret = qcom_geni_serial_port_setup(uport); @@ -1003,7 +1005,7 @@ static void qcom_geni_serial_set_termios(struct uart_port *uport, u32 stop_bit_len; unsigned int clk_div; u32 ser_clk_cfg; - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); unsigned long clk_rate; u32 ver, sampling_rate; unsigned int avg_bw_core; @@ -1288,7 +1290,7 @@ static struct uart_driver qcom_geni_uart_driver = { static void qcom_geni_serial_pm(struct uart_port *uport, unsigned int new_state, unsigned int old_state) { - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); /* If we've never been called, treat it as off */ if (old_state == UART_PM_STATE_UNDEFINED) From patchwork Wed Nov 23 11:07:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24902 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2723798wrr; Wed, 23 Nov 2022 03:13:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf7fJNNvIBDXzNTsU49a0ow+ZswGYHIocDtM/LBdENBtj0/kofCcMp/Werl0Bv5C2OH9WNXv X-Received: by 2002:a17:90a:71c5:b0:213:b0e:ede8 with SMTP id m5-20020a17090a71c500b002130b0eede8mr19677573pjs.89.1669202015602; Wed, 23 Nov 2022 03:13:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669202015; cv=none; d=google.com; s=arc-20160816; b=Nhpx91RxrSZL3UCsdHyG6Fhga3w7UEwSOyzknaEpbHy3d8Z23tjgJC5rSDZOFdY1gG YZEwaixXTvCbMI/r5aMR0nRiYIfNUXs/npQExAw1F863d5TjX6ovHK5WecrInqPqtn6Z c//Jm+2fOh8OPvxHjgeCJdLg3sTz+BTNi/SEd3LhYf5rcg/Sc7HH8o0dvAca3R58x/ex iy5Okst7DO8ATvVTJxwFQ5cdhTor2lk6Em3j8qa9Gh3jeCbOjSaKEo5nQFcsQeRUi+rC ri0qf+i0/vYg1iRAbgyKZNNbhj7o+f8p2ALdVynCB02Pgfqu2LoyPOcOA8OIuXsHJVsK 6D4Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EonL2PwB0Makj2JepNmLczYfWSZatIPogqShuTJezMI=; b=v6+rKgeWI/IEKIjFSO4VDMTYsBQIRsC8HKAhEiW3D9X9cUVNpYa7MYk2cmui354C5q T13fU6FalNHenzcuJ+0v9dCY67CzqjAyQRx/cc8hRFOBT6HSGlYr5GgMv6EijTvHXd+A DGirzvIYxR+zH1zGj1IsQeSDw0OxhNVQo2ib4uXRoK+z4kcUTIv7dsNzSRcr54++y5Aq TavuTdwlcZMIR9xSPz39yd4dGfSdgbcl8Bot9fFjjrwq8ZQJxhWBosqoL5ficbCB+Fn0 mQ+QfGu5zkaV58bJfkYk0RGC0pcba873jcmdzWPK2p4pQG2xRxv+fWnzaV2m/XmG3m12 QVZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=y+h8KSTl; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b19-20020a056a000a9300b0056bcbc51d79si18039428pfl.169.2022.11.23.03.13.22; Wed, 23 Nov 2022 03:13:35 -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; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=y+h8KSTl; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237057AbiKWLJZ (ORCPT + 99 others); Wed, 23 Nov 2022 06:09:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237539AbiKWLIb (ORCPT ); Wed, 23 Nov 2022 06:08:31 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7CC28DA6F for ; Wed, 23 Nov 2022 03:08:10 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id cl5so28866989wrb.9 for ; Wed, 23 Nov 2022 03:08:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EonL2PwB0Makj2JepNmLczYfWSZatIPogqShuTJezMI=; b=y+h8KSTlvJEDdoUPd4LwiIlAz/2krzVRVWUIA2XxuS+VYYpNHMGi3UVCblbh0TcuAa ZIlRRcdXqugHD1hgmV1Qfc1y5TGepgh9rUQM8rJ6g7ApdKGFAxym87H/urDdRayYvWXf 2IrXxRq+bXsjg8MnjI6AFK7QW9bhav0ftKbu+jC1cYzRnHn8e5k1ofFdBSkg/AB2YpZ2 DoPGElPz9rigwi7f1opVlTz82twOy1YL+56i2TKsOEMt/k1QGSwwqzv1PGdgUsGLNRit 4izPXRymbCFuFiSw9xCLsTZXgC7c8/vHMjYZ9FcRNxbQkvTidKnlOXUKJuPfRDQxkaSc 2opA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EonL2PwB0Makj2JepNmLczYfWSZatIPogqShuTJezMI=; b=xggr48O6LpIUsFHrMWaeGXMHk05G6zH7nEw6p8PqONcgZkojvWYvQPi11kheyBi4Y/ gwDYWUlOrOLRmxca1r0+CeqUct4wepj8tTrFnBJydsWzfGVUoZmvB4naCcGNgMiw6eoK 6wGWw7uTlLNO51B/7mfjF3PXOwqDapz0U4nxMfmrD54e7f8KF2mhKyUQVli3NC1iPjDu OWdmIcYUynf8xWMQ3Re1/pB950JFDVOCyYFgMYODfHijZNuzQRnQEtzW3urOTOALStN/ /r3FcLgs3++MADd8OE+XIEMfJ9bBtXsmNzf7hx8RV5ezmD3o20BdK88NEUoekiydVzxY 8pcg== X-Gm-Message-State: ANoB5plaUaXK8aKsxgj8DjGuAAsTia4s1vWhJ/+ewJH5I4s2AzkdlOJO w2ty86ULCUTUTEEl0ru5AYA+Fw== X-Received: by 2002:adf:ff83:0:b0:236:6824:c227 with SMTP id j3-20020adfff83000000b002366824c227mr17330446wrr.510.1669201689497; Wed, 23 Nov 2022 03:08:09 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:ae74:d94f:4677:3378]) by smtp.gmail.com with ESMTPSA id f13-20020a05600c4e8d00b003c6c182bef9sm2560406wmq.36.2022.11.23.03.08.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 03:08:09 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski , Konrad Dybcio Subject: [PATCH v3 05/13] tty: serial: qcom-geni-serial: remove stray newlines Date: Wed, 23 Nov 2022 12:07:51 +0100 Message-Id: <20221123110759.1836666-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221123110759.1836666-1-brgl@bgdev.pl> References: <20221123110759.1836666-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750285172429636373?= X-GMAIL-MSGID: =?utf-8?q?1750285172429636373?= From: Bartosz Golaszewski Remove stray newlines around #ifdefs for consistency with the rest of the driver code. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- drivers/tty/serial/qcom_geni_serial.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index e4139718e084..ec2523736e99 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -320,7 +320,6 @@ static void qcom_geni_serial_abort_rx(struct uart_port *uport) } #ifdef CONFIG_CONSOLE_POLL - static int qcom_geni_serial_get_char(struct uart_port *uport) { struct qcom_geni_private_data *private_data = uport->private_data; @@ -545,7 +544,6 @@ static int handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) { return -EPERM; } - #endif /* CONFIG_SERIAL_QCOM_GENI_CONSOLE */ static int handle_rx_uart(struct uart_port *uport, u32 bytes, bool drop) From patchwork Wed Nov 23 11:07:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24900 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2723714wrr; Wed, 23 Nov 2022 03:13:25 -0800 (PST) X-Google-Smtp-Source: AA0mqf5GWpRW4lTzX96I7Z19P7vsBbmn4G5HvCVOWoxNKtUDXPebBEShQ1X4SfPOEdlDpNkKf9YJ X-Received: by 2002:a17:90a:e60f:b0:218:95b9:f2f7 with SMTP id j15-20020a17090ae60f00b0021895b9f2f7mr8644706pjy.131.1669202005360; Wed, 23 Nov 2022 03:13:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669202005; cv=none; d=google.com; s=arc-20160816; b=by+e9ZVD+ZYdR0PhbEJhGYnJJ3+tlFBYoavscvDWgmnUP3zGOxAhlwwii7ehoQpMfb fzaHDcL6nqfE4okXbH47aOvxtFd5+adw2Ghnj66M6xFqH5QG0rkOj3SthcLctwsz1V0s gcAk32CQTsZzVvyU66Y3Lzhlzw51/0I3Dg65auNC/rMvBKo0YnY/bpRNV4GQJkajlqDJ 5sDG+bzHsXp/lIiJc8ZpBXTvefs/P9GUnbjAdyYyV0smfoCW6bDMr8Rpk0qYWg0hKl9R 6pTlvVn3v3FNZabrgd5d7wz8d8sQN4bcele6W8Yr0tOBzPFaObfvNIMk7x7bMg64Yjgy Zcmw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hrodxjE3++JzSf9Q5uxlAVuutjj+cagca/Bct4wXLdY=; b=Gti17PYbJJx7YymUaeB9Fyj03f8F+Vf1Xn+3OBWcI9H6TKF1jkvBhhWjByQUlx1N9w dm+FqY0PD7xNdL3UaN/IVgKXlUQQnhM64ocj2xfhTO9tXxSxPA/f8NaEsVxD9kZYYcPH E2QEVriZN4ZlOLHiHYIoOCI6/8KamIzmn+9DzUNYP04H/l7Od3KRXnNsxIyTU35Qjk+C HOfneDyJ1ul2On4vOMcbxnaykEUb/QQy/eWq5U/dl9yLh0hJ2zhtV7Rf6UJm0YNQ6iGh BUvvuriT670tKkeNUemCR+mjUIkJgqMuQ5V7Rjhu1sPry4pBFWG/RFJy5O41ZdhQh18K 5AQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b="pP4gS/HN"; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b13-20020a6541cd000000b0047767ded526si9149664pgq.100.2022.11.23.03.13.10; Wed, 23 Nov 2022 03:13: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; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b="pP4gS/HN"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236169AbiKWLJR (ORCPT + 99 others); Wed, 23 Nov 2022 06:09:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237523AbiKWLIb (ORCPT ); Wed, 23 Nov 2022 06:08:31 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9CF3898C1 for ; Wed, 23 Nov 2022 03:08:10 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id j5-20020a05600c410500b003cfa9c0ea76so1036808wmi.3 for ; Wed, 23 Nov 2022 03:08:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hrodxjE3++JzSf9Q5uxlAVuutjj+cagca/Bct4wXLdY=; b=pP4gS/HNxUf1PC9+KBEniYc8ud5tGr4nZdY/Y/d3YrZGdYbaKwpiuJPxcotoxvGsmB RW0AwYy+5Txh5eg+YnvFht6fnHY6izGJSWKIDIyyeOwwuzYP7BUz1WUyrHGi64iHXyRm 2gJLPmtG+clhzI/2typ0Agb/uwJcqiKZy55mF9EHCXUqbWM9BHO82PPflDunZq6i3awq K/8hAdBIkHzKRgHu/FpZgffAAGjMMI1nhBk7mGp73lMB4b/mi971o084WtQG2XIR+6/P OWM5cjManBcY5IipW6K+j75ZCz6qhlC82oO0eJ7rAHQ8dsWjtWf8xqghMcvfs/7KXR8/ 8odg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hrodxjE3++JzSf9Q5uxlAVuutjj+cagca/Bct4wXLdY=; b=SlC1qU2LfHHimVyM072T5pajR5Lhx8MPhYc2yTiYoIFdHzh779weRHSudjaT03Efk2 Hnxfc9vC5QtGklGulDpbtothkgbtawIbRauEocf+2OjZyLHA4eQ2mxyJ3/CvKzcjO1cg Ht56LoUO9oNXgUzKpyPqnHlLAU8XeGcWuzGYWZT38zzUdTmIqIqG4tJFxW/WMc+o5aZy Jdid2ELBmbEqpdMOXGGv1IugjK0L9F0EC/5vIf3FwsFHXT8IdK6guiwn7pUuoBPAl1nA lNJSCVPIm0toSTjidkmtIXPxXdQ7EWpO03t1etWEXKOFSjmwvqLNZi02PbnyWPk12UrU 95dw== X-Gm-Message-State: ANoB5pmPuZm/JkoSBD2IdtPNsxZ1W1KshQiA8s6ZcSndWqlMl3e+R8v5 yY81pDhGFQbWrMXzMNQIU5HJig== X-Received: by 2002:a1c:7501:0:b0:3cf:61a3:464e with SMTP id o1-20020a1c7501000000b003cf61a3464emr12946239wmc.111.1669201690423; Wed, 23 Nov 2022 03:08:10 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:ae74:d94f:4677:3378]) by smtp.gmail.com with ESMTPSA id f13-20020a05600c4e8d00b003c6c182bef9sm2560406wmq.36.2022.11.23.03.08.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 03:08:10 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski , Konrad Dybcio Subject: [PATCH v3 06/13] tty: serial: qcom-geni-serial: refactor qcom_geni_serial_isr() Date: Wed, 23 Nov 2022 12:07:52 +0100 Message-Id: <20221123110759.1836666-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221123110759.1836666-1-brgl@bgdev.pl> References: <20221123110759.1836666-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750285161856538798?= X-GMAIL-MSGID: =?utf-8?q?1750285161856538798?= From: Bartosz Golaszewski Simplify the conditions in qcom_geni_serial_isr() and fix indentation. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio Reviewed-by: Ilpo Järvinen --- drivers/tty/serial/qcom_geni_serial.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index ec2523736e99..fba02f71a874 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -827,20 +827,18 @@ static irqreturn_t qcom_geni_serial_isr(int isr, void *dev) if (m_irq_status & m_irq_en & (M_TX_FIFO_WATERMARK_EN | M_CMD_DONE_EN)) qcom_geni_serial_handle_tx(uport, m_irq_status & M_CMD_DONE_EN, - geni_status & M_GENI_CMD_ACTIVE); + geni_status & M_GENI_CMD_ACTIVE); - if (s_irq_status & S_GP_IRQ_0_EN || s_irq_status & S_GP_IRQ_1_EN) { + if (s_irq_status & (S_GP_IRQ_0_EN | S_GP_IRQ_1_EN)) { if (s_irq_status & S_GP_IRQ_0_EN) uport->icount.parity++; drop_rx = true; - } else if (s_irq_status & S_GP_IRQ_2_EN || - s_irq_status & S_GP_IRQ_3_EN) { + } else if (s_irq_status & (S_GP_IRQ_2_EN | S_GP_IRQ_3_EN)) { uport->icount.brk++; port->brk = true; } - if (s_irq_status & S_RX_FIFO_WATERMARK_EN || - s_irq_status & S_RX_FIFO_LAST_EN) + if (s_irq_status & (S_RX_FIFO_WATERMARK_EN | S_RX_FIFO_LAST_EN)) qcom_geni_serial_handle_rx(uport, drop_rx); out_unlock: From patchwork Wed Nov 23 11:07:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24907 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2724159wrr; Wed, 23 Nov 2022 03:14:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf6FCxEFiyFshWLSDwUSnq6vF0PvpwLQPPixYqCiqiNTF7l1/E6Tno2mL1+eGjjmyqGup7wo X-Received: by 2002:a17:906:18e9:b0:78d:48ac:9044 with SMTP id e9-20020a17090618e900b0078d48ac9044mr12762279ejf.613.1669202070246; Wed, 23 Nov 2022 03:14:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669202070; cv=none; d=google.com; s=arc-20160816; b=G2Rse07gBPy016f7lqN5PAbFGUUqg3pJejNotHC1pL101cG4MP2us2z9zHY/Mr4g7E +VUJqDhBjoWXLT441sx5JTuxoQ+UW2NYGXRmEMbOi539UWepyavnyt2AHIvOmR2dUToA 59eGYpXyokotz0mxiqdnTItdT26sz3uEijcVjasQ5qN7aLA0O4AhaVxVBoDiA9mihECK NfL+pX3opRXhOsJN15dx58gUrmvqm4RjeXT2jgKu6w6SbLoYJk0IYZuHT4CuWUNavX8A at5Jd24luDc0Vy32TWenpMR/FfrrMoFXCT8E3QEbgIDQmuI5lrV0iE48anzm7Pfpgc0p ZM5w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zbfRkHz4/aW9Ej0X8Fhaj4Le2T1GhSly/B7XfhIOtq0=; b=AxitjLOgNQ50lNtulBdI66Ca4tt6uelHFNjljISgS25jBAcBVmFmUtHoguAKBlGUju CZa5+JuxITeYhSN2oiQengcg5vNS6QDBlaN+C54USaaFZq503F2pUTZqkvCvzbpAKOea C01wSSdblXs8Uu/Ew5UgWt/LnSjrwWOOYvsic8gbxjL93bXQAP7BFd7hsS5qdGUrj0Qo tgyAd/Jj7U7jmBpdK64luvZSagrqvVrozzhjKV03bVB9AgqIXerwVSZBCxIov0yUmnIy e+1Z4uwCQsYj9pAqoH9QYR+jgVB4fJPX9lZ96DrR2fIjiDGgJAc6uXKd5dK8/Itpukp9 f1WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=AGy0MYOO; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h17-20020a05640250d100b00461a98a20cbsi14932239edb.187.2022.11.23.03.14.05; Wed, 23 Nov 2022 03:14:30 -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; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=AGy0MYOO; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236052AbiKWLJb (ORCPT + 99 others); Wed, 23 Nov 2022 06:09:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237571AbiKWLIc (ORCPT ); Wed, 23 Nov 2022 06:08:32 -0500 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7D349A5E3 for ; Wed, 23 Nov 2022 03:08:12 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id i12so24982662wrb.0 for ; Wed, 23 Nov 2022 03:08:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zbfRkHz4/aW9Ej0X8Fhaj4Le2T1GhSly/B7XfhIOtq0=; b=AGy0MYOOnKebCT2KvF1CA0lwhTW5qhu60TOQyMYjiIwYYdPvzBjMuqCy34ZDxnOxAa /noqVpIyDg6WR3oa8Q7ty/FSxYJjUcMqDLC0h71qbKFJaMTS9lNxf1s+SG+Pv3iK8o9P KaFXodivUlB865KxyrafFF6OAobC87eZ5mpN1Zd7iX70ciN0aZJsGdpAyr7br6/WhF6u +787dPruWXzqtJx7coNQAyKBlgKm+Xn9MxwYt3IjRLM9OJdOEsyUBNYnFYHn35ZRTAux HAFIgGzIEDnPEMIUK2RbRrdAmKc+6wcIV675j+zrsYJg4qi7kkvp/UshHndKfMe5E8x4 6pXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zbfRkHz4/aW9Ej0X8Fhaj4Le2T1GhSly/B7XfhIOtq0=; b=xLNFJQfHbjo5z72sz/Tost9ttF09Gfq+n5Grxw9Jdh5s1ubNJUNlmcE9fmZcXV7rnV SB54sL3VCdVGgHOMMJD3jC8PZOGXIOk4VsZQuIc0VbAZfVVHJH2gzA5mW4aTxRykf65C eEWTKoHiyUrnA9peYcHH1iS9L9sDh+tgXHl3Jgy++upc1r2VTWZk2XSKNvJCp3iu8nfn LUoax/0tBVWk2T6xSLjYFhYgbfu/HGUXpWssZ0eHbN/OUwV6Z9sGi9L5pUrdIYgk+74d tpI20gcqiib3WpNawCvNGoB0klMxKBNqB7AP0E29mpdkcMv60fYwLJBl/nxDsRvlyT+g 9b9Q== X-Gm-Message-State: ANoB5pkap46vl9zL+nj6Av7czF5llt+iVcJZixkqeoI+KUHG06/KQF3n XWC4ma89QpPQYN3EGv1srHjg4g== X-Received: by 2002:a5d:4e43:0:b0:241:d029:e98b with SMTP id r3-20020a5d4e43000000b00241d029e98bmr9305875wrt.551.1669201691326; Wed, 23 Nov 2022 03:08:11 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:ae74:d94f:4677:3378]) by smtp.gmail.com with ESMTPSA id f13-20020a05600c4e8d00b003c6c182bef9sm2560406wmq.36.2022.11.23.03.08.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 03:08:11 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski , Konrad Dybcio Subject: [PATCH v3 07/13] tty: serial: qcom-geni-serial: remove unneeded tabs Date: Wed, 23 Nov 2022 12:07:53 +0100 Message-Id: <20221123110759.1836666-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221123110759.1836666-1-brgl@bgdev.pl> References: <20221123110759.1836666-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750285230177756126?= X-GMAIL-MSGID: =?utf-8?q?1750285230177756126?= From: Bartosz Golaszewski Remove redundant indentation in struct member assignment. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- drivers/tty/serial/qcom_geni_serial.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index fba02f71a874..68a1402fbe58 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -141,26 +141,26 @@ static inline struct qcom_geni_serial_port *to_dev_port(struct uart_port *uport) static struct qcom_geni_serial_port qcom_geni_uart_ports[GENI_UART_PORTS] = { [0] = { .uport = { - .iotype = UPIO_MEM, - .ops = &qcom_geni_uart_pops, - .flags = UPF_BOOT_AUTOCONF, - .line = 0, + .iotype = UPIO_MEM, + .ops = &qcom_geni_uart_pops, + .flags = UPF_BOOT_AUTOCONF, + .line = 0, }, }, [1] = { .uport = { - .iotype = UPIO_MEM, - .ops = &qcom_geni_uart_pops, - .flags = UPF_BOOT_AUTOCONF, - .line = 1, + .iotype = UPIO_MEM, + .ops = &qcom_geni_uart_pops, + .flags = UPF_BOOT_AUTOCONF, + .line = 1, }, }, [2] = { .uport = { - .iotype = UPIO_MEM, - .ops = &qcom_geni_uart_pops, - .flags = UPF_BOOT_AUTOCONF, - .line = 2, + .iotype = UPIO_MEM, + .ops = &qcom_geni_uart_pops, + .flags = UPF_BOOT_AUTOCONF, + .line = 2, }, }, }; From patchwork Wed Nov 23 11:07:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24903 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2723983wrr; Wed, 23 Nov 2022 03:14:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Z+1vgjmF9lRi4BqcImOIWM06Hc/Q4imMRvmRc+WP8RkNwvewJy//E5jGKUVuSvUrmZ/PO X-Received: by 2002:a05:6402:4a:b0:461:aa10:cb0c with SMTP id f10-20020a056402004a00b00461aa10cb0cmr25288458edu.383.1669202040306; Wed, 23 Nov 2022 03:14:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669202040; cv=none; d=google.com; s=arc-20160816; b=b2nu2Gzik+QrfKVpPBty7gvQoRGtGzlnSQqDOOnjo1PWW7kbid1SLKTGUbZUn44wpt 7E6VlDU475YHSj5NtPrryElTUjWOruAYiylFeKVNLHm0tMQ3E+LZOPJ1VocE+mQxHfC5 djHu3ty3j0UA++JM9B/x9onqAIAd/I4WGdB+5gAmKEHDbv2PHB3/p55Fx0PpXDjmRggK 4ygwJVwYiTCMfoG0SH9ENYcs7ZHsMqdMsrj3BIhaDrF7POfuLFGvbT9yS8txXP0UJhbC +y+mhT3uZZslepZ/E+cAbHqxyj7Whpeq53ZtCbSqkAPf6FBbt9/52Fr7q43Dj24hjhBG 147g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kzY04K9GyuBHm3usH7zJK0sqLLvwAU6csJcimfdY1bo=; b=mmA7jww1K/XP3PabLeyF2dml/qvsE6JamvsK4gY3McsvhB9qzaFjqpbv+mzzaBYbXs A8Oe+HE1NNrTSuBVt+a8A9yWqgGgIJ+B/tz1R5KCNxwaG2cvT0nktVpMKlXZs0DBvhCu Q74sA+WzRzM65Swp6YEHfCeXEN9dKtxlBcfYEOhKntewiSW1SzJA2tOTGwftwOdUYYAo z2TwYAu67IaklSk1YNZkY3ujHYqo+AsbPgKNEeUuqsTYOYrWxHMBAfNxDhUHap7MICHQ +igXweEDIgfuI5ka6ara5QR1dxRme9uuBlY5MY8cRUa3pPaf838Jo8pLNw7FZan4Wyvz 8/PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=SxiA56FE; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh40-20020a1709076ea800b007aec7f879basi14714647ejc.22.2022.11.23.03.13.36; Wed, 23 Nov 2022 03:14:00 -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; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=SxiA56FE; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237015AbiKWLJh (ORCPT + 99 others); Wed, 23 Nov 2022 06:09:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237619AbiKWLId (ORCPT ); Wed, 23 Nov 2022 06:08:33 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3D8A9BA14 for ; Wed, 23 Nov 2022 03:08:13 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id bs21so28863641wrb.4 for ; Wed, 23 Nov 2022 03:08:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kzY04K9GyuBHm3usH7zJK0sqLLvwAU6csJcimfdY1bo=; b=SxiA56FEPn1tTlUbvznsd9HsII5+1ZsnUYrfPdthATClaXeuh1+DSatCx06H9IKbrv 7/bWd6pe0VRT0Jau2lKEnpkt6iYiYC51ali/LiNmmatnIrZdhm83XyiG4MaR9P9H1UWE Kh4e9kBKrNhNRnWU8jdtmiIkjWNVqH4Ld7wqO4C1n2RFKLfXcml/OGJ6jMYkCvEum7DL jodgRO1kQoDRtln/s2aUNthOQM2Ftcil/KpixJs8ZK0prPq1R3iJOiY3KS55WzFN3T9G eZ9IbE+jN5H6S/6OY9+cHF5jV14dOOZeqc+APeugwZifOT9Hqp4LU4jryhmZtuHCW0Jr tzvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kzY04K9GyuBHm3usH7zJK0sqLLvwAU6csJcimfdY1bo=; b=gkUT2t20mdGu6DYOrqLDNMIqh12QNiBsrI0NVQmrlci+h97gAw8Vf6IxyNERhUKd6N wWERNUc/tD3f2Oky7hBOf7Acv2zeVSl492LxoaBg6+3Q+Iu/VMbEom+aGgTmCPf3nTZE XeTfcrYQhWKp9d6rYQKSj4RGr8HaMdo/gskuB/0s8lhttp378nnx8i3k8PWZEEhNcsmD ndJv5A/1r81eH7rQ2VnJsYMt/Ggz4gnDTKMjh7FRgEH2/zT4mdO0QtQ4JQNQb22Dsig3 jB1czTJh4/go/KuQbeokV1n2Hnbgymymbmn00iKAce1Va4zg/5ldkJ7s7WcVaPIVXiHq lSBg== X-Gm-Message-State: ANoB5pmv6TNcF39Vxb2cWtfJmd+Y9al8RmmBQBriBAPQLu/6DgbElPbj 3SKwkrTFzZxupKAxxxNMkr+WZA== X-Received: by 2002:adf:dfc6:0:b0:236:cfcf:8e36 with SMTP id q6-20020adfdfc6000000b00236cfcf8e36mr17163483wrn.323.1669201692287; Wed, 23 Nov 2022 03:08:12 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:ae74:d94f:4677:3378]) by smtp.gmail.com with ESMTPSA id f13-20020a05600c4e8d00b003c6c182bef9sm2560406wmq.36.2022.11.23.03.08.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 03:08:11 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v3 08/13] tty: serial: qcom-geni-serial: refactor qcom_geni_serial_handle_tx() Date: Wed, 23 Nov 2022 12:07:54 +0100 Message-Id: <20221123110759.1836666-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221123110759.1836666-1-brgl@bgdev.pl> References: <20221123110759.1836666-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750285198346733780?= X-GMAIL-MSGID: =?utf-8?q?1750285198346733780?= From: Bartosz Golaszewski qcom_geni_serial_handle_tx() is pretty big, let's move the code that handles the actual writing of data to a separate function which makes sense in preparation for introducing a dma variant of handle_tx(). Let's also shuffle the code a bit, drop unneeded variables and use uart_xmit_advance() instead of handling tail->xmit manually. Signed-off-by: Bartosz Golaszewski --- drivers/tty/serial/qcom_geni_serial.c | 54 +++++++++++++-------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 68a1402fbe58..658b6d596f58 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -704,19 +704,42 @@ static void qcom_geni_serial_start_rx(struct uart_port *uport) writel(irq_en, uport->membase + SE_GENI_M_IRQ_EN); } +static void qcom_geni_serial_send_chunk_fifo(struct uart_port *uport, + unsigned int chunk) +{ + struct qcom_geni_serial_port *port = to_dev_port(uport); + struct circ_buf *xmit = &uport->state->xmit; + u8 buf[BYTES_PER_FIFO_WORD]; + size_t remaining = chunk; + unsigned int tx_bytes; + int c; + + while (remaining) { + memset(buf, 0, sizeof(buf)); + tx_bytes = min_t(size_t, remaining, BYTES_PER_FIFO_WORD); + + for (c = 0; c < tx_bytes ; c++) { + buf[c] = xmit->buf[xmit->tail]; + uart_xmit_advance(uport, 1); + } + + iowrite32_rep(uport->membase + SE_GENI_TX_FIFOn, buf, 1); + + remaining -= tx_bytes; + port->tx_remaining -= tx_bytes; + } +} + static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done, bool active) { struct qcom_geni_serial_port *port = to_dev_port(uport); struct circ_buf *xmit = &uport->state->xmit; size_t avail; - size_t remaining; size_t pending; - int i; u32 status; u32 irq_en; unsigned int chunk; - int tail; status = readl(uport->membase + SE_GENI_TX_FIFO_STATUS); @@ -735,7 +758,6 @@ static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done, avail = port->tx_fifo_depth - (status & TX_FIFO_WC); avail *= BYTES_PER_FIFO_WORD; - tail = xmit->tail; chunk = min(avail, pending); if (!chunk) goto out_write_wakeup; @@ -750,29 +772,7 @@ static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done, uport->membase + SE_GENI_M_IRQ_EN); } - remaining = chunk; - for (i = 0; i < chunk; ) { - unsigned int tx_bytes; - u8 buf[sizeof(u32)]; - int c; - - memset(buf, 0, sizeof(buf)); - tx_bytes = min_t(size_t, remaining, BYTES_PER_FIFO_WORD); - - for (c = 0; c < tx_bytes ; c++) { - buf[c] = xmit->buf[tail++]; - tail &= UART_XMIT_SIZE - 1; - } - - iowrite32_rep(uport->membase + SE_GENI_TX_FIFOn, buf, 1); - - i += tx_bytes; - uport->icount.tx += tx_bytes; - remaining -= tx_bytes; - port->tx_remaining -= tx_bytes; - } - - xmit->tail = tail; + qcom_geni_serial_send_chunk_fifo(uport, chunk); /* * The tx fifo watermark is level triggered and latched. Though we had From patchwork Wed Nov 23 11:07:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24909 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2724373wrr; Wed, 23 Nov 2022 03:15:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf5sZasZDbkQaHXmGyFO9zVzS4yLGfJrCY8t5nlerj87LGI6BmIqYq9GNRGOSbYDW65opRZ5 X-Received: by 2002:a05:6402:e0d:b0:466:4168:6ea7 with SMTP id h13-20020a0564020e0d00b0046641686ea7mr24424310edh.273.1669202100939; Wed, 23 Nov 2022 03:15:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669202100; cv=none; d=google.com; s=arc-20160816; b=mFuMB589SmJQ11D7yVvpjkb70uzFLzuO0Ws9TeZoOFSLuFBDVKULGBjT2Xej/2fymt Y9eRF+kLhfhz+9c/4dGJSj9E5E8+M06w5ZGyWPWJqyvJMog8DA1W+Q4gLdMNqEsgzdmv ppxjkudSioUAqtYHRwkjFqGxJHDKkE/0TdrCUYX4YORezfPXfsLtEuqut69Mc5ChP2gc 5n4njpf24sfpUaIAdZOQA19Ojr/2388Jn1b19c2io994PNrpjD9xu9CEFoujc80Aj+CU vzc3NUTKdnxZFE4UUMhvdhc9A+qTHsJ1OfNdjgNrtRwh4MeT+5RUOXWobjzL49e4rnWF xCgQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=27Y/3dF94+Cm6VsgYrXb3WffaYznVRIrRKIsZki0OWQ=; b=hsWoL5OCJnBrL4RXa9orXNr8FTWF14hrOesDUz07Zzhtc3IMYB7wAZGUyg/IeAfJuS n2J0P4BRovkteOos9eCRc02XMigAgYnaH4ZGqMHDl+sFiqVfIQsUND51xWUd+OSSXfsa kiQFV6HjEvc7TFhi33eOOptap9AcJrF++JJHg3nwESX8GmMQHZpwZJY2DjAamnQXrZZr YeTZGre7wL5/5SuvqaCDeP5UNkVwJ3VwfbpAIaBDTsvS06kClWX4jKUd1C1zXGWuAKbq rHMLH6QqzMAyeCEUf4icU1+IvXKNGXoNbVouOyIbKC9aEi8gnQeU1gyI+4jkhMIyo+uQ WBkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=Cc3DMUi1; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr13-20020a1709073f8d00b007ad95fdd21csi16125277ejc.761.2022.11.23.03.14.35; Wed, 23 Nov 2022 03:15:00 -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; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=Cc3DMUi1; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237523AbiKWLJm (ORCPT + 99 others); Wed, 23 Nov 2022 06:09:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237631AbiKWLId (ORCPT ); Wed, 23 Nov 2022 06:08:33 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B31AD9E96A for ; Wed, 23 Nov 2022 03:08:14 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id g12so28816922wrs.10 for ; Wed, 23 Nov 2022 03:08:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=27Y/3dF94+Cm6VsgYrXb3WffaYznVRIrRKIsZki0OWQ=; b=Cc3DMUi1+c91wbdCi+9yhbPRKydM/WD64VcFUqJSe/t+SDR0m8l26JNYNHPgO+3QxH 0i52QRdKTKqJfUxlWqlVcx+GDxMnF09QUpCHZK3OOYYn6JK5DOZWhFbgcb9Aez6ruY73 OwTp59On3Wv2c/b6bg/BB5e5RU6tRNy3yyvc4pVzyMBj35P80IhBaUBFeAYSJebUGBLs q4I8wtVjpQgeNRas7D7KX2A2o+jgu0cX89ItAZ0sCKHYFx0jpJNKunr3HlqHz+PAJwhQ jzC1mmkSC/XD/BSChddqxSlVbox2M80YP6L0RvwGC29dzQ5zonGnsAsczpPI+05L2r5e kneg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=27Y/3dF94+Cm6VsgYrXb3WffaYznVRIrRKIsZki0OWQ=; b=wMkvNbQmgWw07LiDqR9znYkIsYaBeEpSy92uar5FMESg50vuYzJi9v7eMVbVC1EohD TFT2vDuQJ8jqowuTUdFRGf2ZDjn+68Qmk8rMZYqWAqGqSRZmdcPhiOetp1ruYrcqUOfr vL0cnAF0hLwDIb7ZMbndRYt2WraW3QimLbB8WXq+TPmWICvxnqji0a8pE1bWgIGiAW9R A1iiJ8kh/z2BL9pScwYq5AxPBkJXDeEXCont2L6PRXKUpp9fHDqfhIsvb/04dS9qHGW0 /ecSG1oyFJ4aWiWxDw6291hQn2iRBhXUdi1pfyei3U7P0a38iWqWC7hLQSd23IYAoYbG R9aw== X-Gm-Message-State: ANoB5pnx1ajM1Ni8UBIzQSOSHL6vQbi158i1jCMw9fZd7r5sG3SvhKIX vuDtiKyOyurJTf/ostFsfshd7g== X-Received: by 2002:adf:f3d0:0:b0:241:f721:3ba2 with SMTP id g16-20020adff3d0000000b00241f7213ba2mr399710wrp.681.1669201693316; Wed, 23 Nov 2022 03:08:13 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:ae74:d94f:4677:3378]) by smtp.gmail.com with ESMTPSA id f13-20020a05600c4e8d00b003c6c182bef9sm2560406wmq.36.2022.11.23.03.08.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 03:08:12 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski , Konrad Dybcio Subject: [PATCH v3 09/13] tty: serial: qcom-geni-serial: drop the return value from handle_rx Date: Wed, 23 Nov 2022 12:07:55 +0100 Message-Id: <20221123110759.1836666-10-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221123110759.1836666-1-brgl@bgdev.pl> References: <20221123110759.1836666-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750285262421945644?= X-GMAIL-MSGID: =?utf-8?q?1750285262421945644?= From: Bartosz Golaszewski The return value of the handle_rx() callback is never checked. Drop it. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- drivers/tty/serial/qcom_geni_serial.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 658b6d596f58..d5c343b06c23 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -114,7 +114,7 @@ struct qcom_geni_serial_port { u32 tx_fifo_width; u32 rx_fifo_depth; bool setup; - int (*handle_rx)(struct uart_port *uport, u32 bytes, bool drop); + void (*handle_rx)(struct uart_port *uport, u32 bytes, bool drop); unsigned int baud; void *rx_fifo; u32 loopback; @@ -502,7 +502,7 @@ static void qcom_geni_serial_console_write(struct console *co, const char *s, spin_unlock_irqrestore(&uport->lock, flags); } -static int handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) +static void handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) { u32 i; unsigned char buf[sizeof(u32)]; @@ -537,16 +537,15 @@ static int handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) } if (!drop) tty_flip_buffer_push(tport); - return 0; } #else -static int handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) +static void handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) { - return -EPERM; + } #endif /* CONFIG_SERIAL_QCOM_GENI_CONSOLE */ -static int handle_rx_uart(struct uart_port *uport, u32 bytes, bool drop) +static void handle_rx_uart(struct uart_port *uport, u32 bytes, bool drop) { struct tty_port *tport; struct qcom_geni_serial_port *port = to_dev_port(uport); @@ -557,7 +556,7 @@ static int handle_rx_uart(struct uart_port *uport, u32 bytes, bool drop) tport = &uport->state->port; ioread32_rep(uport->membase + SE_GENI_RX_FIFOn, port->rx_fifo, words); if (drop) - return 0; + return; ret = tty_insert_flip_string(tport, port->rx_fifo, bytes); if (ret != bytes) { @@ -567,7 +566,6 @@ static int handle_rx_uart(struct uart_port *uport, u32 bytes, bool drop) } uport->icount.rx += ret; tty_flip_buffer_push(tport); - return ret; } static unsigned int qcom_geni_serial_tx_empty(struct uart_port *uport) From patchwork Wed Nov 23 11:07:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24910 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2724534wrr; Wed, 23 Nov 2022 03:15:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf4ZlXYvLYDZ6QlGfaKp3TqC+JbS3DmVQaBg+M6CMP6JdqBQ4LYI3TysqfFo1Arae2i6/Li9 X-Received: by 2002:a63:5108:0:b0:477:9a46:d051 with SMTP id f8-20020a635108000000b004779a46d051mr7049979pgb.160.1669202120151; Wed, 23 Nov 2022 03:15:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669202120; cv=none; d=google.com; s=arc-20160816; b=ngyVyLjKNX5CK3I1b/MdRstjDrF0XmbgsoJJ8UY7/hTwBeX15uYQfIML7q2etIZYVp Nr7to3+cfb8TPJW5U9jOwLW6+1tcKNuFnhIrP+JC1n1g/CxvUOLo5VNA8V8exUwqM5BN PLHX/1tRG/zeEIg0J/rQqXicR3sV995jHwZzWFbeQt3sqx5a9pbdcVhQRtggLH2oqyi1 vqpmf2FvivfTnQrvMk27K2DbrtQguikt6z4sCcpjwdoq6s82M8erXKdLEA7IbYBJXLFV 3kW7SuDG0GEOumuiZxop4x2kLesf+WYXIzzOpAyOjvxfMUxVG05bFQWlEA17yakVMyXb 6H4w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=npWHp37Z5aqJft0VcgEPQBxH0XaK5lUmiP+By6Idpv0=; b=1DxIiePzG0//WGc1u8vcjab6CCEoh5mD9xNBPVt3Cw9yBgLmkf/2bb1S0Aan47e9cZ ErUDhIv1xUi3FQ1sljRm2rKZyEPceLwnRRuq2bLwMdwLzobg3e3+pbJaih35fESpZLJv iw2MOMCG099maJ7txoCajbD+3QdRm5o5418HPW9tTNSRVWLUkeq9LWbErCu4T9xBQ2yF ENRZ5OQjPbC8mZCVQ/dgeYFcSQ20lpejpPON+ngcoxTYdGENdxXyVK5j5zxx7AUmNVDF YV6eKRx75QdTccIdm4vSYCTldPhogBS0oN3wzsoeboGURiFgzjVkCwu3XWu2j47pfCGp FMvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=p5qE2jgb; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p12-20020a056a000b4c00b0056d7aaaf1eesi16267753pfo.122.2022.11.23.03.15.06; Wed, 23 Nov 2022 03:15:20 -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; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=p5qE2jgb; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235963AbiKWLJq (ORCPT + 99 others); Wed, 23 Nov 2022 06:09:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237639AbiKWLId (ORCPT ); Wed, 23 Nov 2022 06:08:33 -0500 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE7D19C28D for ; Wed, 23 Nov 2022 03:08:14 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id n3so12284835wrp.5 for ; Wed, 23 Nov 2022 03:08:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=npWHp37Z5aqJft0VcgEPQBxH0XaK5lUmiP+By6Idpv0=; b=p5qE2jgb2LOAm20iEZm7s3ykUED/tYXYc3k13raCuZX0DelZXEOCyr/PRW0AoMv0Y8 sucY5CNWUKtDcQenxcPkDcL8iYQxl3qjZwq1eo1o5Tlg8lloFIVh/VlAaqeGxuwmJ1C+ Oq60FkB0BD5Eg55H3qwjlzchz47elJPRNsZdYXToGuQfZXz9QJ+FmNUaoSir5ifYZaJn g5xvR2leVI3vadEDjLatUsif0ZnNYcz6qTz+4yUYiV4R8Pr78A9MEBj8hmzCjbjoMbDY RPQUN5k5ATMpPlfbDOHFFmdjpktjmWBVyBIFJa03raoUVtB1kE8COOcyZtigbPoIIaHl lEaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=npWHp37Z5aqJft0VcgEPQBxH0XaK5lUmiP+By6Idpv0=; b=ojAxKXRQ8c9+7Wib172WyXCKPLQkyxiN0v38SurFVmEK8KOBXtGi9qur5CsrUxvr31 uoatjGkun9SNGkjijqtm5Z1m01lwsZ7mcplBG4YBeuWBETTpskHYqJ1xe7T9zmHFJJcU Y2TUux/VU+O7owOXQc8qImrx7Q8knayzSwy7Geb6c1CnrajhObt9phYhvdsracd6YuFt Oq1R6WfGfOIiRjU6uoaQih4irme82Zqh8W0zuaKYLwDs8rMta5vNQ+tVxCz6Y42fyfot GmSc/9vYl89ShGM4dt0qcvLThb7sKv4nb3rhU+zFpFAAw2lp5xI0RnfRWVgA4xMvWo4f +SFA== X-Gm-Message-State: ANoB5pnGzvyFitz868bbKIskm/slvye8sUVmALZ6kZvLtz+LfsRwESn2 rV0HM/s30khoq02qdAdwedMlNQ== X-Received: by 2002:adf:ea0b:0:b0:236:695b:6275 with SMTP id q11-20020adfea0b000000b00236695b6275mr17368695wrm.116.1669201694233; Wed, 23 Nov 2022 03:08:14 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:ae74:d94f:4677:3378]) by smtp.gmail.com with ESMTPSA id f13-20020a05600c4e8d00b003c6c182bef9sm2560406wmq.36.2022.11.23.03.08.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 03:08:13 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski , Konrad Dybcio Subject: [PATCH v3 10/13] tty: serial: qcom-geni-serial: use of_device_id data Date: Wed, 23 Nov 2022 12:07:56 +0100 Message-Id: <20221123110759.1836666-11-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221123110759.1836666-1-brgl@bgdev.pl> References: <20221123110759.1836666-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750285282007601141?= X-GMAIL-MSGID: =?utf-8?q?1750285282007601141?= From: Bartosz Golaszewski Instead of checking the device compatible in probe(), assign the device-specific data to struct of_device_id. We'll use it later when providing SE DMA support. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- drivers/tty/serial/qcom_geni_serial.c | 46 ++++++++++++++++++++------- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index d5c343b06c23..036231106321 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -95,6 +95,11 @@ /* We always configure 4 bytes per FIFO word */ #define BYTES_PER_FIFO_WORD 4 +struct qcom_geni_device_data { + bool console; + void (*handle_rx)(struct uart_port *uport, u32 bytes, bool drop); +}; + struct qcom_geni_private_data { /* NOTE: earlycon port will have NULL here */ struct uart_driver *drv; @@ -114,7 +119,6 @@ struct qcom_geni_serial_port { u32 tx_fifo_width; u32 rx_fifo_depth; bool setup; - void (*handle_rx)(struct uart_port *uport, u32 bytes, bool drop); unsigned int baud; void *rx_fifo; u32 loopback; @@ -126,6 +130,7 @@ struct qcom_geni_serial_port { bool cts_rts_swap; struct qcom_geni_private_data private_data; + const struct qcom_geni_device_data *dev_data; }; static const struct uart_ops qcom_geni_console_pops; @@ -640,7 +645,7 @@ static void qcom_geni_serial_handle_rx(struct uart_port *uport, bool drop) total_bytes += last_word_byte_cnt; else total_bytes += BYTES_PER_FIFO_WORD; - port->handle_rx(uport, total_bytes, drop); + port->dev_data->handle_rx(uport, total_bytes, drop); } static void qcom_geni_serial_stop_rx(struct uart_port *uport) @@ -1345,13 +1350,14 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) struct uart_port *uport; struct resource *res; int irq; - bool console = false; struct uart_driver *drv; + const struct qcom_geni_device_data *data; - if (of_device_is_compatible(pdev->dev.of_node, "qcom,geni-debug-uart")) - console = true; + data = of_device_get_match_data(&pdev->dev); + if (!data) + return -EINVAL; - if (console) { + if (data->console) { drv = &qcom_geni_console_driver; line = of_alias_get_id(pdev->dev.of_node, "serial"); } else { @@ -1361,7 +1367,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) line = of_alias_get_id(pdev->dev.of_node, "hsuart"); } - port = get_port_from_line(line, console); + port = get_port_from_line(line, data->console); if (IS_ERR(port)) { dev_err(&pdev->dev, "Invalid line %d\n", line); return PTR_ERR(port); @@ -1373,6 +1379,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) return -ENODEV; uport->dev = &pdev->dev; + port->dev_data = data; port->se.dev = &pdev->dev; port->se.wrapper = dev_get_drvdata(pdev->dev.parent); port->se.clk = devm_clk_get(&pdev->dev, "se"); @@ -1391,7 +1398,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) port->rx_fifo_depth = DEF_FIFO_DEPTH_WORDS; port->tx_fifo_width = DEF_FIFO_WIDTH_BITS; - if (!console) { + if (!data->console) { port->rx_fifo = devm_kcalloc(uport->dev, port->rx_fifo_depth, sizeof(u32), GFP_KERNEL); if (!port->rx_fifo) @@ -1421,7 +1428,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) uport->irq = irq; uport->has_sysrq = IS_ENABLED(CONFIG_SERIAL_QCOM_GENI_CONSOLE); - if (!console) + if (!data->console) port->wakeup_irq = platform_get_irq_optional(pdev, 1); if (of_property_read_bool(pdev->dev.of_node, "rx-tx-swap")) @@ -1443,7 +1450,6 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) port->private_data.drv = drv; uport->private_data = &port->private_data; platform_set_drvdata(pdev, port); - port->handle_rx = console ? handle_rx_console : handle_rx_uart; ret = uart_add_one_port(drv, uport); if (ret) @@ -1523,14 +1529,30 @@ static int __maybe_unused qcom_geni_serial_sys_resume(struct device *dev) return ret; } +static const struct qcom_geni_device_data qcom_geni_console_data = { + .console = true, + .handle_rx = handle_rx_console, +}; + +static const struct qcom_geni_device_data qcom_geni_uart_data = { + .console = false, + .handle_rx = handle_rx_uart, +}; + static const struct dev_pm_ops qcom_geni_serial_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(qcom_geni_serial_sys_suspend, qcom_geni_serial_sys_resume) }; static const struct of_device_id qcom_geni_serial_match_table[] = { - { .compatible = "qcom,geni-debug-uart", }, - { .compatible = "qcom,geni-uart", }, + { + .compatible = "qcom,geni-debug-uart", + .data = &qcom_geni_console_data, + }, + { + .compatible = "qcom,geni-uart", + .data = &qcom_geni_uart_data, + }, {} }; MODULE_DEVICE_TABLE(of, qcom_geni_serial_match_table); From patchwork Wed Nov 23 11:07:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24911 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2724668wrr; Wed, 23 Nov 2022 03:15:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf5eufkBQ//WJGKXWJzFgnC7CZ7u2PX1PszafGTIbxckiDEGHj4FjpUmpB28w3B5VAgErVeE X-Received: by 2002:a17:906:a889:b0:7ad:bd02:f491 with SMTP id ha9-20020a170906a88900b007adbd02f491mr24238744ejb.703.1669202141691; Wed, 23 Nov 2022 03:15:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669202141; cv=none; d=google.com; s=arc-20160816; b=qe2bQidJkoIxszfvkwAptDQB0ycIowrenQYcWwshMKEuJFlYpRjFyfP/7OMjrTeQgk QtYbhK4xkJmOg3IZ7PdS7NwqFnHq0bOPQMJMFRMs6WeZ4ituu4voWEOFiwzVbUbyxsxK wTNOB4O0Hsl2ulNTCqJQDEZ1UE6WfNE44gBfcYDUNKCHh1FEVw+UA8XRNUUl1Isr0fjW T9m8ld1AWzI7OzMFXMHGeDLiA8ovnZqJs/G8LtHZlyw5zKbsAUBluogzWFx8ZsqwpVJ+ jiMD4L227BOdTrAgQo0cl4h+reowfLM8CWTUN1k7yd04G/EBe9HenuOaqb8SWPE4NmLp EepQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yBSJ9X9pr9Z0i2+NFcnle+eN9VzlxNW46WoYTtGtQAo=; b=DYtcFLHToIi2yTgTHwY0yA7tpPMJydx/gP0xkg98qPWUrIsHtJcfmn+eky6njcjh1E UuXEgh7qPggvDXWZo77gZXO6dq4cfx6YMb3R9UjL8Hln+PvqYmwGYBk7FUOrRSWpIZUx RAYv1mt3FLrBOK7XQA2GG3xbDD9ZyOKS4ZlWnNvfBNQVmQrwe3/8mjWZOln27EYddNJX ROte0aeU5P9wHFUk8IRodg9YnysbnVES8y9f0RIPYBWDtnqe1dcu1jO12pyW7ikf3MdW OnwiUGSDpHNkefl0Xb6fH1oroBc5zlWyiGML7Q8fqgQzHfno644ANRwfhloCKoqP+GX3 rYGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=ja4+W1jE; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd14-20020a1709069b8e00b0077d562462f5si3892648ejc.381.2022.11.23.03.15.17; Wed, 23 Nov 2022 03:15:41 -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; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=ja4+W1jE; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237305AbiKWLJu (ORCPT + 99 others); Wed, 23 Nov 2022 06:09:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237649AbiKWLIe (ORCPT ); Wed, 23 Nov 2022 06:08:34 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 991B7AF086 for ; Wed, 23 Nov 2022 03:08:15 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id o7-20020a05600c510700b003cffc0b3374so1072907wms.0 for ; Wed, 23 Nov 2022 03:08:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yBSJ9X9pr9Z0i2+NFcnle+eN9VzlxNW46WoYTtGtQAo=; b=ja4+W1jEpsH8IErFm7dMfOR6osTp3PvRK/79rIXT0E+hHFA5TgZynARrHm1/8P3WnR EJt1uCTQKkJxt2DdA4lpEzHSNSq/FUNk/JGIwbSIl7yzE1uR5W+Z9l+a69RC63LmUHl1 n5ZmZ/4m51Z7+ZZPJTkVwcooV7FndRr4kiiCUZ7OD+bxCO7pgWDapJgVH7fkdi8A3RFd 510VYT98Hik+yO6mhv5z3eP7DEAjnKnJKmlDIW/gnF6lIlC/5FYtzZJX8fDE0/+rhRky w7dhyStbmJyQ7C8Ah+mhPXG8g/8h3GQ37ubmGb8n+w1ZJH0IFf9B+sJa6DHBWZN3vr8a s66A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yBSJ9X9pr9Z0i2+NFcnle+eN9VzlxNW46WoYTtGtQAo=; b=ghGdsO6mRNq6Yf5aQM7BZTKJBsyIUjxA8LhrWA8OXOeprZSf3jIJewJoC+dSy1Qe9E wxQ16Qh1l2yx4tf6XPKSZqWU+XDEaVKYY01ff2QmzeIDDhla4mo7Fx6w8uK81TTTF468 Vj7yU11uMP9EoVGLAq7UsT+Nqycra6jIVWs5+e0GYfGxZ/w5ER2vVtVIXJyB1EUeIzXn mcUn26cG+s7cjqAb1iwcc89n/ZG3eStYM9k8UtJDP3bMjDp3PGkUxNzx1GXxi9sNTk6Y ceOk5zkrP0bWpRxyG43q9vBjSd1Jbc8MLE4WzyI2T2J/Ge2cFtRCoAXNo8kG9mj66r+O v0Qg== X-Gm-Message-State: ANoB5pkm2TJ84GvarDyKsWpz67xhgV0JKGoIauIpZ9n4m06qRERJN4mF nutd/mC15woghV3gFNydekPynw== X-Received: by 2002:a05:600c:654c:b0:3d0:110c:d25f with SMTP id dn12-20020a05600c654c00b003d0110cd25fmr13782378wmb.125.1669201695202; Wed, 23 Nov 2022 03:08:15 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:ae74:d94f:4677:3378]) by smtp.gmail.com with ESMTPSA id f13-20020a05600c4e8d00b003c6c182bef9sm2560406wmq.36.2022.11.23.03.08.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 03:08:14 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski , Konrad Dybcio Subject: [PATCH v3 11/13] tty: serial: qcom-geni-serial: stop operations in progress at shutdown Date: Wed, 23 Nov 2022 12:07:57 +0100 Message-Id: <20221123110759.1836666-12-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221123110759.1836666-1-brgl@bgdev.pl> References: <20221123110759.1836666-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750285304529847436?= X-GMAIL-MSGID: =?utf-8?q?1750285304529847436?= From: Bartosz Golaszewski We don't stop transmissions in progress at shutdown. This is fine with FIFO SE mode but with DMA it causes trouble so fix it now. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- drivers/tty/serial/qcom_geni_serial.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 036231106321..82242a40a95a 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -865,6 +865,9 @@ static void get_tx_fifo_size(struct qcom_geni_serial_port *port) static void qcom_geni_serial_shutdown(struct uart_port *uport) { + qcom_geni_serial_stop_tx(uport); + qcom_geni_serial_stop_rx(uport); + disable_irq(uport->irq); } From patchwork Wed Nov 23 11:07:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24908 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2724312wrr; Wed, 23 Nov 2022 03:14:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf44gsufcuWMSMLvkDOs78UYddugmoYFhhcq96ha4gxadKC/g701DQETesVVGgAKhCyMf15a X-Received: by 2002:a17:906:16d4:b0:7b9:f0fd:47b1 with SMTP id t20-20020a17090616d400b007b9f0fd47b1mr1885572ejd.462.1669202093717; Wed, 23 Nov 2022 03:14:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669202093; cv=none; d=google.com; s=arc-20160816; b=Io1b9HDP1SFLIw0/5ygmpnUGtk0UwD24lqdSfg8tUcM8z6rbHYu7g07hwu0WVVIGl5 xULw2CT2LjjZm8zAaq4AJLn0WuWtH4YL8CfAKBaL6YA/NwcuDML7/MWAlcmgpKURBZSQ +I+FsxZZF4hZdQh3NspM/sEXZik4WHLmC8STdJ0H+DyTU/gWNsfMuE2ekK9vMhElcxvu 1hPJbxvaVgk6JKdakBvxHQGzBJIb/shfnLkEyXhrCDIjKfttLocsa/abxlT+BMyFb0sD sDqDZm04Y6G7f6nnNV+AcTiXVyjOdtU1Mwz6UP7+xeJVek9WWJuYLvwb160rAshDPTvP dFCQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LuwEN90AtgG+bvIlYhOJ4Y3TdxahsORXGOntfwKDvGM=; b=BPj+adiGfdpltyowL8x9TeZbtegNiKtF6cwagYkfZ5ZbBaiwUxI2sons/6acLh2Ysw eVbB5bx2zjOgwvVG5pj+OIBAfrlrr85AYdwvlJR34GIBoya/XhZnTC0rV84SQicuJyTW WIzLAiwzhzsUYKyCqcj0C6l54Ig2jn8yjHiNpIKCOUCJAplcOZ67OYtv4Ajz0YAXyHGi HC860feiNdMGwZZlxYu1AFhTxdsjF0IUOKgYNSOhRuHlh7fA22vKB1IRbP3o2NIJOm8v UB5bCsCywiv19HcxwTjhGt+MaEgCb6koOlEAAM1xoLIx0V3+j7kSJ1QZgwwIXFC23hYZ HxaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b="cdSOdHs/"; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u21-20020a1709064ad500b0078cc4a8a956si11199614ejt.881.2022.11.23.03.14.28; Wed, 23 Nov 2022 03:14:53 -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; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b="cdSOdHs/"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236740AbiKWLJ4 (ORCPT + 99 others); Wed, 23 Nov 2022 06:09:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237662AbiKWLIf (ORCPT ); Wed, 23 Nov 2022 06:08:35 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 911A5B70F9 for ; Wed, 23 Nov 2022 03:08:17 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id r9-20020a1c4409000000b003d02dd48c45so829779wma.0 for ; Wed, 23 Nov 2022 03:08:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LuwEN90AtgG+bvIlYhOJ4Y3TdxahsORXGOntfwKDvGM=; b=cdSOdHs/KjSXHF/Ujb2s5z+xgIIMYtfWXWH133hqVTHYeWnQHOkZG77vID1B8el//j chFMWYMzu34/MUdQwHaNqmA3d4LuFlAe2JvqerDJ1nxFk+xZgQKZQ0B6cRp/LfoCs9LV 4Iq4L6IfDba925iFhsyOKoxymTbrvWGTdg+GNwlhSPTQgiVMAU0u+EM33F/TRQ/AoO3m 6VyMhf96Pc8WNqSwa6ZhpqZhre2zigBwbHdKajgI0TLs/7saALPyO0Qnei5sM8pHk0qH f+okl74ptDebMSMo9yAT29/Gbxx8pPuZ3xTpW/j0+gLVdMdOcyr4sCVrPsFWvl162j5v OCBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LuwEN90AtgG+bvIlYhOJ4Y3TdxahsORXGOntfwKDvGM=; b=0QzrmeKrqCaW2FZ6/SMm3m8mEXuLbOOWW7MM9WdBunyid1Mj5H4Mo7qNQAqmoiYQ20 5XntVyDnBEnKjXpt7ucmJw3yIBJn7of80aCtk5OBTx7MigIilfaC3I6YMjs2Y4QVNKX1 KT4so7S02uE/Ekiy36RDu5o83W60b9bcYpIJgztH3DF0Z4QbT4MWQ6Sb+9VKJJs6f0O+ 57DGbSoUvOgOeh9uuNxmanbJxPBp99ewlrXDMVcpNhPvqXt3+ot7mfvHDCVsK/yIl3uI ddugUwGFmcTaYCoOmF6Q5VebVgWKlLeYWaCloQ4drGiOrsG7bRyOaJDa4tU0swolKM0r Bopw== X-Gm-Message-State: ANoB5plLipnMM/JU76xB4CFAEr+AaDBxRCwduRWkOFysfvTnKv7nQBO0 RCZC6lnr9jrQRpiuEjcnqvMwMQ== X-Received: by 2002:a7b:c4d8:0:b0:3cf:b0ed:de9d with SMTP id g24-20020a7bc4d8000000b003cfb0edde9dmr7243730wmk.188.1669201696131; Wed, 23 Nov 2022 03:08:16 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:ae74:d94f:4677:3378]) by smtp.gmail.com with ESMTPSA id f13-20020a05600c4e8d00b003c6c182bef9sm2560406wmq.36.2022.11.23.03.08.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 03:08:15 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski , Konrad Dybcio Subject: [PATCH v3 12/13] soc: qcom-geni-se: add more symbol definitions Date: Wed, 23 Nov 2022 12:07:58 +0100 Message-Id: <20221123110759.1836666-13-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221123110759.1836666-1-brgl@bgdev.pl> References: <20221123110759.1836666-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750285254487520825?= X-GMAIL-MSGID: =?utf-8?q?1750285254487520825?= From: Bartosz Golaszewski The following symbols will be used when adding support for SE DMA in the qcom geni serial driver. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- include/linux/qcom-geni-se.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/qcom-geni-se.h b/include/linux/qcom-geni-se.h index f5672785c0c4..400213daa461 100644 --- a/include/linux/qcom-geni-se.h +++ b/include/linux/qcom-geni-se.h @@ -103,6 +103,7 @@ struct geni_se { #define SE_DMA_TX_FSM_RST 0xc58 #define SE_DMA_RX_IRQ_STAT 0xd40 #define SE_DMA_RX_IRQ_CLR 0xd44 +#define SE_DMA_RX_LEN_IN 0xd54 #define SE_DMA_RX_FSM_RST 0xd58 #define SE_HW_PARAM_0 0xe24 #define SE_HW_PARAM_1 0xe28 @@ -235,6 +236,8 @@ struct geni_se { #define RX_SBE BIT(2) #define RX_RESET_DONE BIT(3) #define RX_FLUSH_DONE BIT(4) +#define RX_DMA_PARITY_ERR BIT(5) +#define RX_DMA_BREAK GENMASK(8, 7) #define RX_GENI_GP_IRQ GENMASK(10, 5) #define RX_GENI_CANCEL_IRQ BIT(11) #define RX_GENI_GP_IRQ_EXT GENMASK(13, 12) From patchwork Wed Nov 23 11:07:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24912 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2724917wrr; Wed, 23 Nov 2022 03:16:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf6IRfA7U5MlEqoTvpJiPu+w+25xnkRuO4vwOHqCAGtF8Vlizv8sq/GEFw34As8g+xdUK71X X-Received: by 2002:a17:906:f13:b0:78d:8e08:76de with SMTP id z19-20020a1709060f1300b0078d8e0876demr23367989eji.12.1669202174605; Wed, 23 Nov 2022 03:16:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669202174; cv=none; d=google.com; s=arc-20160816; b=LgtB9Xlq9LlkBZ4Dg4AeEFZusqKt1fcoJFBbRqb5X3U+RPv+kUXBOEHgAXLjzvbYO3 pHBNrkqlV4WrBbQ3N9yzSrZLVhEG9tcnfZTJdP7b0nbbX4uY3JhxfgI2EO0b32YA9dwP piN+WDhyLC3oKDxQuuEFJmQPWXJ0wltcoX+1cy0iGxNBK7sAdOxW4iiCHMhEFOdKlsHu 85WKS1bXofdMQmBg84zQki913g68rPnqqOaaoOn2XYloEh3WVhWC2lYMNQLwN5f2Nc2B HtR8FVT5euqcam0PcMZ/cQREgWsbLGvCY2L3C0jIiI/Tc2D/BWiHsS+6xo9YYcryoasS LoKw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YbJbOuUac1/7/2K6KBn9Bgk00aMtSqA5zPVvYbFkZOk=; b=e9aA1d+DmWWHzsQHCf8oPR1aA3HgOJh2bsOdicn46Suqa/mQaPMdAk81rxSjBPb96f pEQq7raz48yJbo9sP0HTuh4PmLzGWZz3xhVB+AIavAYVrl5GHxNvi6pKUBOR5ds2rwlD 2zJXKn06zCRzYm4nHWDmCfhJ/UEhZeC0M0DbQo1xmOzChAtQ/4nvx1SuTlV4h8hiBqUR z/UTkZup4FWghCcju+MlncDBh/xxjC81lGk0Ju2u5NZIkOB4URe13cbfnMlrBXSMrnfI U5oG7kB/X33H9lsSblAJcjvW9ZC/8bOM+5eJiSC9bvKD6QayBenV8BO9ghO25bzgH2B4 ZPlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=RqeB9fNk; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y12-20020a056402358c00b00461e63fe88fsi15014503edc.596.2022.11.23.03.15.49; Wed, 23 Nov 2022 03:16:14 -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; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=RqeB9fNk; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237291AbiKWLKN (ORCPT + 99 others); Wed, 23 Nov 2022 06:10:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236108AbiKWLIg (ORCPT ); Wed, 23 Nov 2022 06:08:36 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A27C7B7EBA for ; Wed, 23 Nov 2022 03:08:17 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id v1so28800452wrt.11 for ; Wed, 23 Nov 2022 03:08:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YbJbOuUac1/7/2K6KBn9Bgk00aMtSqA5zPVvYbFkZOk=; b=RqeB9fNk5zpcIFTtoU52wn3zC34Q1EdzSewuRfSpCUWbxvdz3h96H+1Ogm1OczKO88 K7B+OtUYyiHDN77ZoerAq8bn80RcL6bjQM/kfeIDLe+VC/bHV7NCdw3yZ2brE/dNFfmf HxIU51qaQZOaVawrHQWfXFCz3vZydUq5FTroTgIxWMbIqqcH8iurbvi1UmDQaQfLYT5w lB0jZR6r4Iu/UoQLbIKpckOHjoJ5NStoF1wa0XHabdoEtfK9UMGTIcA0jkizstlQdlPl BnCLnsh13+Slh6IfiIy5qB6v6U+YbpKP5xsV9Gso9Z16QD8o8nbf+pSNKVVUk03tQpBe I2Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YbJbOuUac1/7/2K6KBn9Bgk00aMtSqA5zPVvYbFkZOk=; b=PiSSDPqbwg/6I5qk9ClfJlbPWmzfXA5SmIDx/4rLMr/4ygKkbHmsxr+gYeXDZjjwXv l93SnrAz92VUtVUlagLN2BNSePYgC/JO2o2jL5uW2xget1RBzPN4yIyjU2/eR6VatDxT HRWJ5iVUOZtpyo5e4et4dXp9EH5WIxIAFFQljkiWSXQHiv/1FkDivowG1M5/llKL9AiO 4QKzu/2b470kL9iB7ZItlF+b+IWPE0yVqzH/U9QGR09g+9lcxNKSOjPA+7/ZcB27YdqH BijVGJB0xe3XDKqfedzc3gcehO9l1Dn72NGxwNhJ2p174X/gdQndL0p8jpWRdtXetYWc HTtw== X-Gm-Message-State: ANoB5plT7MnM7HLUUxE1IAVG9C0qY1Y1aZXmfWvXbx6/FyK9tc2DQWHo 6rMOpTWt/cEZC4VbJmuUC1ZQkw== X-Received: by 2002:a5d:5d0d:0:b0:236:ea0d:e49b with SMTP id ch13-20020a5d5d0d000000b00236ea0de49bmr17180291wrb.472.1669201697066; Wed, 23 Nov 2022 03:08:17 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:ae74:d94f:4677:3378]) by smtp.gmail.com with ESMTPSA id f13-20020a05600c4e8d00b003c6c182bef9sm2560406wmq.36.2022.11.23.03.08.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 03:08:16 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v3 13/13] tty: serial: qcom-geni-serial: add support for serial engine DMA Date: Wed, 23 Nov 2022 12:07:59 +0100 Message-Id: <20221123110759.1836666-14-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221123110759.1836666-1-brgl@bgdev.pl> References: <20221123110759.1836666-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750285339686760463?= X-GMAIL-MSGID: =?utf-8?q?1750285339686760463?= From: Bartosz Golaszewski The qcom-geni-serial driver currently only works in SE FIFO mode. This limits the UART speed to around 180 kB/s. In order to achieve higher speeds we need to use SE DMA mode. Keep the console port working in FIFO mode but extend the code to use DMA for the high-speed port. Signed-off-by: Bartosz Golaszewski --- drivers/tty/serial/qcom_geni_serial.c | 289 ++++++++++++++++++++++---- 1 file changed, 247 insertions(+), 42 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 82242a40a95a..0f4ba909c792 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -70,6 +70,8 @@ #define UART_START_TX 0x1 /* UART S_CMD OP codes */ #define UART_START_READ 0x1 +#define UART_PARAM 0x1 +#define UART_PARAM_RFR_OPEN BIT(7) #define UART_OVERSAMPLING 32 #define STALE_TIMEOUT 16 @@ -95,9 +97,11 @@ /* We always configure 4 bytes per FIFO word */ #define BYTES_PER_FIFO_WORD 4 +#define DMA_RX_BUF_SIZE 2048 + struct qcom_geni_device_data { bool console; - void (*handle_rx)(struct uart_port *uport, u32 bytes, bool drop); + enum geni_se_xfer_mode mode; }; struct qcom_geni_private_data { @@ -118,9 +122,11 @@ struct qcom_geni_serial_port { u32 tx_fifo_depth; u32 tx_fifo_width; u32 rx_fifo_depth; + dma_addr_t tx_dma_addr; + dma_addr_t rx_dma_addr; bool setup; unsigned int baud; - void *rx_fifo; + void *rx_buf; u32 loopback; bool brk; @@ -552,18 +558,11 @@ static void handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) static void handle_rx_uart(struct uart_port *uport, u32 bytes, bool drop) { - struct tty_port *tport; struct qcom_geni_serial_port *port = to_dev_port(uport); - u32 num_bytes_pw = port->tx_fifo_width / BITS_PER_BYTE; - u32 words = ALIGN(bytes, num_bytes_pw) / num_bytes_pw; + struct tty_port *tport = &uport->state->port; int ret; - tport = &uport->state->port; - ioread32_rep(uport->membase + SE_GENI_RX_FIFOn, port->rx_fifo, words); - if (drop) - return; - - ret = tty_insert_flip_string(tport, port->rx_fifo, bytes); + ret = tty_insert_flip_string(tport, port->rx_buf, bytes); if (ret != bytes) { dev_err(uport->dev, "%s:Unable to push data ret %d_bytes %d\n", __func__, ret, bytes); @@ -578,7 +577,70 @@ static unsigned int qcom_geni_serial_tx_empty(struct uart_port *uport) return !readl(uport->membase + SE_GENI_TX_FIFO_STATUS); } -static void qcom_geni_serial_start_tx(struct uart_port *uport) +static void qcom_geni_serial_stop_tx_dma(struct uart_port *uport) +{ + struct qcom_geni_serial_port *port = to_dev_port(uport); + bool done; + u32 status; + u32 m_irq_en; + + status = readl(uport->membase + SE_GENI_STATUS); + if (!(status & M_GENI_CMD_ACTIVE)) + return; + + if (port->rx_dma_addr) { + geni_se_tx_dma_unprep(&port->se, port->tx_dma_addr, + port->tx_remaining); + port->tx_dma_addr = (dma_addr_t)NULL; + port->tx_remaining = 0; + } + + m_irq_en = readl(uport->membase + SE_GENI_M_IRQ_EN); + writel(m_irq_en, uport->membase + SE_GENI_M_IRQ_EN); + geni_se_cancel_m_cmd(&port->se); + + done = qcom_geni_serial_poll_bit(uport, SE_GENI_S_IRQ_STATUS, + S_CMD_CANCEL_EN, true); + if (!done) { + geni_se_abort_m_cmd(&port->se); + qcom_geni_serial_poll_bit(uport, SE_GENI_M_IRQ_STATUS, + M_CMD_ABORT_EN, true); + writel(M_CMD_ABORT_EN, uport->membase + SE_GENI_M_IRQ_CLEAR); + } + + writel(M_CMD_CANCEL_EN, uport->membase + SE_GENI_M_IRQ_CLEAR); +} + +static void qcom_geni_serial_start_tx_dma(struct uart_port *uport) +{ + struct qcom_geni_serial_port *port = to_dev_port(uport); + struct circ_buf *xmit = &uport->state->xmit; + unsigned int xmit_size; + int ret; + + if (port->tx_dma_addr) + return; + + xmit_size = uart_circ_chars_pending(xmit); + if (xmit_size < WAKEUP_CHARS) + uart_write_wakeup(uport); + + xmit_size = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE); + + qcom_geni_serial_setup_tx(uport, xmit_size); + + ret = geni_se_tx_dma_prep(&port->se, &xmit->buf[xmit->tail], + xmit_size, &port->tx_dma_addr); + if (ret) { + dev_err(uport->dev, "unable to start TX SE DMA: %d\n", ret); + qcom_geni_serial_stop_tx_dma(uport); + return; + } + + port->tx_remaining = xmit_size; +} + +static void qcom_geni_serial_start_tx_fifo(struct uart_port *uport) { u32 irq_en; u32 status; @@ -597,7 +659,7 @@ static void qcom_geni_serial_start_tx(struct uart_port *uport) writel(irq_en, uport->membase + SE_GENI_M_IRQ_EN); } -static void qcom_geni_serial_stop_tx(struct uart_port *uport) +static void qcom_geni_serial_stop_tx_fifo(struct uart_port *uport) { u32 irq_en; u32 status; @@ -623,14 +685,13 @@ static void qcom_geni_serial_stop_tx(struct uart_port *uport) writel(M_CMD_CANCEL_EN, uport->membase + SE_GENI_M_IRQ_CLEAR); } -static void qcom_geni_serial_handle_rx(struct uart_port *uport, bool drop) +static void qcom_geni_serial_handle_rx_fifo(struct uart_port *uport, bool drop) { u32 status; u32 word_cnt; u32 last_word_byte_cnt; u32 last_word_partial; u32 total_bytes; - struct qcom_geni_serial_port *port = to_dev_port(uport); status = readl(uport->membase + SE_GENI_RX_FIFO_STATUS); word_cnt = status & RX_FIFO_WC_MSK; @@ -645,10 +706,10 @@ static void qcom_geni_serial_handle_rx(struct uart_port *uport, bool drop) total_bytes += last_word_byte_cnt; else total_bytes += BYTES_PER_FIFO_WORD; - port->dev_data->handle_rx(uport, total_bytes, drop); + handle_rx_console(uport, total_bytes, drop); } -static void qcom_geni_serial_stop_rx(struct uart_port *uport) +static void qcom_geni_serial_stop_rx_fifo(struct uart_port *uport) { u32 irq_en; u32 status; @@ -678,7 +739,7 @@ static void qcom_geni_serial_stop_rx(struct uart_port *uport) s_irq_status = readl(uport->membase + SE_GENI_S_IRQ_STATUS); /* Flush the Rx buffer */ if (s_irq_status & S_RX_FIFO_LAST_EN) - qcom_geni_serial_handle_rx(uport, true); + qcom_geni_serial_handle_rx_fifo(uport, true); writel(s_irq_status, uport->membase + SE_GENI_S_IRQ_CLEAR); status = readl(uport->membase + SE_GENI_STATUS); @@ -686,7 +747,7 @@ static void qcom_geni_serial_stop_rx(struct uart_port *uport) qcom_geni_serial_abort_rx(uport); } -static void qcom_geni_serial_start_rx(struct uart_port *uport) +static void qcom_geni_serial_start_rx_fifo(struct uart_port *uport) { u32 irq_en; u32 status; @@ -694,7 +755,7 @@ static void qcom_geni_serial_start_rx(struct uart_port *uport) status = readl(uport->membase + SE_GENI_STATUS); if (status & S_GENI_CMD_ACTIVE) - qcom_geni_serial_stop_rx(uport); + qcom_geni_serial_stop_rx_fifo(uport); geni_se_setup_s_cmd(&port->se, UART_START_READ, 0); @@ -707,6 +768,101 @@ static void qcom_geni_serial_start_rx(struct uart_port *uport) writel(irq_en, uport->membase + SE_GENI_M_IRQ_EN); } +static void qcom_geni_serial_stop_rx_dma(struct uart_port *uport) +{ + struct qcom_geni_serial_port *port = to_dev_port(uport); + u32 status; + + status = readl(uport->membase + SE_GENI_STATUS); + if (!(status & S_GENI_CMD_ACTIVE)) + return; + + geni_se_cancel_s_cmd(&port->se); + qcom_geni_serial_poll_bit(uport, SE_GENI_S_IRQ_STATUS, + S_CMD_CANCEL_EN, true); + + status = readl(uport->membase + SE_GENI_STATUS); + if (status & S_GENI_CMD_ACTIVE) + qcom_geni_serial_abort_rx(uport); + + if (port->rx_dma_addr) { + geni_se_rx_dma_unprep(&port->se, port->rx_dma_addr, + DMA_RX_BUF_SIZE); + port->rx_dma_addr = (dma_addr_t)NULL; + } +} + +static void qcom_geni_serial_start_rx_dma(struct uart_port *uport) +{ + struct qcom_geni_serial_port *port = to_dev_port(uport); + u32 status; + int ret; + + status = readl(uport->membase + SE_GENI_STATUS); + if (status & S_GENI_CMD_ACTIVE) + qcom_geni_serial_stop_rx_dma(uport); + + geni_se_setup_s_cmd(&port->se, UART_START_READ, UART_PARAM_RFR_OPEN); + + ret = geni_se_rx_dma_prep(&port->se, port->rx_buf, + DMA_RX_BUF_SIZE, + &port->rx_dma_addr); + if (ret) { + dev_err(uport->dev, "unable to start RX SE DMA: %d\n", ret); + qcom_geni_serial_stop_rx_dma(uport); + } +} + +static void qcom_geni_serial_handle_rx_dma(struct uart_port *uport, bool drop) +{ + struct qcom_geni_serial_port *port = to_dev_port(uport); + u32 status; + u32 rx_in; + int ret; + + status = readl(uport->membase + SE_GENI_STATUS); + if (!(status & S_GENI_CMD_ACTIVE)) + return; + + if (!port->rx_dma_addr) + return; + + geni_se_rx_dma_unprep(&port->se, port->rx_dma_addr, DMA_RX_BUF_SIZE); + port->rx_dma_addr = (dma_addr_t)NULL; + + rx_in = readl(uport->membase + SE_DMA_RX_LEN_IN); + if (!rx_in) { + dev_warn(uport->dev, "serial engine reports 0 RX bytes in!\n"); + return; + } + + if (!drop) + handle_rx_uart(uport, rx_in, drop); + + ret = geni_se_rx_dma_prep(&port->se, port->rx_buf, + DMA_RX_BUF_SIZE, + &port->rx_dma_addr); + if (ret) { + dev_err(uport->dev, "unable to start RX SE DMA: %d\n", ret); + qcom_geni_serial_stop_rx_dma(uport); + } +} + +static void qcom_geni_serial_start_rx(struct uart_port *uport) +{ + uport->ops->start_rx(uport); +} + +static void qcom_geni_serial_stop_rx(struct uart_port *uport) +{ + uport->ops->stop_rx(uport); +} + +static void qcom_geni_serial_stop_tx(struct uart_port *uport) +{ + uport->ops->stop_tx(uport); +} + static void qcom_geni_serial_send_chunk_fifo(struct uart_port *uport, unsigned int chunk) { @@ -733,8 +889,8 @@ static void qcom_geni_serial_send_chunk_fifo(struct uart_port *uport, } } -static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done, - bool active) +static void qcom_geni_serial_handle_tx_fifo(struct uart_port *uport, + bool done, bool active) { struct qcom_geni_serial_port *port = to_dev_port(uport); struct circ_buf *xmit = &uport->state->xmit; @@ -754,7 +910,7 @@ static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done, /* All data has been transmitted and acknowledged as received */ if (!pending && !status && done) { - qcom_geni_serial_stop_tx(uport); + qcom_geni_serial_stop_tx_fifo(uport); goto out_write_wakeup; } @@ -797,12 +953,32 @@ static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done, uart_write_wakeup(uport); } +static void qcom_geni_serial_handle_tx_dma(struct uart_port *uport) +{ + struct qcom_geni_serial_port *port = to_dev_port(uport); + struct circ_buf *xmit = &uport->state->xmit; + + uart_xmit_advance(uport, port->tx_remaining); + geni_se_tx_dma_unprep(&port->se, port->tx_dma_addr, port->tx_remaining); + port->tx_dma_addr = (dma_addr_t)NULL; + port->tx_remaining = 0; + + if (!uart_circ_empty(xmit)) + qcom_geni_serial_start_tx_dma(uport); + + if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) + uart_write_wakeup(uport); +} + static irqreturn_t qcom_geni_serial_isr(int isr, void *dev) { u32 m_irq_en; u32 m_irq_status; u32 s_irq_status; u32 geni_status; + u32 dma; + u32 dma_tx_status; + u32 dma_rx_status; struct uart_port *uport = dev; bool drop_rx = false; struct tty_port *tport = &uport->state->port; @@ -815,10 +991,15 @@ static irqreturn_t qcom_geni_serial_isr(int isr, void *dev) m_irq_status = readl(uport->membase + SE_GENI_M_IRQ_STATUS); s_irq_status = readl(uport->membase + SE_GENI_S_IRQ_STATUS); + dma_tx_status = readl(uport->membase + SE_DMA_TX_IRQ_STAT); + dma_rx_status = readl(uport->membase + SE_DMA_RX_IRQ_STAT); geni_status = readl(uport->membase + SE_GENI_STATUS); + dma = readl(uport->membase + SE_GENI_DMA_MODE_EN); m_irq_en = readl(uport->membase + SE_GENI_M_IRQ_EN); writel(m_irq_status, uport->membase + SE_GENI_M_IRQ_CLEAR); writel(s_irq_status, uport->membase + SE_GENI_S_IRQ_CLEAR); + writel(dma_tx_status, uport->membase + SE_DMA_TX_IRQ_CLR); + writel(dma_rx_status, uport->membase + SE_DMA_RX_IRQ_CLR); if (WARN_ON(m_irq_status & M_ILLEGAL_CMD_EN)) goto out_unlock; @@ -828,10 +1009,6 @@ static irqreturn_t qcom_geni_serial_isr(int isr, void *dev) tty_insert_flip_char(tport, 0, TTY_OVERRUN); } - if (m_irq_status & m_irq_en & (M_TX_FIFO_WATERMARK_EN | M_CMD_DONE_EN)) - qcom_geni_serial_handle_tx(uport, m_irq_status & M_CMD_DONE_EN, - geni_status & M_GENI_CMD_ACTIVE); - if (s_irq_status & (S_GP_IRQ_0_EN | S_GP_IRQ_1_EN)) { if (s_irq_status & S_GP_IRQ_0_EN) uport->icount.parity++; @@ -841,8 +1018,35 @@ static irqreturn_t qcom_geni_serial_isr(int isr, void *dev) port->brk = true; } - if (s_irq_status & (S_RX_FIFO_WATERMARK_EN | S_RX_FIFO_LAST_EN)) - qcom_geni_serial_handle_rx(uport, drop_rx); + if (dma) { + if (dma_tx_status & TX_DMA_DONE) + qcom_geni_serial_handle_tx_dma(uport); + + if (dma_rx_status) { + if (dma_rx_status & RX_RESET_DONE) + goto out_unlock; + + if (dma_rx_status & RX_DMA_PARITY_ERR) { + uport->icount.parity++; + drop_rx = true; + } + + if (dma_rx_status & RX_DMA_BREAK) + uport->icount.brk++; + + if (dma_rx_status & (RX_DMA_DONE | RX_EOT)) + qcom_geni_serial_handle_rx_dma(uport, drop_rx); + } + } else { + if (m_irq_status & m_irq_en & + (M_TX_FIFO_WATERMARK_EN | M_CMD_DONE_EN)) + qcom_geni_serial_handle_tx_fifo(uport, + m_irq_status & M_CMD_DONE_EN, + geni_status & M_GENI_CMD_ACTIVE); + + if (s_irq_status & (S_RX_FIFO_WATERMARK_EN | S_RX_FIFO_LAST_EN)) + qcom_geni_serial_handle_rx_fifo(uport, drop_rx); + } out_unlock: uart_unlock_and_check_sysrq(uport); @@ -912,7 +1116,7 @@ static int qcom_geni_serial_port_setup(struct uart_port *uport) geni_se_config_packing(&port->se, BITS_PER_BYTE, BYTES_PER_FIFO_WORD, false, true, true); geni_se_init(&port->se, UART_RX_WM, port->rx_fifo_depth - 2); - geni_se_select_mode(&port->se, GENI_SE_FIFO); + geni_se_select_mode(&port->se, port->dev_data->mode); port->setup = true; return 0; @@ -1310,10 +1514,10 @@ static void qcom_geni_serial_pm(struct uart_port *uport, static const struct uart_ops qcom_geni_console_pops = { .tx_empty = qcom_geni_serial_tx_empty, - .stop_tx = qcom_geni_serial_stop_tx, - .start_tx = qcom_geni_serial_start_tx, - .stop_rx = qcom_geni_serial_stop_rx, - .start_rx = qcom_geni_serial_start_rx, + .stop_tx = qcom_geni_serial_stop_tx_fifo, + .start_tx = qcom_geni_serial_start_tx_fifo, + .stop_rx = qcom_geni_serial_stop_rx_fifo, + .start_rx = qcom_geni_serial_start_rx_fifo, .set_termios = qcom_geni_serial_set_termios, .startup = qcom_geni_serial_startup, .request_port = qcom_geni_serial_request_port, @@ -1331,9 +1535,10 @@ static const struct uart_ops qcom_geni_console_pops = { static const struct uart_ops qcom_geni_uart_pops = { .tx_empty = qcom_geni_serial_tx_empty, - .stop_tx = qcom_geni_serial_stop_tx, - .start_tx = qcom_geni_serial_start_tx, - .stop_rx = qcom_geni_serial_stop_rx, + .stop_tx = qcom_geni_serial_stop_tx_dma, + .start_tx = qcom_geni_serial_start_tx_dma, + .start_rx = qcom_geni_serial_start_rx_dma, + .stop_rx = qcom_geni_serial_stop_rx_dma, .set_termios = qcom_geni_serial_set_termios, .startup = qcom_geni_serial_startup, .request_port = qcom_geni_serial_request_port, @@ -1402,9 +1607,9 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) port->tx_fifo_width = DEF_FIFO_WIDTH_BITS; if (!data->console) { - port->rx_fifo = devm_kcalloc(uport->dev, - port->rx_fifo_depth, sizeof(u32), GFP_KERNEL); - if (!port->rx_fifo) + port->rx_buf = devm_kzalloc(uport->dev, + DMA_RX_BUF_SIZE, GFP_KERNEL); + if (!port->rx_buf) return -ENOMEM; } @@ -1534,12 +1739,12 @@ static int __maybe_unused qcom_geni_serial_sys_resume(struct device *dev) static const struct qcom_geni_device_data qcom_geni_console_data = { .console = true, - .handle_rx = handle_rx_console, + .mode = GENI_SE_FIFO, }; static const struct qcom_geni_device_data qcom_geni_uart_data = { .console = false, - .handle_rx = handle_rx_uart, + .mode = GENI_SE_DMA, }; static const struct dev_pm_ops qcom_geni_serial_pm_ops = {