From patchwork Tue Nov 22 10:21:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24244 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2118386wrr; Tue, 22 Nov 2022 02:23:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Ff7BwRkqnODgB8apHAc2WvN9lOOAlMlkiz3zsEdb25zAATABFObfSRjuHkQrcpJa5ljnj X-Received: by 2002:a17:907:37c:b0:7b2:73d0:4b9c with SMTP id rs28-20020a170907037c00b007b273d04b9cmr18791707ejb.746.1669112598220; Tue, 22 Nov 2022 02:23:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669112598; cv=none; d=google.com; s=arc-20160816; b=YCMsKuLnfPfaNcL6sqUuneYmKPbt6TWUPrR8lTqEvFABSn7zM4e9HtaPvfOG1mZpvO t/zc9CY4coqWNqovLFCRYchpSegtJjOjIE1f/XP5eROkmNZQyST1gn6zF3IDTjxNBjAE criniWIuxgaczdV/P6TYy0iT1WpZ6+LolbhLTmXmJi9fQ1Ob6WtE0wmPtdJ/3QdqNx1+ SGlf+tx2FPQN7m0w0fbWqsEk4cjAT7qR3pmvglSq5VIfDRTVputnpSE+l4PLR/sFF76O DpSw/W1nf6WEUh/MGH7snt8P/rbkQ0wONBoAX9iMB4UcNYS6DaI6IQkF4eQWlGFgrDKs yioQ== 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=En7UaSkfUFUHOMJ197P0rCWcbh1eLDF2yg6LLo4qi8ZK70k4plhCNocizJzeSEXmPg wCMzSLHUnxuDT7wOIZyBrzCwZ8GTD++IbPQPQt3TbXvLmSLZuy80lrpEbg5c7yQqcJN9 rcfERWoRdyNfRNGJi28huylKuByw2yTAA2a2sH48f4UemLRhiz12rNGQ+D5ddqyAUI4b hxweqiZedALVY+gZPq/Y5sUDBOpPl2QyWohzi/ixvSyUGH216VpSO2Cw7P7iWLzOybdh I5uGGY0G/NVaLaSSHiSwAfFBLnPqJ9QnvDKF1NtnlEkIWxgG/Qladft631qvqe5Q7O8E dXBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=qWHugDNc; 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 jg7-20020a170907970700b007ac60b83407si11555472ejc.725.2022.11.22.02.22.54; Tue, 22 Nov 2022 02:23:18 -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=qWHugDNc; 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 S233431AbiKVKWW (ORCPT + 99 others); Tue, 22 Nov 2022 05:22:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233461AbiKVKVt (ORCPT ); Tue, 22 Nov 2022 05:21:49 -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 688FB192A3 for ; Tue, 22 Nov 2022 02:21:43 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id e11so11061094wru.8 for ; Tue, 22 Nov 2022 02:21:43 -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=qWHugDNcVkjomPaQsfZ4/isqFWLeE3ZO/OmoCsuLTZO3YjlJe0rgcmRkDPz38GRpQb BT5LgOv9c/2zm/E2YPXjCbHb6c0zgLcQRZdBejuZgdEhMI2TeWYOhhldRlysQ1pHgLz8 vPSjakesx33UiH3YXSHLwtxkFZPKsV4YIEVbHXDrl/DEHeAb1ugeuL/wyd12Y0mP3CJx GpV+1RHWqIgiov2fwlBTv8Hy2pB3la15XvgcCLelo2RlxY4kVZ7zy0mSxHEJUFrY6tSD 5vDuwio1lssYSChU6p4RPf+rUYpfcg+WHJoD0SwK8AFvsaj7X9rNu179BLgo7A3MQMuL uStw== 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=LcsLZSpDSlawD9LHq5ztBiZ7LaKG6zH8h9lJPuKJlbRMcVhlgMYD6jLi9S1pYUEizO SBDvpE0wtBSJX0niI5ZZjXt26IjiiAuINMnv24SgZocRXbvXgNs4V3T/WDG6ocj8vfT/ hejJ3PcCydhVgVqLPDjSmlCRN0C0RtME0GY8FqXxi5JmlKoU/s2kAIZfWjcJ3/9ck+Jp GAWLaQhWQ04PyQnnDc3BvT485uRtoe3zfvTVOUuTzUKzhKlteZp3SwyMAk5Qln9/UYw4 OsHTlGC7rwfYaOd79Pil04OPWsP0xhPBL8ZqLcbQSYR86LimLZX0vIvgTyxHNRSWwUhL atOA== X-Gm-Message-State: ANoB5pnlcLG8+5RrzzafbDtQzv+heRY5tROEMrVsJYaTrYB59pBHPl6X K1SmOkzjHLXhG72zlerW035LJA== X-Received: by 2002:adf:e84f:0:b0:22e:37c1:b225 with SMTP id d15-20020adfe84f000000b0022e37c1b225mr12954282wrn.428.1669112501851; Tue, 22 Nov 2022 02:21:41 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:e011:9e81:66f1:3415]) by smtp.gmail.com with ESMTPSA id o3-20020a5d4083000000b002366e8eee11sm13432873wrp.101.2022.11.22.02.21.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 02:21:41 -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 v2 01/15] tty: serial: qcom-geni-serial: drop unneeded forward definitions Date: Tue, 22 Nov 2022 11:21:11 +0100 Message-Id: <20221122102125.142075-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221122102125.142075-1-brgl@bgdev.pl> References: <20221122102125.142075-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?1750191411578874406?= X-GMAIL-MSGID: =?utf-8?q?1750191411578874406?= 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 Tue Nov 22 10:21:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24248 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2118595wrr; Tue, 22 Nov 2022 02:23:48 -0800 (PST) X-Google-Smtp-Source: AA0mqf4u3n9C1wa2Oc+Vr8T97rgtL5RVaudpuXMiKDG5D311dwRaT67/ZGDROeWQEcOHYUr9uDTk X-Received: by 2002:a17:907:986c:b0:7a0:b505:e8f9 with SMTP id ko12-20020a170907986c00b007a0b505e8f9mr8448303ejc.216.1669112628757; Tue, 22 Nov 2022 02:23:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669112628; cv=none; d=google.com; s=arc-20160816; b=LdIQFMSEZBotlhswYdY295sGPe3nGg05vRdvkuB8vT+KAKt65qcH9tc3jVXdY2UhBT ry3xqZJ/SWJ+Qs13d8l9zQmRxJKWHwLE9c1hy+kztMI65JYxkunNAUTR+FLGjY9YFkyI o0vihMD5ai6m38kzSq8bQbAuhU5nuGGY+jOWlPFGazXiItsd2eHbr7DwaZfiiSiwUlm7 GGkOh8VW3L0B5ePxOFXDZi/GwgQize+i3SLIdK7ICekyeBz1TVr7CzMaN6g0mwxY+1fB 9it5PIBcGt3uHxytGC6NauSdFVUSvIOMBy1/Rqq/WTD/GFiy15bvg7zcNamMH0FvhfAM +mBw== 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=x+8McVhjGHxIdSNqZoYGTITmU1Q7ePsDkQfqTZcQcL5eqQwIpaOL65tflTPHOCeUzT YCfw8mHctFIklal3qbSvnR04X9j6JR93zXS4c3u6NzAQCr4uFzKfHg6j/PRc/g38afIc DLymCctbAxyQJCWdBD4ESgGt3LbENHqBWRK25HbnNU1/YK+ZrW5qmpAcY5VwRXwpAOCQ VVV4N1etyreRE1co6Aew9jpTCqXlpLUDHYOR1XaT74sM6BUPHg77S+CrThwOj1gaUJRo 2VI7Z4V7oGbPcI52cJazvAZCU+g7C5ACy5lBnFZ3JmxEElFuZVyp0nKlN1dSXqDSUmOf AW0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b="lXri/kjk"; 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 og17-20020a1709071dd100b007a9e6f0f82fsi354235ejc.516.2022.11.22.02.23.25; Tue, 22 Nov 2022 02:23:48 -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="lXri/kjk"; 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 S233473AbiKVKW2 (ORCPT + 99 others); Tue, 22 Nov 2022 05:22:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233016AbiKVKVw (ORCPT ); Tue, 22 Nov 2022 05:21:52 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4968C1E705 for ; Tue, 22 Nov 2022 02:21:44 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id bs21so23993234wrb.4 for ; Tue, 22 Nov 2022 02:21:44 -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=lXri/kjkjF6wgMkUC9670NWTNkvUagyJHjO/mp/WQk9YIFgBxvqgeKuTRyPtSwv4Ys 0szCZxbswm8NB260ozpnUy5hd4bw0SwWXRuMyRpv9+Z+IUAGnw0oDT2tCAvXZWihBSUd 3dH/qKcJm9mNyi5V5uhQw1B2Io4JszwFJA934peEDCI7VUOGCjp735xlfETSwowadnC6 DPCPzzA0U7P0nQIVUfBmjCJnFYl6145znTct8ToidcomhW/VQR+1J9R+GnIuSmT38urb mEbloh9iU4FT3uTLqf2i97w2jpnakU2HJv9w7vXSIkIgfbrNmLyhA1WkDHS0YtEL4PKU f5Gg== 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=fg+cxSqSwTaJPrb6LUxFBFznZa+2nukO4yhBK6fZdLjI5gzlCZQe0H3uT6n7FEKgcx UMCEGz13s9vsvVBGihX4jMfxwxUWFsxzbrQuS/ZUlab/foPlVQvtXeFPmf9tIDG9JWMS YX7ivzaIy8eddQ+TkGJWzBcNSlc8xakX+N37GQsJNnzXrZ+2YzR2lQYjI27RrLmQzp22 G6a9YoF4aR5duFkmdcTvJp+zYvvCuYbFuSBm9vsxKwuw/9hmkvsDt0ppY28nAuLsMvSX qMSAB7VlNpZ1d+Hhdxi5p9FqBjUAeK79vn2JTRsBXHhpfh7f69SmOQqFrSl1SEVAFXsD Kitw== X-Gm-Message-State: ANoB5pk6hF/q3YUnyc4QXMxjsU9WGQ5qQrTqDL6jO4WZFR0THZumBZsO /Lj/aUfXhuA9f3T3AZ01bDSEBA== X-Received: by 2002:adf:cd82:0:b0:238:b29e:4919 with SMTP id q2-20020adfcd82000000b00238b29e4919mr13769717wrj.583.1669112502874; Tue, 22 Nov 2022 02:21:42 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:e011:9e81:66f1:3415]) by smtp.gmail.com with ESMTPSA id o3-20020a5d4083000000b002366e8eee11sm13432873wrp.101.2022.11.22.02.21.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 02:21:42 -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 v2 02/15] tty: serial: qcom-geni-serial: remove unused symbols Date: Tue, 22 Nov 2022 11:21:12 +0100 Message-Id: <20221122102125.142075-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221122102125.142075-1-brgl@bgdev.pl> References: <20221122102125.142075-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?1750191443861427607?= X-GMAIL-MSGID: =?utf-8?q?1750191443861427607?= 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 Tue Nov 22 10:21:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24245 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2118499wrr; Tue, 22 Nov 2022 02:23:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf5w6oPjEqbF7LEPVhXNPHhLQndQNYNcj26QzOPWI9JQUnQNUJAQ1jqyTaphkRtRQXOQtvgY X-Received: by 2002:a05:6402:f:b0:468:56c3:7c8 with SMTP id d15-20020a056402000f00b0046856c307c8mr20738981edu.109.1669112613629; Tue, 22 Nov 2022 02:23:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669112613; cv=none; d=google.com; s=arc-20160816; b=RYUS3gVpC22tzfSDqH4swci5iJLWtO6RIjMnzx+/uJ3J7+CwIu2wtd1VjP146N0FhS EhS3tlxFcvlyVvegzNTjq3JegZe2qcF5EnsZ5cMbrriHQxv0Mfmgg1dZL/CP96ebOE3+ TwGPHZNerX4J6VWbi+Nxbw596cCiF+bOCSkbIWXyfve3CVw6+lXDDRFChtCtf+vI7mp7 +B4nuAeUgNe7ldh8Hu+RcmO0K+4tTpmPzVPLKle1EAX9QUJb1ecb+NSy6sRoGAPDbyvF jtaR6lPe6Uf1kzpxVGuVQGS/g20BxR+CfeiLR4G4EtMGZiP0jlDc/m5hLumM5D7eZ1VP m0kg== 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=CGOOjkWvsfNQd4ZEyIcmoXkSYdy002vFKjEHy6FpJjRbR44dt9fu1BydRcvBrla6BM N6ulratmULRv7s89JrzUPdX4Q59tu890Y8YntsIPGYSln/N9XZfk3Qev6DHvJVGVC+az qbgvxFwfNTjWH2GbgCekds+l6HX8vcNg0ouEYGu3+16o8/kRGFBh6Nh60KkUm3Yzw53I TPlvJaE0E8ME0DgEJ9iHhmiLKcizVo9nPOVPWRkyY8pOgGmOg4EVrApQg59HCssZiO+8 YYLYOqdRw0LXh8KMtwVPIQ4H7gaNBcX3/XrlltdMitOzDFfDJR1/WwlJI4YJpIHfAhDi 5zbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=FYfzwS4C; 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 cy17-20020a0564021c9100b00463cdad3915si9892507edb.521.2022.11.22.02.23.09; Tue, 22 Nov 2022 02:23:33 -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=FYfzwS4C; 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 S233483AbiKVKWa (ORCPT + 99 others); Tue, 22 Nov 2022 05:22:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230468AbiKVKVw (ORCPT ); Tue, 22 Nov 2022 05:21:52 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67A9C20367 for ; Tue, 22 Nov 2022 02:21:45 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id i12so20113319wrb.0 for ; Tue, 22 Nov 2022 02:21:45 -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=FYfzwS4CBrRcXV5ZFnLGwjwIz55YZzRUisru4kJviiTfhx0Xb7YABMkuRTXPsZQtuZ Tgl+WByJ+uyYYK4OhOAotaGNnq5eawB9MQ7SzTc2PqanALdWpXM5uvw+U++3rjvruaVc UnlpPICZ2pLTyb/GWYXsKowF2O7698PNkDgCMiX0yrA3+NmSajm7YgRohZgmIcbm4t7p RjFFyr5yBvekdoQgybn0OQzdPNlp+ilYm2ahefYR5hDjRqQZxrk4O2hwQpWv1ka+jbAA leihr0Z3RpKbmLuhIaXy3omF+C1kWJ0KQoyFpTNy+508uT0DJKmuxpUKQfFjHwmJW/x/ eGXg== 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=OH3jJwyE6pVIUgiofY3PcfxGsrsma6f30TZW8qfHp5J3HzvY+TG1lSwh9jEmFBbwNu hKHufSa1h5W5sUiWyODDMuli/w+RDVzK8LLq79uhcft7LtK3nVn/vX3QvKTlo3g9XTYj 8Ds6vCUKQk7/v8VuKuNR1BA2Ut05bZfrYNShineM0kldTgLoonAzoEi0EtDp26Hzx6LU 5vYkaV8AOmfgzVVAGNNf5mwmtRZZ8ZQGOA6tSp2HVeOaPJvlqOxNn9rHTN+9/z3Ul8i5 PPVc1usMhkZklX4Xi5cJjlU7dPsTlKF9SaZEL3vX0QQj+RiZrJ6KVEgDlbMlMC3HuDt2 Le1A== X-Gm-Message-State: ANoB5pltRhseUcAIGnMsPD3Hv3+Qm0kfqQxnzP12keQ52jKa0YnCdMCG n1WsDCFPIvPZAQQHLqPJZ5K+aw== X-Received: by 2002:adf:e190:0:b0:241:d451:7fc9 with SMTP id az16-20020adfe190000000b00241d4517fc9mr3861780wrb.223.1669112503975; Tue, 22 Nov 2022 02:21:43 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:e011:9e81:66f1:3415]) by smtp.gmail.com with ESMTPSA id o3-20020a5d4083000000b002366e8eee11sm13432873wrp.101.2022.11.22.02.21.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 02:21:43 -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 v2 03/15] tty: serial: qcom-geni-serial: align #define values Date: Tue, 22 Nov 2022 11:21:13 +0100 Message-Id: <20221122102125.142075-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221122102125.142075-1-brgl@bgdev.pl> References: <20221122102125.142075-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?1750191427848831850?= X-GMAIL-MSGID: =?utf-8?q?1750191427848831850?= 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 Tue Nov 22 10:21:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24246 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2118550wrr; Tue, 22 Nov 2022 02:23:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf6ydahKj2uDrh7MD4o1zPUEafoGWLQZ3QlxNA46moi0bR/MjQ2TjPEjkF5t4bvMif6R7H6G X-Received: by 2002:a17:906:2c04:b0:7ad:8a7a:2343 with SMTP id e4-20020a1709062c0400b007ad8a7a2343mr3179722ejh.225.1669112622170; Tue, 22 Nov 2022 02:23:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669112622; cv=none; d=google.com; s=arc-20160816; b=wGdBrB/Pt3WPz2Jz1HU73N5IEVnmZ8ZWzQiwbruuWbLwSSDIz0TG56vghF+34KyHPT YGivEvIcadxLLXj4YeiZYAGfV//94hRjk+Rrl1dZok2V2H/Y6EXANH/OqQ5Pe4p+Xm73 SXZdshc73EyXp3CnVEKZFNsW84Q28IETOW0oVBlPZtmOT6DWOIt+xSZPBT0RJ9HR0jI2 gHXU5pNOmuCjlDkDUQ+FhZtkE5HjRAheZkeE5CHVIPYIewG59dIneWAPEwR8We/GiLtG 1uhbaqVE5E6XgJ8bL/+YET4gQGCmw0beTn9G3yvMyEsWrlbVK04nlpvLZcrTTzyn+0lH 66Fw== 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=hAh/rn4h+xjlJJOpanDDKO6TN2bkgiodIniTAtN0aXzKxV7WFyQYxEgpJcRX/vWBk1 KZbOTxtYrkQpSrdK0C2U48llQHnKpnqVkIjzv3bWS1qNjeqCkDqKP0kaunPsxZKp+tDi LWItw/BwNvYNlR2pMqhL9ufI8SZeSckuLdOOSNcMCb/HI0eumOzorQE+VMwt0o96m3hd MhrscKq37jdRJa8fSTgPZncMT0I/LbnMCOn+BO7sisaRcXYMOpTYeYrjHYVozb2fHtXY bSIEkO7DHNxagtgNRgQRxFcwftVSIMr5twuddf5ZxcE6hzYiVEuYBXPe6TLtLz87BFuq UZvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b="n46/Bzxp"; 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 m9-20020a170906848900b007418a1e877dsi9589120ejx.580.2022.11.22.02.23.17; Tue, 22 Nov 2022 02:23:42 -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="n46/Bzxp"; 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 S233501AbiKVKWf (ORCPT + 99 others); Tue, 22 Nov 2022 05:22:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232894AbiKVKVy (ORCPT ); Tue, 22 Nov 2022 05:21:54 -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 74B8D205FC for ; Tue, 22 Nov 2022 02:21:46 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id e11so11061306wru.8 for ; Tue, 22 Nov 2022 02:21:46 -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=n46/Bzxpis8t8nDSvP5/hO7IKMa4gViNFmxoDwApmrQQ6Ykxt19O5+rHwlaAUQAqZk iuYeqvWzkokkzx6wJYg6HzRUZ897kPhbw2m5ptzMlfGq7urRU5jxt+psRLdHW1a231Rf XycpjPPCw2gIksQVYCZQ0xIiAXy+LIdCiWrDzIIIeXSOtaNa8+10/itmrVumwmBRNAqd SqKulZuEBarl6TGWAMSGdR6U1PmVk0svLGKx71c3mCkJnIwjsW7HIDLd7q0q740QUMfL OmZOuRsoM3GixuE9AEMvYBY1YxJLXGcstJMLvOqFRY8U65iry7NJ3dg8h58d1D3CbI9q 9/Ag== 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=fiBbgkZgwjtQaCHYnC/yclpz5lyEurAfyLWBok2QS1S99Bx29sVI0u84nRS9hqRZLq KmsnF1an4hhPIba/cUz/IXJSoxWokz846aQGJ9LrvBErwxSUHlTjHqzlUqlMwxZPghq1 G2myaRyVpru0ZKDy2LCxHpy7ejNif/3enNXOVyi9VrZ5va1dWegTgnL6GxrQqc2TDp+l 87bBZk2XJlF1Gx2TrRweLMOaPicoK5I9aHo5TnBpjqXQcRzj+rIDGgoly6nVM81ZjIJI SiydQRvLa5kUbudsXY0YY6vfcAYuBMtt9yR0psFrJCDv+TjZ6d/EATjDfmNjfZbvFS2V 9/qg== X-Gm-Message-State: ANoB5plhlg+g9vGphT1ulziWvh/SmXYzFfU6jv95EhVwJv8DUSb4TmSB U5pSWpGNl4ODiJFPfwtB7huRtw== X-Received: by 2002:a5d:4484:0:b0:241:9b26:d18e with SMTP id j4-20020a5d4484000000b002419b26d18emr13311986wrq.548.1669112504996; Tue, 22 Nov 2022 02:21:44 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:e011:9e81:66f1:3415]) by smtp.gmail.com with ESMTPSA id o3-20020a5d4083000000b002366e8eee11sm13432873wrp.101.2022.11.22.02.21.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 02:21:44 -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 v2 04/15] tty: serial: qcom-geni-serial: improve the to_dev_port() macro Date: Tue, 22 Nov 2022 11:21:14 +0100 Message-Id: <20221122102125.142075-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221122102125.142075-1-brgl@bgdev.pl> References: <20221122102125.142075-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?1750191437264378809?= X-GMAIL-MSGID: =?utf-8?q?1750191437264378809?= 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 Tue Nov 22 10:21:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24247 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2118575wrr; Tue, 22 Nov 2022 02:23:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf5H5zJTUAzWf9YTxmrAC4+g1chIOpFFNjyLvcr81ykDNiaQA2Vgb9lJyqnmDcRBA+p6yACs X-Received: by 2002:a17:906:a08e:b0:7ad:79c0:5479 with SMTP id q14-20020a170906a08e00b007ad79c05479mr11313458ejy.392.1669112625442; Tue, 22 Nov 2022 02:23:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669112625; cv=none; d=google.com; s=arc-20160816; b=HVekmAGxWrcn5nCe6X5DRARzppOuovu8xrIrcBtD+yS4rBrPQlxctL6mNnEr+B4Crn CFZxVltu2hFkur/qA5uemTKxAw98e5/yD4BtcEvtIQn6t2eydr37EHyepRJJpouSf+QU vn1KESYa/wWWvg3buaZMR04J9uD54jb0yXQfnr1EFUXSW9rxPBF/dh5y3fVB/oakV/oi 2X11PlSmHf66D9vvGA+ELZTFpdoKbeml7XDm01l4Zt3uAdbOmfA/FPBEjqmReNrKDeMv m9Qtq3CZX8RDfMNSSBgVqteFpHbgdDC8AFGAKzLfWGdl1ALq3VRKjfiMLm/JtxPqf25t 9+hQ== 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=L0KsZw9P/Qu9NbFnmsCFgpm7LLOLLRAeZx5TufxC/R2EDBAIyUJFjFxEeH4wsSyNzl bGescjEACVMp9QiaLcroKrmJphiK43vEDK4S0/KLzScf/X0bWXmnqFrr+HUgtZfo9BzG bhcGHZ9yjm2ptrRRT3T3vFXriXsLFUXSMGL2JT/BhowuqFAw4eU6SBsrwkHoV3A0cpEm z6LRc4WGPzuZyQQEle0GDdcgmwKQcxSA0KPZrMvl3PqLl83dIwEiGvhn/xUPB0f+jLO6 YzoGRraMkC80AMVjK4e4s81MMsyFQ3bKghohT46/HpBxpR4UK+MJRi2Ae6XOK/lwpF/5 KmDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=R6ndji7+; 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 qw25-20020a1709066a1900b007adcaf49e94si5349180ejc.157.2022.11.22.02.23.22; Tue, 22 Nov 2022 02:23:45 -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=R6ndji7+; 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 S233509AbiKVKWx (ORCPT + 99 others); Tue, 22 Nov 2022 05:22:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233508AbiKVKV7 (ORCPT ); Tue, 22 Nov 2022 05:21:59 -0500 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F22B2B63E for ; Tue, 22 Nov 2022 02:21:47 -0800 (PST) Received: by mail-wm1-x32f.google.com with SMTP id p13-20020a05600c468d00b003cf8859ed1bso10949900wmo.1 for ; Tue, 22 Nov 2022 02:21:47 -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=R6ndji7+Z7eIGI+xSLKlf1o4GusY5/a6I5ZysX39NUiu7KpKfdXWgeXYc+71C0WmTH jVkqWnAB4XPTlrikOJiwnfswZOD1AEVX9BALyKNi0eXQLb2hu++iL6obIRd63rOpi31p VysrjF1RhgWa7jfLrPlUUS42wlrvWBD2tqcOKo0U7LI7tqhHJQjx2lF53YbONT9oABvI jheecx0OTkOSLhwTATg1kneO3685gDluzpuqQeE6nTD10t0ioc3J3Q3WX7qLCX9HNmow H3qB0hyXuw16p0W9EJo4sDEEll4R+J1SeUJxC7y3E9nsZGYedXsgu1TX/C/LYIjyeVI7 u4iA== 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=BnOMZOPiTTzCCKc6+46Og0jNAndHmnHZMT7K7DuaIQYePsXY0itpjR4VRPhs1yno1d iKyx9xnzqw/mghVHedx6DnqvvYBpeOYBA+uHCWqOM6x54mQ+1gmDUjVK/5ILuoGmcaKE R4WuWZlUkW3J4cFksiPvg1KfcWeI9V+y2ZSvEFOuyRYeGomw4htgLVE+7r3gYBYHtt2B +MmI7ikS8W4750JaO+jFtyiVe9EG9suFlUvhvqUozaRCZC39QvwWXldiL+6BZXlrtoF1 TO905EwijO1rLvdFNpOJeXMxgEubq5IsqTaU206PS7qplOs3W6Z3fW11zZfdFV5oF5+9 jrFw== X-Gm-Message-State: ANoB5pk8+98N5hvspk+uPja6XdQI7lY/ih5v0XabhGOA+1+PK1RKdQMO rFs0anlNZie5S3LtlNpvNJ105w== X-Received: by 2002:a05:600c:4e8d:b0:3c7:6e1:b5c9 with SMTP id f13-20020a05600c4e8d00b003c706e1b5c9mr9520274wmq.154.1669112506011; Tue, 22 Nov 2022 02:21:46 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:e011:9e81:66f1:3415]) by smtp.gmail.com with ESMTPSA id o3-20020a5d4083000000b002366e8eee11sm13432873wrp.101.2022.11.22.02.21.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 02:21:45 -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 v2 05/15] tty: serial: qcom-geni-serial: remove stray newlines Date: Tue, 22 Nov 2022 11:21:15 +0100 Message-Id: <20221122102125.142075-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221122102125.142075-1-brgl@bgdev.pl> References: <20221122102125.142075-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?1750191440317932369?= X-GMAIL-MSGID: =?utf-8?q?1750191440317932369?= 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 Tue Nov 22 10:21:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24249 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2118644wrr; Tue, 22 Nov 2022 02:23:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf4cOqtoNYkZSLIE+VWdyzUgrEky8/cOq/qBD8wAwVxq0dgRGBjN+h5QnX+ZQDfMWWboUIkO X-Received: by 2002:a05:6402:3808:b0:468:c911:d843 with SMTP id es8-20020a056402380800b00468c911d843mr20367010edb.422.1669112636531; Tue, 22 Nov 2022 02:23:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669112636; cv=none; d=google.com; s=arc-20160816; b=Ueygo+uaGkdVEGq9lf6ZxKXNnunDUkCbzQRmYMc8B0K4ichiCV5B0qALPM1j/k3zDZ qfTmAl/2c6YaZPS26TtscToS6BUT08UheFR3qFUkhTwtgfOIvdKZx+jjUA5+KkNTyaXu QRlc3sbMpQLl+7wSzasTOWP3FVHizHS57EhaVzSnyFwP6EiJZU/Wa6kw+sk1HM6LO3b/ BfN8fCGBTkKDKJmDAcKIl/yAePXKSfhx31FZpiNBZqiZkgyoE7HL8NeH97QPwdHWCNLq i9MZNyOaqjVQTPev2o/0XZ2kGLQJzd1rPJl4hAo3oz4KB5/APZllQca3K1e9JTPGheMC ++Mw== 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=j+X5EMuSWufZp+Z8hkFm2zm9ikuxqCq4mAY8N2FU+8IiEm5l46ziphW46ZsdkHD5Sg 1cdYmCHP2SWXr6K6gK3T5PLxJMqwJcduv+llpgZABinDT4deDfo9cXcHK2EbMd7YjQfQ PfqWQEZJn6tY1wmHBO5IVstD8OvVIQpYfDcVm5WaOl7bzArAk5QJsmQv0IrCKQAjzWra QYUKY4kchzgqA4Q9qyvX7NR1NKCbttO7RCyU7e6XiHkdDQA1ECQzP737mOIeY5BiLYel fLNKajJGJyxaHvgRdm7QpScztV0L6dmQRn7Myq5rJTl2xAi6Ico+PXFvBklamNSpGEAG YN8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=ndwSmtL+; 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 h8-20020a0564020e0800b004613ae68ca0si1677191edh.442.2022.11.22.02.23.31; Tue, 22 Nov 2022 02:23:56 -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=ndwSmtL+; 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 S233574AbiKVKXI (ORCPT + 99 others); Tue, 22 Nov 2022 05:23:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233525AbiKVKWB (ORCPT ); Tue, 22 Nov 2022 05:22:01 -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 7B8F631FBD for ; Tue, 22 Nov 2022 02:21:48 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id d1so11863102wrs.12 for ; Tue, 22 Nov 2022 02:21:48 -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=ndwSmtL+kAnfwuKf91FC6UZir/RZb1ZDDCnNFXt0T4Lq8cS85ReAD+6SX5v0lqE++L 0445vCIfJJSnQYou686J4MPxo4mqcXUpWrqHwqPlb2QfhZ5KVxoWZujCf1AUG9lJo2EW Tc+j/Vk3YdG2GdTGHKQM/rEFn3XFE1fFnYs4fUwBQC8Rkf5RbUA5xNDQzaTFDKFboDNR jo7kngEVk8S3VnBahuzZPCvBhBY2mHiuJkOpv2PYV/ykJjhq/sPhw7jR4gQUYudXVJ8H odrTvG+8/1snCWxy6gR9x9FEMaFWyt/53O0Vm2lZkBqm5SaP4G2D4pnG0xnaWab09IMi CSKQ== 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=XQzL/q3djbVndscV3BKI/dlcZ7lDLJQFcjHbv9vohm5fjzoW+xqJJpZKQj/2OHKBWh g3r+NpRCswCeUp2zbkZb4gLKPrwD8P5X45+pOEqK7YPDipFmwUhJLcD6T43DeBk4YcWN NxjA3cV3+LZ9/Zc4ugaiNnBrkcW9C+9Z3g4lYedNppKwphbnbRS1I3sm1XbH92xE7nEb baaOeTKuMU4fr8W+uCF96DB1d1meKO/42W0IhUCuZFJO3cKjPMv1i8j6oR5D0AmVxBrN 4HwvJIDtFnLfHCCwrknN9q8tnmoXqOqXo/ufjROxvPSciCZwqzxx/1TkZ92B5Y4Geuur dEYQ== X-Gm-Message-State: ANoB5pneYY8LN29Y7s4T6zInvWQdHB0lqj2h6BkPif8sauQgUVAV8LHB qKs3xgTE0llNSwC9Hjv7sXQsqw== X-Received: by 2002:a05:6000:16c2:b0:241:c56c:b485 with SMTP id h2-20020a05600016c200b00241c56cb485mr10018000wrf.566.1669112507036; Tue, 22 Nov 2022 02:21:47 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:e011:9e81:66f1:3415]) by smtp.gmail.com with ESMTPSA id o3-20020a5d4083000000b002366e8eee11sm13432873wrp.101.2022.11.22.02.21.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 02:21:46 -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 v2 06/15] tty: serial: qcom-geni-serial: refactor qcom_geni_serial_isr() Date: Tue, 22 Nov 2022 11:21:16 +0100 Message-Id: <20221122102125.142075-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221122102125.142075-1-brgl@bgdev.pl> References: <20221122102125.142075-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?1750191452246192242?= X-GMAIL-MSGID: =?utf-8?q?1750191452246192242?= 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 Tue Nov 22 10:21:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24252 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2118783wrr; Tue, 22 Nov 2022 02:24:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf4wyCoPI9plBMBFU4KkADe4irQpH2ApLBoBZ05kvPDFZBlLHhIUUNgUS900zJlz3igCgt5Y X-Received: by 2002:aa7:cb58:0:b0:469:3902:9b78 with SMTP id w24-20020aa7cb58000000b0046939029b78mr11697865edt.403.1669112666028; Tue, 22 Nov 2022 02:24:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669112666; cv=none; d=google.com; s=arc-20160816; b=xs/wU2OPkGitfVpdCH5mFSXsS55COfI2DlvkkfmQda/LBjDCtU9j/JzFjsHZKOWhq/ qMadM1IKOoNwtEcQF7I1O+GvFe6/ga5WrRyDkLBVGF5wDnHJuUvgggB2IlaZsqjPuV82 IttlIcsQl6Lk17UfT2PgPwW9SozEgRUq9PhZtgqJw5UbNfiGUSHYcd0+cbepaeGMnjZZ DeljrkyC2Qx3HrZmtVWxXW5xKiaays+HpFPQsL+ELIXgNRodmRgGS2z0oLk5bLnxjBWK Rl6Y2AHM1ylHz2cXxpFVweHSAfnb5nVIS8ekS4vYzzqzIpoy5WiCMJW5USPkiC79H/Md 9Xqg== 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=ECfBYxhS8wy6wnQVAV3FkkhxGUj6tUSIawDKFdKl3kaM88FO+IxiV0VMNQm3OISZTS rK436qxZEKqkBsJUohwDB4ypzpy11S1AwetiNyqFRWA3WUm9sqa+GCnmH2mLjk3+hZW8 WfqKZ6yObjy0ybLdGiC5n4IiKrgugzbtGBQSAYcaXMvUqQ74TjOXIwmU7sH/u105nWAU jSkQhPDQGw6i50dBlW3bhCtHQlO22EDL7H+zXIyuQXLsUmhRdnLlqCo54cZu2/2/YAXh ZPTrzzU16BfaC8vv2sXcABgU02Yz3ysIek9pADBnWlwhfVCfiG101CAgWmI/7m11c2Ws eUHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=badEK2Wd; 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 bo26-20020a0564020b3a00b00469abb21f9esi3525739edb.129.2022.11.22.02.24.02; Tue, 22 Nov 2022 02:24:26 -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=badEK2Wd; 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 S233599AbiKVKXR (ORCPT + 99 others); Tue, 22 Nov 2022 05:23:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233551AbiKVKWD (ORCPT ); Tue, 22 Nov 2022 05:22:03 -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 64A423C6C9 for ; Tue, 22 Nov 2022 02:21:49 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id x5so19908817wrt.7 for ; Tue, 22 Nov 2022 02:21:49 -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=badEK2WdoytxqPHQQJ2dTGNsZ/Ug5vkC26Nuou2trL0/6fuUZ+KxcNaBjzdiIxCemR 6wUkqx0R09h98Z/pHx3QSQ8r5ikWtPMk4EOuf/jxEn6k9SKtlNh8Mslt8UertvXt8JYn R4Revq2bFvBZlbdEQEqXL4hkr2J1SiL1C9rdjSaauNFB7c+omPi1EabF+Kt1k1c1tRip W8Lsxn1gIt8Z7e3u8Frq0XEd1WyY1EFig365eTh26oYz7TZFAc3KAZW5Nj9vMHs3fb3N MOuLD/3+PHqya6638adyVVlXaISFVZ+cxrPqzijS76PciKbT7LzKbyc1BNf/uj4iJTmw dxzw== 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=hIWCTS7e9EXAg2eXSQ8Ls+Ah2n7XZ73kI2bv7T+ocpJcv9t1vL4Z4iC1CgCWnTyOva 2qvw3L+Z6yG1FdgsItTlwPXpEhz4qF5axDWBQh9erkpr2SWrseojTNyQz6KaZzgBMCob 3KK1G7rSjh3hy23+5sMlGi5C3T8as+rD1nsdu94um9g30KI6Gse6rIwOE175IE4zzr8i HgrZoQHfIyaksWDxiMIynEwvfVxFTta0ECf+FwcUTdFtqEBq4jEKOBKYvZ438N3OcV0l HYYraaukc5dOYzugQGEsQtRiIbuSBG5dnxpuQI3sEl7LnglgrG4CV3dCiuTwMnZpycFU HTFw== X-Gm-Message-State: ANoB5plWq4RD1AQw0y7AtWxP1Eu1LO6zFA7ZsQ1HbzB9yvPtsBISWha5 vJpgprXX9NTMXd9dcErur+e0aw== X-Received: by 2002:adf:fdcb:0:b0:22e:386f:4088 with SMTP id i11-20020adffdcb000000b0022e386f4088mr13828460wrs.526.1669112507986; Tue, 22 Nov 2022 02:21:47 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:e011:9e81:66f1:3415]) by smtp.gmail.com with ESMTPSA id o3-20020a5d4083000000b002366e8eee11sm13432873wrp.101.2022.11.22.02.21.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 02:21:47 -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 v2 07/15] tty: serial: qcom-geni-serial: remove unneeded tabs Date: Tue, 22 Nov 2022 11:21:17 +0100 Message-Id: <20221122102125.142075-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221122102125.142075-1-brgl@bgdev.pl> References: <20221122102125.142075-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?1750191482864485255?= X-GMAIL-MSGID: =?utf-8?q?1750191482864485255?= 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 Tue Nov 22 10:21:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24250 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2118733wrr; Tue, 22 Nov 2022 02:24:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf59k57Thz222WQ2Qx8DrgyM48I47f/aXpblLNMM0qvDMXjEc6429XCpbiR772PkoVn8w/H2 X-Received: by 2002:a17:906:81cd:b0:7ad:beb3:91b6 with SMTP id e13-20020a17090681cd00b007adbeb391b6mr3882611ejx.159.1669112655989; Tue, 22 Nov 2022 02:24:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669112655; cv=none; d=google.com; s=arc-20160816; b=fkgt9O8Sf6daCxEnPBNGq4YYD+utDXWYsLfUQFroZpua+tN6mjySlvk8XO67twyVgg 9X00wylvE/MyL1iKFds0M6EEiQAfKGzxnrb4/NZA/b6TlwQqREfN5qlePS4Stc05E3kP MyFfEZWHpWTwTE5VMjy5ARz1SGX155s3UwLBA2+GTsF6c6Z0aY1+5ld790zRqfK2wGmb Vu6MZ8SzncZeFPmovP2G2PuKn2U15dsVkfQ3q/ogRcLt/rGomeug0Im+hPT8LQzdwQCJ L2cKAV88jTgQkwWo3mmv2/R2FXtlrDHnrtr/Ez3+uq7Fa/lxw6R6iugVk4psiOi+hqQa uiWA== 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=RYpjFP0TPO+spFUUuUpYpTzt5bZLTD8w3i5aRjIkqpeAuWT7t2bkCNDXI5E46SeRA/ O5QCWdpiDfpVe4gw4ykf0Mywi+bueS2R4E1inZ36HHXHVvepWRfbiE8mJXLSUImQ4UAR JRq4y3JnhVIVqLJapj7b/owaJXs3gYSGdVKg/Yfj/FTLkzoVWZkaaKS7OLK1LqjUFEpZ BeXWQYVxRwNZtafnNGWF7gCsDN3L5MrjOFezkm3ywKHZcjntRyPXLaAn9m9Eu3EVUqJr 4rReuEEpqPtGWiIv6h7XVANbsEzaB8a1GL4nFBx6/XlrNAuTrW3Aihx7CPVaJtUNdkDP +olA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=fG9KF9TC; 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 ae12-20020a17090725cc00b007825337afeesi14699581ejc.273.2022.11.22.02.23.52; Tue, 22 Nov 2022 02:24:15 -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=fG9KF9TC; 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 S233572AbiKVKXU (ORCPT + 99 others); Tue, 22 Nov 2022 05:23:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233570AbiKVKWH (ORCPT ); Tue, 22 Nov 2022 05:22:07 -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 6174D41985 for ; Tue, 22 Nov 2022 02:21:50 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id x5so19908877wrt.7 for ; Tue, 22 Nov 2022 02:21:50 -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=fG9KF9TCboacMHM4Lqbb4TbFZF3dpm25PBc8vtuxLKqjWm2KdBep1qPauzfPaAQoMO mfTspLuptF7SrzxQUD0ssz88qQP+ZLWM8tZEOl+114Sz7P3w3u2fcYEATIm6hLKNfW/X 6lbJamPubM3iNHZTxD8jJG2u5ww1gi736U2gECXWH32Wkib5t+Q0Y2aJ7rvil3jBPS0B Uk3hCb9QMljrmnyrGogyhtGLtZqY/H4MHsHM0FsFUPipFMhONjqBvodWfWdnpFcRmkY3 O/kDhz12jkBIKsvb954rbJpx10BI9iPI2sbR7z02ELm02grGCxrpyNmerPxTOjF9au2X +UhQ== 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=pUbZZDeyi9zYNN11VtMP66t99VSF0BF5uzOYKl5bVXsOJOHlxr4WRb2dRoRfd6jmEJ 0BV5qa3AITwHHGFIGXVsPAJj1n5Zxmav0jDBDgFgQe3wUfBPmrm8n9GrozBfaobJyjhL B6Yh4ChuEyhiIhYxc/0SIQPf6DIfKOGv5Bg1rOD7sw/c7ril4SnOe2RapBwurQwUy5/F VV7NCDQcnwwYjSN5vNEVBcdA/hfswqOoXkQ/KwrYGqQ5Gye96b7h/Mg/lJEtuT05rgOx ytdj3fPiMZ7UMeRXWgFDCQ/LdKNlIwF+LEY5pms6o2HxP8g89tGLzfO7t7wtvS4YvkAr h8OQ== X-Gm-Message-State: ANoB5pllB/wO5TOaW+38vPAz+EuS9rRPumyvv2ffRA1x55EhRDLXkQmK 9ccyOLHJuTuHXz08glWYGbyDRQ== X-Received: by 2002:adf:e8cc:0:b0:236:7a1c:c437 with SMTP id k12-20020adfe8cc000000b002367a1cc437mr13408424wrn.124.1669112508869; Tue, 22 Nov 2022 02:21:48 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:e011:9e81:66f1:3415]) by smtp.gmail.com with ESMTPSA id o3-20020a5d4083000000b002366e8eee11sm13432873wrp.101.2022.11.22.02.21.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 02:21:48 -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 v2 08/15] tty: serial: qcom-geni-serial: refactor qcom_geni_serial_handle_tx() Date: Tue, 22 Nov 2022 11:21:18 +0100 Message-Id: <20221122102125.142075-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221122102125.142075-1-brgl@bgdev.pl> References: <20221122102125.142075-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?1750191472654574034?= X-GMAIL-MSGID: =?utf-8?q?1750191472654574034?= 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 Tue Nov 22 10:21:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24251 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2118753wrr; Tue, 22 Nov 2022 02:24:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf7kbb/jC3jvrTHRlS2NDkZ1fb4of3kFgXd70EyLbW0SrLbKBcBXEz8+pg7R8ZTwKiEp46CP X-Received: by 2002:a17:906:597:b0:7a8:fd1a:c073 with SMTP id 23-20020a170906059700b007a8fd1ac073mr11200814ejn.4.1669112661122; Tue, 22 Nov 2022 02:24:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669112661; cv=none; d=google.com; s=arc-20160816; b=EX/Oul2fwOToP952+jlD3KxtsAo9hMKNehdy9qqaIN+DBbXpRF5d/JtdWFeLKjjLAN TP4BlHLdq8yHeIh7optAE9P5I4GENeaU10JTC1KPhynLkXSKujqPTupNW74IgiLaEG3q ml+y/D09fkmMSXwWv30xHbJA1f8Mv0JDT95EQRLGeVcuZEGCqUvwao6v01eXN7aKslHW MYz2BCiyZfwWNX9VDv0ApV5N5h8DnJbxAzNCV/9b5HHLGeCg1zDy8ZFmDV2e0TVncXZ4 hQu3MD/aHO1eiFax8l+DT83ANNvjQ9ne6lbUNnCVR3P7BNX+aKwmVxyFYixhZaFwDoBT f1gg== 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=EPInrLOBaRRHtqKj0VdmmQrzKShr4rq03z/muZZTx9pzHTuNm+2LQ5PS+/UCcC8aJp dmuENyAO6uTJ73/xuANF9UB5giSL7SdBdX9v6UeTG2Baud2Dpyf02iiO3Po+NgvS0QjD hf1U8Zw1Og5dGLE/U0F8xX84hg4UBX/jGfw1dFK1aalQd/O25NofXMcJ9SPU8B0t/S/V T/Dr/QXjK+oc+d6kJ5EklRMm2gh5THGV03TnEDlej6z+6WQoxM9WU4SnQVWjwbGN8676 Qys8ps/Vf0IJWJ3Q4QW/mPBYFBvjxvlZj06S3Rjlv1qUAV0czjmFxZUzLnGhavDCZtxQ hERw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b="p5tYf/k5"; 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 sg42-20020a170907a42a00b007ade82b9e73si1130870ejc.757.2022.11.22.02.23.56; Tue, 22 Nov 2022 02:24:21 -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="p5tYf/k5"; 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 S233618AbiKVKXY (ORCPT + 99 others); Tue, 22 Nov 2022 05:23:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233569AbiKVKWH (ORCPT ); Tue, 22 Nov 2022 05:22:07 -0500 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B2933C6D6 for ; Tue, 22 Nov 2022 02:21:50 -0800 (PST) Received: by mail-wr1-x434.google.com with SMTP id x17so10515736wrn.6 for ; Tue, 22 Nov 2022 02:21:50 -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=p5tYf/k5kFhRazIIzD8o3PSLNCLLkbhWf5IpnTaCYOf/WP+9EuBZSo7s69h6Q94ChN n/Bcik7yUYAGKPWoJ4gyb9y2JHOlm3rrWIxUWSL2aRiRj/r9ibSL7T5LvAEYeCsBcvDi fDOZ7IovrDkq+U3UltW4+skli0Xy4Wvtq/2mQXSVLzzr4rE9w6hp3lWvXXY5FhSZRm1+ 0qepDYOH9luRPwTNWjBo4zd9Jn7KCbBeBfcyieczJvodOM4r9Yuv17uNRfq2vPNNGAcj wvg1H/UYaxTKbxkIrby6WlMu4PWFgRD6GAtUzbXn3rmnV43/htX16BeMvTP/XPlmjH6F XnEg== 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=6gOw/W1RbSaIbh5VuaWxN6eY87pCHRU8DtvqTpR7kl5EaVTUGZnOwIaAnxU1zJL8PH XH3XBb+fLJsGFa5eQt+TbHLavJEZo04YewrkyHzeQH+XtKyoTmaDyi/qjwwVYCFOTVie 9U5hXrxPDPLXXvCNkLW56ECFKerV8yjg9TeCcGvPT1vEVif6fSTl9NbdtRvbLS52mY5d 6keHVIsQe8HHrXxf4d2lBIunmqbykjcNhZDyQo3dkz9frGXQWbc8S/KPMCcWAe3y/fqe UnyXTK/Y+5B/oNCz4MqSFeREQMJfG+vjybTas8x4gTUnxESP0SUqz4mSJWLhlUJgT/Q9 VhxA== X-Gm-Message-State: ANoB5pnoHiMaMD3AEnyiMkluVHQt1+o0Na8yCJUJbgi716wIAF/qPmFH pOqSH5PU41fOwoYHTbo5nOTOGw== X-Received: by 2002:adf:f352:0:b0:236:7cdb:3c8b with SMTP id e18-20020adff352000000b002367cdb3c8bmr13444835wrp.280.1669112509815; Tue, 22 Nov 2022 02:21:49 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:e011:9e81:66f1:3415]) by smtp.gmail.com with ESMTPSA id o3-20020a5d4083000000b002366e8eee11sm13432873wrp.101.2022.11.22.02.21.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 02:21:49 -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 v2 09/15] tty: serial: qcom-geni-serial: drop the return value from handle_rx Date: Tue, 22 Nov 2022 11:21:19 +0100 Message-Id: <20221122102125.142075-10-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221122102125.142075-1-brgl@bgdev.pl> References: <20221122102125.142075-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?1750191478138705875?= X-GMAIL-MSGID: =?utf-8?q?1750191478138705875?= 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 Tue Nov 22 10:21:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24254 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2118878wrr; Tue, 22 Nov 2022 02:24:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf5guhIqiv1hNKnLK2dtEZCNfjGxnR2PPAiwKJnFMRtstJhSfk932BiJwgRYxfzWA259ZIVx X-Received: by 2002:a05:6402:b8c:b0:463:b8dc:893f with SMTP id cf12-20020a0564020b8c00b00463b8dc893fmr21023870edb.28.1669112687367; Tue, 22 Nov 2022 02:24:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669112687; cv=none; d=google.com; s=arc-20160816; b=FL1KwdGxfnpN17LUVG/iO0BGVv927JVNv8PphtZVoWWrSW72BxqPE/bzHf26KyvkfF 7WwISGzdVgGdUbLcMjIXWFTyezYMRHo3TaEVQ+p4CYayrokZz9TRBkAy4hacaa1/imQ8 dYYiSi4H7WNUopfQFdmxYLBfw0IGIxPrYTBbqxgT7FaoEDYsz6PvwiNkxxiID2p0Xitg 1P1oJfl6PMqj+Xt1qXx6PaGgIuhBpBvBmxJUc7xTwHfVwkngT8vW62vpDbNnivvaD6JU jXyO+sOFzeKjLZMvU2UqcZyk6zKUogYlP8L/qlY8zvGZlABtG6jTHll3cRhcqEl4Skto LdEQ== 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=RVg8JoMnWNk4b+NUi1q8AueBfb3reD0Dp/f7yoPGb0pAn4dChSbd1iaoukzPu5Lthz RJVqQo4qKPw/vThtLIV3MWAFQ11dR5FumJlawuS3VZz5ylbdTeSqmcKP51MTMVZWeK2K 1oa5j5p+lWc9bVkVjgQ/HE9rCaC9HsZSsgc/nO5VXjvJEdHma+EOzs+SrJM2KMV4kDM7 q3fMdo4XFibcfdFzs3rTy+bI/V2VKtzC5S2n9X75jC4XOZ5Mlpcq7g/UK671xDLlL368 MLPH6o6vxeoMww5ZVedJlPTZ/a5WUC2OoCn6EiqVWTeBDQdogp+saFHIKY7jpRJoizO6 JHtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=PkQHJpHo; 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 wu13-20020a170906eecd00b0078d4ba46622si13217517ejb.616.2022.11.22.02.24.23; Tue, 22 Nov 2022 02:24:47 -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=PkQHJpHo; 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 S233620AbiKVKXc (ORCPT + 99 others); Tue, 22 Nov 2022 05:23:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233586AbiKVKWJ (ORCPT ); Tue, 22 Nov 2022 05:22:09 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3377F42F4B for ; Tue, 22 Nov 2022 02:21:51 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id bs21so23993768wrb.4 for ; Tue, 22 Nov 2022 02:21:51 -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=PkQHJpHo/PEa66JrHtMHcptcmHQfpK7HwPkPNE24wY3a/XCrj17CjVss7i5bbt6kyC 7W1r7T0SFnCud9TzH5mKebgp/dRZd2z5xrC7cOalTRfWEs8j4RtFZv0SNk1rkir/BQez Bydjel/MgzF1mtqhilcLeTOvFDmAQHST3q2YRgemF/miuWseiY7Rk4Usaf1WNPnjm4NT CM/Cf5QRApqvvTjX1bq93yRSX9dtnaMrKtWm06NSKbmHrcNZ4MLR/8WDIR0oPWNfN8EL N8LX2QCvaIQh4jDKFtoeBIEDd/2sROpQx8qwxcasIgpL/t5QXjQG1fe6EeVKLV1JnbzW wNkg== 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=MdwsJNyV/KxLX8Qomo6EGn2goo0W0vJm+HoAOruKd39Gaehh7+6h6DfgH0Mvsmczpy VUIfaxu4hC49qpYUub0lPJJ5P/XrY5zZtWk4BtlKEHIanPzVXttmJ//qqlOaW1ESISnG ZNNDnwoI3pBpIcuOJHxyF05BE3sMTSr6V+VQko3FCWk94ApVvwBN5oIYuorGdHTMD/ts A8UrELxUvWeOzchliltDMFnpswlXmiAMxcOtMcAYfP0aE5de85xFkY1Px5OUaBll0erl ZVCk+1Fsyh0I2TQ062wbVs0tlruyaueVUoC94yFLzpoIHjCi9ipWOqvH1c29IbpzJ7Rn GUng== X-Gm-Message-State: ANoB5pnmuzK8WQ0rF2NoKjDTzHNwER7v6cOLrtgTquogjhXTVn+K3JD3 59zMOzq2mBfzrCdeUFwBgmrmZQ== X-Received: by 2002:adf:fc8e:0:b0:241:855e:34d6 with SMTP id g14-20020adffc8e000000b00241855e34d6mr13084119wrr.189.1669112510761; Tue, 22 Nov 2022 02:21:50 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:e011:9e81:66f1:3415]) by smtp.gmail.com with ESMTPSA id o3-20020a5d4083000000b002366e8eee11sm13432873wrp.101.2022.11.22.02.21.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 02:21:50 -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 v2 10/15] tty: serial: qcom-geni-serial: use of_device_id data Date: Tue, 22 Nov 2022 11:21:20 +0100 Message-Id: <20221122102125.142075-11-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221122102125.142075-1-brgl@bgdev.pl> References: <20221122102125.142075-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?1750191505271231178?= X-GMAIL-MSGID: =?utf-8?q?1750191505271231178?= 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 Tue Nov 22 10:21:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24253 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2118816wrr; Tue, 22 Nov 2022 02:24:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf5agE3Vizr14MEHZsE2qyN0gbP0Z4Lw6S7pZziQ6qGiE/JzJRokAnobnWlXEc75feKb5M1t X-Received: by 2002:a17:906:c042:b0:781:541:8f1d with SMTP id bm2-20020a170906c04200b0078105418f1dmr19706340ejb.117.1669112673641; Tue, 22 Nov 2022 02:24:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669112673; cv=none; d=google.com; s=arc-20160816; b=zNP8pCmt7BXDVQTLkRsTUIoe6xAPDU3LhHs+awucIYqOBfJZDh3e/sk981h4UatgWW ThufE5WTnjOL1KZyiMscN6z4emWX2RSMz6zY34N3WtnlC4VszGBnbEtmIFcx6Q0wOFhS s2WAUsr+hdbuHl+MCVeQ2B57pHHGz43yYVVs9SD8pvClENdS7KkfdcSyuKDfeb3EyjN0 uR48Uh6JBtIdjU7y+B+qRcPUwo5FB/Il9cD4WvH+O12E3wuolGpk9wIbU/GPsluAxtHG g1TEanuJnmXfc/DthuyR1zhDflX+DCNMpWtecQK2mK/Ig1Az6Pq552UAMREsY0D6tK8H 4RWg== 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=qRUozAssQj2/6sAk1vnlivSISJLViw9EVGGhpX1tUYvbvlTyFImtdjNJyOfZL3BwAi wii7KWCF41pnsY8JDBGzDKYwVklKzR2Q6/TP7bLAyEfxAxZ3+hv6/IsGpZPLeiTmfmiE +fVc7iXJhaeOWbCawZYS8q0Oir3Q0DMhKfeeZWUEc4Ri0420G1KryMFOqzx8b+y9pUC+ viiMNqjJ6+ByHySnSTH4YNYNu9iZgatajeD+iovKDBj/DfpSvsWbK2huIMMogh3+QrDI zQZjfH/VY07zLCS+i64GMx9Ps9/1IcQGRwmj+Z+zKb3V8VHsdXPJNHoT4Y9g4DnG8Giy sxLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=cNOOrBVD; 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 o11-20020aa7c50b000000b004630539ab29si1175015edq.101.2022.11.22.02.24.09; Tue, 22 Nov 2022 02:24:33 -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=cNOOrBVD; 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 S233626AbiKVKXg (ORCPT + 99 others); Tue, 22 Nov 2022 05:23:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232154AbiKVKWJ (ORCPT ); Tue, 22 Nov 2022 05:22:09 -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 3B68943867 for ; Tue, 22 Nov 2022 02:21:52 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id ja4-20020a05600c556400b003cf6e77f89cso925936wmb.0 for ; Tue, 22 Nov 2022 02:21:52 -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=cNOOrBVDDBxp8Mc+etJ2bnstzSg1Lzp5SAUFfR5Ck/B28wVrN1R9+kJTGe4UPeXN20 Zu1NxMwctssO70t4AhcPojH9Lpd/OtIVYxCP/o9t4g/osQ4RmxjOUk8kIaLIBQF2LTGI DzyLxy/b76Ry0jdaUUPWKo3Nfe1MipiYEfkSOr7cffF2StDF4vuszG4StaL+rdKN7ywA ltZaddUhWCDNpCdOEbMKnGmEWn6OQRtY2/yxSTsppKMnfHg3nLC+8DDm6ndI2qqMhwwL xEmt7dQflPtTlvn2Rhwr3DlFu+HeFd9HeWUU16GLiORzmPYaUnclQePBH3oRJ6LrsvBj OVPA== 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=jaW4ph6Ng3V1kRpkUbnIdnInVxvlwea/hAU0B1nfAbisHxMPvfAvXZbeZmJZYhAOid 6ECmmFBFqcs8f8mA400CCBGejtcPNBA1Pidr0ZA16qsSnCMILeH0u4RStFxf8jNQ1rMl igORs5gavNUnlUhX1UIrly0Zs0nC/TLdy7e8FVLKbQCXfjBe2oU6AjshUtTENbmWr28C eaBnHziUvL9x3l3JzfBw8FWlzYBpFMtYpV9k4IJ2E6BJzYQO4FXP87LazqI6gcp+A8H6 oKLAStg+vTV9/99A49KlLZSha7Z+PGtQ/qI7pVSRAMGG5P6PSIMbRKOpMluzPboTRrDS Ng3w== X-Gm-Message-State: ANoB5plON4Tr8f4/SwpTGGUTujTAaQ34qtZdoWNJHlgR1ayBYNLDiXYM vernXCuxelKh6JZN6Ocq13WnRLmEdvdScA== X-Received: by 2002:a05:600c:384f:b0:3cf:9377:c76f with SMTP id s15-20020a05600c384f00b003cf9377c76fmr3817135wmr.189.1669112511702; Tue, 22 Nov 2022 02:21:51 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:e011:9e81:66f1:3415]) by smtp.gmail.com with ESMTPSA id o3-20020a5d4083000000b002366e8eee11sm13432873wrp.101.2022.11.22.02.21.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 02:21:51 -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 v2 11/15] tty: serial: qcom-geni-serial: stop operations in progress at shutdown Date: Tue, 22 Nov 2022 11:21:21 +0100 Message-Id: <20221122102125.142075-12-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221122102125.142075-1-brgl@bgdev.pl> References: <20221122102125.142075-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?1750191491013180110?= X-GMAIL-MSGID: =?utf-8?q?1750191491013180110?= 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 Tue Nov 22 10:21:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24255 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2118945wrr; Tue, 22 Nov 2022 02:24:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf5L/KGWo0YsM6OcQxHXwRN1DtW7SzN8LqHYqMq8X5NE5GLL17Bxhl1yhxkIf7EhQeFDQrhY X-Received: by 2002:a17:906:d20a:b0:7a9:8d8e:c3df with SMTP id w10-20020a170906d20a00b007a98d8ec3dfmr3508236ejz.519.1669112699818; Tue, 22 Nov 2022 02:24:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669112699; cv=none; d=google.com; s=arc-20160816; b=FZeMEq9ry0A9djMlcQwVz3M9WFkm1hCLcVEYjyIR8pjv4QxgeIzS8v7fc3V0l1YuXf CiLTeDsvq/3MvDnW3idirlSHOWe4sVcz+YGfUti+H4oHE2HM1y/jHA0NBkXb3SLPMILi 4KVK81PQe6UnPICeWF7zQgQOMlEoJlR2TwIUyeBczTCzYgQYuDTh9kHy/dz5Swka4m3N kinp15Uf22g8C5siyARHoX9D8Rwflf+ci6/NeequOqwGqu9gy6Mva2Q0MZ80pAJ2TeGN 6ae40CSV0qJA+nrz0KpKH/sHZmtHUMMS5WnH9Z57qOCyVN5v/98r3QLfNYaOVx5km+pT 7XrQ== 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=j23hZnphv0jcgZfiOY9qWXNDpMCFFj9PRM3bEUKGmc4=; b=aetokoQ/XUnogyHKQgmCfHpbq4ZyZbR1ES6d9mCOrn97+Eb810EHlwhcpWOAAignCy kZlfo2BvQklnZpKjIy1gHBHVRdZKGedpZ1D6crjyR8Si1hZ5byUadpDdVG1+QPoB0miF llLmNmBlXFr6Ur39wFtTJ2R+lQPlaAjVKTlK1DhPBZomgoF5mf05x1DLo38jOIQqtX0n zExMWQi/sFNwk26+HxKQARNuy+YWfqzoaDLhSzz+XYTaGje1WOeBPUaIZMXTiuhWvyzL cNYSIs+rLi+dvCyvzQA+cEZGsdbe6yRVrTesexPZOwHfDvzol9eX8R/0pFVPH4lVcahd IPOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=fDNYsQ3j; 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 du16-20020a17090772d000b0078200e81b92si13277124ejc.758.2022.11.22.02.24.35; Tue, 22 Nov 2022 02:24:59 -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=fDNYsQ3j; 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 S233640AbiKVKXx (ORCPT + 99 others); Tue, 22 Nov 2022 05:23:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232934AbiKVKWL (ORCPT ); Tue, 22 Nov 2022 05:22:11 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 395F111818 for ; Tue, 22 Nov 2022 02:21:54 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id o30so10380017wms.2 for ; Tue, 22 Nov 2022 02:21:54 -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=j23hZnphv0jcgZfiOY9qWXNDpMCFFj9PRM3bEUKGmc4=; b=fDNYsQ3j2gLDbZskMdzxyTjl8yIPfTyD01yYPRdSjW+X6zPNqK3ztySziZezPu419E suCJQuvywgERUuFjcEnHi4Z1QQWUyfFO4bjGUFByDMTU2ML1XaBgAmunf8cy0bjbUiW6 daoPwkNXiRew7YerkscSIQfCA1vTfCA/zQEJYA+Gy88c/te+ILvMNZbT6x+k+h8ZXa58 AhXsEKNQkEnyM1McFXynLRGACGVnivDCet0jtDLXhYTpNVJlBqHoZ63GGUSki5MbqFCA mruZWz6KtrRz2f/+SjzX2D9ZkEppU8HB1XaTcih4ryJpVJ1rEiWyU2v/OrqDDX3QhTzV PjKg== 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=j23hZnphv0jcgZfiOY9qWXNDpMCFFj9PRM3bEUKGmc4=; b=YcWTIjHau2Mjo9oB97NqOOTh/2B0GRXDlUThKzLKv/4yuZK7wW+9i6IQ9Lbpt3X1R1 osCEEx8biL/APMawGHHzg4LJgmZeNGtf9QUamPiFo0V43zOfpW1GuUrMvWo8cWHq4l/M /Tum0zNajEGc+2xAtrx8ryq+7u8H8LHgzaw4HxBcbdr2JQqofRbZQX83EGuv9Ux1IS6a gfSEvkiFsz6aw4EBX1rCLvlEE+W3wgNbwFEnh5gpVYDDpMVDgxP8IeeNda9z1JYaLMju Q3fq4WWzWZajmDN1FEdsGuK+F7n4M5DEfBAK2q5ukuYuocehpY+DPCVsPgdeRSMGh7WI ryOQ== X-Gm-Message-State: ANoB5plNkW20CLauyUooJewrC1uBSUyDapxh02YpgVxGFNfFNa46+Bn/ 89bLpePT817KK8VZ3UOZtIB7eQ== X-Received: by 2002:a7b:cb98:0:b0:3cf:9a12:e645 with SMTP id m24-20020a7bcb98000000b003cf9a12e645mr8714322wmi.59.1669112512755; Tue, 22 Nov 2022 02:21:52 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:e011:9e81:66f1:3415]) by smtp.gmail.com with ESMTPSA id o3-20020a5d4083000000b002366e8eee11sm13432873wrp.101.2022.11.22.02.21.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 02:21:52 -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 v2 12/15] tty: serial: provide devm_uart_add_one_port() Date: Tue, 22 Nov 2022 11:21:22 +0100 Message-Id: <20221122102125.142075-13-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221122102125.142075-1-brgl@bgdev.pl> References: <20221122102125.142075-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?1750191518353622790?= X-GMAIL-MSGID: =?utf-8?q?1750191518353622790?= From: Bartosz Golaszewski Provide a devres variant of uart_add_one_port() that removes the managed port at device detach. Signed-off-by: Bartosz Golaszewski --- .../driver-api/driver-model/devres.rst | 3 ++ drivers/tty/serial/serial_core.c | 36 +++++++++++++++++++ include/linux/serial_core.h | 6 ++++ 3 files changed, 45 insertions(+) diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst index 56082265e8e5..5d07a8c1eadb 100644 --- a/Documentation/driver-api/driver-model/devres.rst +++ b/Documentation/driver-api/driver-model/devres.rst @@ -436,6 +436,9 @@ RTC SERDEV devm_serdev_device_open() +SERIAL + devm_uart_add_one_port() + SLAVE DMA ENGINE devm_acpi_dma_controller_register() diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 179ee199df34..005190b279b3 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -3217,6 +3217,42 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport) } EXPORT_SYMBOL(uart_remove_one_port); +struct uart_port_devres { + struct uart_driver *drv; + struct uart_port *port; +}; + +static void devm_uart_remove_one_port(struct device *dev, void *data) +{ + struct uart_port_devres *res = data; + + uart_remove_one_port(res->drv, res->port); +} + +int devm_uart_add_one_port(struct device *dev, + struct uart_driver *drv, struct uart_port *port) +{ + struct uart_port_devres *res; + int ret; + + res = devres_alloc(devm_uart_remove_one_port, sizeof(*res), GFP_KERNEL); + if (!res) + return -1; + + ret = uart_add_one_port(drv, port); + if (ret) { + devres_free(res); + return -1; + } + + res->drv = drv; + res->port = port; + devres_add(dev, res); + + return 0; +} +EXPORT_SYMBOL(devm_uart_add_one_port); + /** * uart_match_port - are the two ports equivalent? * @port1: first port diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index d657f2a42a7b..d0911f04706e 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -771,6 +771,12 @@ int uart_remove_one_port(struct uart_driver *reg, struct uart_port *port); bool uart_match_port(const struct uart_port *port1, const struct uart_port *port2); +/* + * UART devres + */ +int devm_uart_add_one_port(struct device *dev, + struct uart_driver *drv, struct uart_port *port); + /* * Power Management */ From patchwork Tue Nov 22 10:21:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24256 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2119425wrr; Tue, 22 Nov 2022 02:26:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf41SxMm56bffoXhoEhhVd/IUho8qaYmHYqxEre6Y1VGzZHBT9lIimAqyypDMGJNd916RlLI X-Received: by 2002:a17:906:8a6d:b0:7ad:d18f:c2d6 with SMTP id hy13-20020a1709068a6d00b007add18fc2d6mr19593459ejc.271.1669112788217; Tue, 22 Nov 2022 02:26:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669112788; cv=none; d=google.com; s=arc-20160816; b=wC/PMLtSQiaJjgWoLLr/KA0+a9YA0ICX96xAfwfxtxbAIRAkklZNX4/q4GiDK3uZXS 3GZ6f/BkXWmoNfN4Zv49IcDtUCd2xeOWVX1aYHQwlBZEVSeyq10RyT01ffdv98YXUHEv r3X/TzkCSrAjQKRWlY1cFEH2q73x7cpN3jM5aCx4gHb7V0qhiA228ilOrHGryzfMvO6C GQjuixkmIO2XHzyr+SfGy6yIDE0I7OtlXNou0IXpMzZO8RQ0DgIXicg8jjCvHYGFrJUk bT8u6r0zVuDY7+BntTLV8opcFkhWN4unleleOHb1PG0j28MOD4ZJ9XEANHjd6eZKVcBK pQeQ== 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=M3G5fO4wTgQLmAcQSoo34y5bVfGZW9g4LW34a2D3VvA=; b=Cemx8dGQEXkTmhLKH2f6EOWA+B2pKU/7cHEZ+5As21UInEjJrn8cZ1S3a1kd99gZHf p7xsAXo7KYv7gN57CQ34rxmA+IR95pHH1n2jx9fvXPnOFszxOytHiCuqn0gs2p7wzZ65 jp0rMRLD9gJQxBznfASkS/8EsnnFAZSN+amvCpVMPtCBv/PoKKweGCMqyIAvcz90rTiS wUIZVKwnIPB+/7Lkocc3u/1nd0/rQEs0OlG8QphcBF/zPUaIJhTX45sYJlCF4sCsqmZ+ Fb5Z1yOOUNZFHf9XfzMIGcDur+BwyYq3esZHQ4h6DT31+mPgfud8jjy8mMYXx+frLHFc jm5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=KJyK8MfS; 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 k12-20020a170906054c00b007ae10525563si9962165eja.991.2022.11.22.02.26.03; Tue, 22 Nov 2022 02:26:28 -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=KJyK8MfS; 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 S233174AbiKVKYI (ORCPT + 99 others); Tue, 22 Nov 2022 05:24:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233080AbiKVKWM (ORCPT ); Tue, 22 Nov 2022 05:22:12 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24757E03B for ; Tue, 22 Nov 2022 02:21:55 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id p16so10366745wmc.3 for ; Tue, 22 Nov 2022 02:21:55 -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=M3G5fO4wTgQLmAcQSoo34y5bVfGZW9g4LW34a2D3VvA=; b=KJyK8MfSWfrc4rC2Zkedu9dXmu7sCfaGzpAr/Fb2RwQf+OEOysG8VS/C1CdLRuu8oU FkjQ5bQiMByI94zbTMKQB6WG3DPe93S7NyYzXMES+UPGNu+8CS4bnqSQhoZqJO8Cu2UF l6z0ay3iLonF8ILw4uB6Qbs3owHDZ6547HxsQUrHmYxicToSx5IJ/IzHlZIxHog2JtCD A/dkTVnlWljJHmXfF2oPAGqnKoijFOV/Kd2dfhM2JeA4YphuJ57UGQaL7sWREcKmc/yr /byQ+DSr1pfCMqfdWOMPUonOp6AJIn2MZB6WAFPLrq2vUOUaQuDhlEQgcVy2Q3081PL1 A6dA== 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=M3G5fO4wTgQLmAcQSoo34y5bVfGZW9g4LW34a2D3VvA=; b=FVtuf2Gl+y2oKXexLEFAox2xZfmd+MUtD5i/F1QrnipTgzDHqnWgnF6pfyWe7KarmP YJmr2JNC/o5xZEyYuz2lI90ORsFM9dXeFYN10hyDi3llvWMCd8mBeLyup6kpdVtptgxf 7ysk2t819l+CBQw+aZP6TfX36L97kfvO2UVUZ+xtnedxlZNntQpUnY4j3DOjkoItHr7q NzGkfgXarzbqA+2iF6QT71YIZ8r/FGqk3hdg+STJzWqmwK7gPHmeY+Av2DxzOgRXyWSr NpOiSP89HekxlxAB/R8uZ66ALNL4RqmKUVMs2txNS1SN36aSqxUNhr3hOI4THLYUfWHC yQow== X-Gm-Message-State: ANoB5pmKtQw/Wi270hlWpkOxTlGa6P/2rnWdgfnaGS1SC3dDqIIyX3RV e4nH6LTkYMIKzIPB3JQG8T0cGg== X-Received: by 2002:a1c:f616:0:b0:3cf:b1c2:c911 with SMTP id w22-20020a1cf616000000b003cfb1c2c911mr8610482wmc.16.1669112513688; Tue, 22 Nov 2022 02:21:53 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:e011:9e81:66f1:3415]) by smtp.gmail.com with ESMTPSA id o3-20020a5d4083000000b002366e8eee11sm13432873wrp.101.2022.11.22.02.21.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 02:21:53 -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 v2 13/15] tty: serial: qcom-geni-serial: use devres for uart port management Date: Tue, 22 Nov 2022 11:21:23 +0100 Message-Id: <20221122102125.142075-14-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221122102125.142075-1-brgl@bgdev.pl> References: <20221122102125.142075-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?1750191611078507105?= X-GMAIL-MSGID: =?utf-8?q?1750191611078507105?= From: Bartosz Golaszewski Shrink and simplify the probe() and remove() code by using the managed variant of uart_add_one_port. Signed-off-by: Bartosz Golaszewski --- drivers/tty/serial/qcom_geni_serial.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 82242a40a95a..53d09da0854a 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -1454,7 +1454,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) uport->private_data = &port->private_data; platform_set_drvdata(pdev, port); - ret = uart_add_one_port(drv, uport); + ret = devm_uart_add_one_port(&pdev->dev, drv, uport); if (ret) return ret; @@ -1463,7 +1463,6 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) IRQF_TRIGGER_HIGH, port->name, uport); if (ret) { dev_err(uport->dev, "Failed to get IRQ ret %d\n", ret); - uart_remove_one_port(drv, uport); return ret; } @@ -1480,7 +1479,6 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) port->wakeup_irq); if (ret) { device_init_wakeup(&pdev->dev, false); - uart_remove_one_port(drv, uport); return ret; } } @@ -1490,12 +1488,8 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) static int qcom_geni_serial_remove(struct platform_device *pdev) { - struct qcom_geni_serial_port *port = platform_get_drvdata(pdev); - struct uart_driver *drv = port->private_data.drv; - dev_pm_clear_wake_irq(&pdev->dev); device_init_wakeup(&pdev->dev, false); - uart_remove_one_port(drv, &port->uport); return 0; } From patchwork Tue Nov 22 10:21:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24257 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2119529wrr; Tue, 22 Nov 2022 02:26:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf68lfM592ljRAGpugkzLL0QmMDMGn+ZEzTAqG9xtnfXyClOZFKxJlAzqf1iiFBo8vHAaBRi X-Received: by 2002:a17:906:c56:b0:78d:b8ab:9a5a with SMTP id t22-20020a1709060c5600b0078db8ab9a5amr19303774ejf.454.1669112808819; Tue, 22 Nov 2022 02:26:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669112808; cv=none; d=google.com; s=arc-20160816; b=T5LGWJQy0Jm1H2ANejguB784HP6+XIvrJftW/dnJPoRALneWyTIiL6JTR6ZfYxaxPT z+sDm6xQHpC1sEObJZ7CSJu5l0Va0wxNoOuHJC7sx6w5+E535SS/oJna19iBv6suci1D KU9ru8xjye7Xoby8Yg4VOfPi4T5ALdg8fL1X1REPr4/p0LCE6Z70Ozp9ZJVRgEHPYVPS mYYUuV56qvtfui8aGVsFdtayi3VKYYUhHCadDNf+RSkuDmVv4eF1vmGLwbSwb1aAtUyk 3dKi5z3X4KF+CsX0gkTZ9fWViAzu5bPiHvhBdSNJHvL5WLHvan2CSQCbRZuwIzyBLqpy zMrg== 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=vc3gujY/7p59/KVmOU20LtYi9Hjn3PuSiOjKX/2tRLeI0zlDHI3jO/oOBe7hMCoPpP aiGJkq2FN+/iWGDkyfgy2Wltg8Gfhm4ZJ7M3nsg6cfm5BgC6u/R4saWcw2eXYEgktThD 9lY/OeG5CSn32EWzFmkUBYCvLaGKvbtB9WGTOcHodfj/SjbM8ruv8Q9fCu/iVKxNQ+oD pl8Xz5cEXN4GWE+5lh/IBA/i6yDSTqTPp9qx7CsEmNxpgvb8ogh13LwNxXFfO1ebQoz1 C32NMeAbCULuD5SO2QQE3+qBXGKWEUfjw4QfilPfAP7vu+HRFaMQhSlW4vIsLFIAIo3U zDJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=pm9vorLO; 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 p35-20020a056402502300b00461aa80dfa8si11176493eda.429.2022.11.22.02.26.25; Tue, 22 Nov 2022 02:26:48 -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=pm9vorLO; 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 S233655AbiKVKYM (ORCPT + 99 others); Tue, 22 Nov 2022 05:24:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232704AbiKVKWM (ORCPT ); Tue, 22 Nov 2022 05:22:12 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14CCA53EE1 for ; Tue, 22 Nov 2022 02:21:56 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id v124-20020a1cac82000000b003cf7a4ea2caso14847335wme.5 for ; Tue, 22 Nov 2022 02:21:55 -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=pm9vorLOyiaAwAF9/TjFi6cTTneYhVQ8PReaGylh7jses9Q/PQ5Qikf4ZNkOz9hlA5 a975HkDG5AptKCKGw9b8S3098WCFv2s8Fpq4jCQYoLjeUYWnHlPaqUWV2FBkTMKu2Wkz 6P4TN0lJRCmeV5evy/dYN6Xh1aV4AEQwWCTNeUHFrfpFdI3RTPA1a8aEDToX7j1oGoAM Z/i68/Fw8qdfDRAeBXQSTgh7THtF4pP/NFvVWGicV0NmFanAmsyvfDT8a5Nojowbx9LG AB65Agk/Osr8EM7o5Lc2fgBjTVCwiHOhw81p/sNSRowWrXmJ/V1Dx6TM0z0boDe7+sZs VOfg== 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=NpONLLEWvAbT4b3l7nnjM88DbrLKUQrKZGgBetKYhPpVZn+SWL5jeFvfHHR6he24UE 0eG+fvy7BDwnfISm10h1rOM82/mXpfiB2U0GoQOr11AkKDMkls4xR9C4uDH3X7RgB8mW 8JZGanktgUbN7mxk6tj2GQEUyix7hhse6A/U1/zF9WvWcR7cqjWF1aaQlaOvkaFo4PkB bQP/aMJiarFcIUA0BzV51J06oThn4fWtSqFT/0cWgzq5cwpE4Uin0db4sFGkaJjCdb/U ziCqZbXa5gWk5zb7Gxy8o9EWFzCHejlhiduHsV+zQxQawdPuvcInEnK7xdXKiJ1qS7Vl pvwQ== X-Gm-Message-State: ANoB5pmQeSbZtUTc1ouEMVFMwtR/gqkADclwdnMfywkvCF9lFT5F5AM6 yMc2xUz9/RlA5mGbHLYFI3xWvg== X-Received: by 2002:a05:600c:42d2:b0:3cf:c907:a05a with SMTP id j18-20020a05600c42d200b003cfc907a05amr18855098wme.177.1669112514599; Tue, 22 Nov 2022 02:21:54 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:e011:9e81:66f1:3415]) by smtp.gmail.com with ESMTPSA id o3-20020a5d4083000000b002366e8eee11sm13432873wrp.101.2022.11.22.02.21.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 02:21:54 -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 v2 14/15] soc: qcom-geni-se: add more symbol definitions Date: Tue, 22 Nov 2022 11:21:24 +0100 Message-Id: <20221122102125.142075-15-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221122102125.142075-1-brgl@bgdev.pl> References: <20221122102125.142075-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?1750191632414751049?= X-GMAIL-MSGID: =?utf-8?q?1750191632414751049?= 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 Tue Nov 22 10:21:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24258 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2119656wrr; Tue, 22 Nov 2022 02:27:07 -0800 (PST) X-Google-Smtp-Source: AA0mqf5d3BDfqq4ESMi8RWmxGOveEQpPb5TefBilKD5Q6yQUqNUhGAS9wbz6V2sR1lfg8TFNb79q X-Received: by 2002:a17:906:4f08:b0:7ae:e2fb:c028 with SMTP id t8-20020a1709064f0800b007aee2fbc028mr18089217eju.539.1669112827774; Tue, 22 Nov 2022 02:27:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669112827; cv=none; d=google.com; s=arc-20160816; b=ckDSJ52LJoSRPaj46NdvpTrQus/zpH2ankfHQtvD7UZPf0bpnXaMY+vOaFJJilEyCF XY/8UGINq/Fk0w4wTAlYkQA37pfaopaE0/k7Hix2bprM0yYvCLkOMbuRUr6cTjKJCeOh lhXDHTR8psc9fUno70H6aMFoxqrJGXXvJdemZtgW1hvIe9EsaKwJL09w+YZNhkCdryih Zrg4DplCIAY3E6D4beKt6z97VHh/eVoyx1cs+bO5weunuToLy+Hr4g//tWPj/aG1Uhgo DrrW76P2TQcTIo5SfjNOYzBl1CS7wf7vmBifd3h3j5jCe2yMo3puYxXEHL+re1IdUe8r eacA== 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=1cKmwRbcC37IAbnz7M7SlkDz5+VEQeviHk5lKnbsJEc=; b=DHYzAxssJYLWQ4wF5B8OCzq/BWirCkikJg09P+TFh54kekBhmz+cd8XwmaOwcbvbbM U0kJwVBaoUiELm4+dWsThfqrQ9X4ieoCgZiQo4GneJtIJ7Wb9cmv6ql+9UwPEpYi78GG hgVPm8jrZ+uwNZ+K5rTCJqILRcMHWvbzbLe9TTRwIDlPOZ890u09wdS7isiNwpMuyg1m O/3jd5wJRK8fjDK5lDIRw5ijbIAukRF3zzRC5cy/wI0zi1RIHydrufAtsEpJojzxuuYN kEtdc8uJpofFfbc4fIv46Zo/dniVAmiTM6Jw7llJFp3PtxQkrRCfqjPetfrEHi07qD+6 nSYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=TbzCniFW; 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 hp27-20020a1709073e1b00b00783ddc8b643si11698388ejc.317.2022.11.22.02.26.43; Tue, 22 Nov 2022 02:27:07 -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=TbzCniFW; 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 S233659AbiKVKYQ (ORCPT + 99 others); Tue, 22 Nov 2022 05:24:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233185AbiKVKWN (ORCPT ); Tue, 22 Nov 2022 05:22:13 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BEFE554CA for ; Tue, 22 Nov 2022 02:21:57 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id v7so10386762wmn.0 for ; Tue, 22 Nov 2022 02:21:57 -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=1cKmwRbcC37IAbnz7M7SlkDz5+VEQeviHk5lKnbsJEc=; b=TbzCniFWB0LcTKR7BzxUOKZ35vi+gbx2yN7v5Mip4oDw/SMa45EDIFW9B8VgWdD1jh m+HzQ24FXOwL//rogeA/Kbx3Duj9S6O8KZA/hlMOjo+0ubzGiI6A3i6lvJbiogeeVP5W 1YmzmCh4sO/fmzyOpAfFwSGqyrqsOuBlBhC3xkew1IrK0DaxAG0ZS7uFlU+TQlQSbhAZ kglF7XZ5ZTev4mX43N+8wPYLqcMF3oZG4SOoiu/zoXU+eArYB/cu4BwTw9qQLr1Sm5km OORWbYxICU6IFFqnf77vaW2PzTqjqx7g/Y1MZ2f7sd4pMbRuCvfsGxk4aqzUggg5b3tz JHLw== 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=1cKmwRbcC37IAbnz7M7SlkDz5+VEQeviHk5lKnbsJEc=; b=OyJlxcE56j68xUykgOruW6uhWJtIXVPYIyA8r8gcZMGwnReX/DhJMtjiEeORWBOVpm hvq/KKGpnYL60jbyr1sFdQEjuKb+fe9etfyN/d5n1Qm+UHjIShbAbE66XcAjgRliINt9 eUtgEnzy/Zvcqopwg3W0QXLavoFgNq2h2kti6rQ9fvj0ZvoTHrIBaGIIBw85pC5A8JlL Ea/PME8KYUIfRoFFFyvRnVnielEUx9ToEEXyNUyF9a+I8Q6VGK20hRERNL2kqqCIDZFe PjREGK7tXpNuYH+wmG3OFYsQ5QCblUJEM/yvKdiXHy7peBufon3eZHvhK7rROUfc0Sav Y0tg== X-Gm-Message-State: ANoB5pn9m/bDfCoWi94AJFJ7EDeBwn5VgLLMow94Q7fe2cYl5OAPw0L4 wy77mvUzSurXqnu9kn6HrEbgog== X-Received: by 2002:a05:600c:4194:b0:3cf:5080:412c with SMTP id p20-20020a05600c419400b003cf5080412cmr18522772wmh.99.1669112515666; Tue, 22 Nov 2022 02:21:55 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:e011:9e81:66f1:3415]) by smtp.gmail.com with ESMTPSA id o3-20020a5d4083000000b002366e8eee11sm13432873wrp.101.2022.11.22.02.21.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 02:21:55 -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 v2 15/15] tty: serial: qcom-geni-serial: add support for serial engine DMA Date: Tue, 22 Nov 2022 11:21:25 +0100 Message-Id: <20221122102125.142075-16-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221122102125.142075-1-brgl@bgdev.pl> References: <20221122102125.142075-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?1750191652263189107?= X-GMAIL-MSGID: =?utf-8?q?1750191652263189107?= 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 53d09da0854a..4aab92be162b 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; } @@ -1528,12 +1733,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 = {