From patchwork Fri Nov 18 12:25: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: 22303 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp165770wrr; Fri, 18 Nov 2022 04:28:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf4ZV12WD1t6VZATDji0U+PIC6oGIdGU8Sbv5QPVo8+v22/xI+WBz+trRhCq24habur0Skpj X-Received: by 2002:a17:90a:ff84:b0:213:1e05:f992 with SMTP id hf4-20020a17090aff8400b002131e05f992mr13700024pjb.191.1668774490668; Fri, 18 Nov 2022 04:28:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668774490; cv=none; d=google.com; s=arc-20160816; b=qH0BN1EOZz0M6p49gRg1lctefxg2fFG6GbjS4NJERx+WvSQInKR2h2n4LDfVcDFaZ4 rEEK5DX8by3ZUWma9fJ3KLTTDOhwsYf+vA9N5eFWW+QqYTqVVVN8t+kHwI4Zk4npJZIb qJyoUM/SC4povTMP+zEv6Mpgf3802qD+y39pS4L18WhiSBweClFdxd1kbKRxKk7+IjnJ S1rAwJALVHRN/7bXjLoA/1cO9Bya++eYp6Mvr5fYg0aMIGTD1kdQvDe0CIDsGr7dJKVD 09MqxWSWjcs83rqO48ToYd9gs0wM8N+rKI7+3Y4lOpRSuvZHCjiOoQS1tPsoEvsSXdJT HF8g== 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=NW75qAvpRVogQL0T7QAGtVl+SEYpXGObCi3yPFwvGso=; b=MiPyLt4MCcavPfWsh84qjDrYm6EPiYAwPFpj7VvYiFrzrtOTXygy4Tysm41fC2Y1zT 3Q4OpstVZYxtnwsh1XK+mhx7tbeDz+ZApT7ccIo4W9JLUC77oii6WvWX/Ohy5iWLO4gJ bM40j66KA2VKUenLEcM1hTh2MTj6K9adV22pN1uHnGxDmHtfoevmXE4sDhNm+r2GzY4Y LTqW6zGwoC+Ly/Nmsuvz82+ybkPDzIUiLBArRdoi9h/PUcpz8Re4virCM1/RD7vYHCVm AXiATuFTcvhAhI1h1QQfvHm/zj/bN/UA1cyGOF0bH0e3Huj0gSlU8KXWB1gw8sZqrCfg Y5wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=EqyvRD3f; 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 rj12-20020a17090b3e8c00b0020a66fc1398si7638126pjb.91.2022.11.18.04.27.57; Fri, 18 Nov 2022 04:28:10 -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=EqyvRD3f; 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 S241173AbiKRM0L (ORCPT + 99 others); Fri, 18 Nov 2022 07:26:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241460AbiKRM0F (ORCPT ); Fri, 18 Nov 2022 07:26:05 -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 B266B9737E for ; Fri, 18 Nov 2022 04:26:04 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id k8so9088517wrh.1 for ; Fri, 18 Nov 2022 04:26:04 -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=NW75qAvpRVogQL0T7QAGtVl+SEYpXGObCi3yPFwvGso=; b=EqyvRD3fnkEs58HS1MMX5qKFpQrHn13x7ClAlbDNa0KboEO7GCK0S4b7nS7OAhLKeT d5pA1JlHIqA5uDZ5453AtnwgFjEy25mt04/RlMfEixLcMyq/8tefIWEaQs7Qfo7Gmcp1 s3X0MHBEdJ+EGYDP/9P7hQLRWqTV4nezFH/AzwzA9BAQW34JZuz7YZYA/kCnrs+TiFvx FqefR5rly249zxebdONWx4i+S+5fCU8uG8XdhkveuD9oNtoQBkACJAFaYs3OJ35DeL55 MWgPs/47rcLpZEWszfJTbRMLi93GOPdUQgcHBaoThC0j5l4a1iWx8q+Y4GFnLg6PsgM9 50Nw== 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=NW75qAvpRVogQL0T7QAGtVl+SEYpXGObCi3yPFwvGso=; b=ZdV4RcOyePNb0xSUDbTrorubhhwx6m/bB/G5pLzfvdsa24RTyBdmPJYBCrAO2jvnA4 aSpCRCo2fO93ZkKTdfLWa2e/Ojby4wz+y4LgVJ1qoErhbmRrYv8Q5Sn1NOqX/Oa2OqUK 3Y+XJ7aJzGDmRhwv+vqNSybRGlkRgVUsFE05HGTyB+gTx3V+/MShTY1FQ6JfpFaFikKM E3FvtAt5wwP7abRRO+6VYjGObIfo3TLTay87GUZCYQMKpZNW98immgnjWknAJ5AvNMwg zKbGn4QC31gZkCjOyMA/44n5cjhKztPUIvmPtQ/whg7JkhTF10kS2qYWM/SFUJAweWLg vbIg== X-Gm-Message-State: ANoB5pkDBAS6Rrdl4n9qobpYuF1dm1bkyX1McIIzsPJMpbpE0BL7/jef s4ndPF82ts/SFgNavXZ0YIgBug== X-Received: by 2002:a05:6000:78d:b0:22e:3d63:80bc with SMTP id bu13-20020a056000078d00b0022e3d6380bcmr4390469wrb.30.1668774363188; Fri, 18 Nov 2022 04:26:03 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:02 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 01/15] tty: serial: qcom-geni-serial: drop unneeded forward definitions Date: Fri, 18 Nov 2022 13:25:25 +0100 Message-Id: <20221118122539.384993-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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?1749836880766105047?= X-GMAIL-MSGID: =?utf-8?q?1749836880766105047?= 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 Fri Nov 18 12:25:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 22297 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp165676wrr; Fri, 18 Nov 2022 04:27:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf6lDa9XL8lPlM45JmhUBgZFTJw0woi5kknLlAtmiudqT5LvN2fYal6xnVhQ+p4mg1q+Eird X-Received: by 2002:a05:6a00:1310:b0:561:a494:b299 with SMTP id j16-20020a056a00131000b00561a494b299mr7410484pfu.34.1668774479527; Fri, 18 Nov 2022 04:27:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668774479; cv=none; d=google.com; s=arc-20160816; b=X9YHq9w7QcbEDqalL6oA/oMS2pLUJFZU2TdU7+RaPkGT4VGqbxMUfO2DaDdvnA/FYy m52hj6FvDF66zyVeVA3zW84YXI5DF7da8FjFJ4223HMZgdh5ffZ4zyFPvA9iMeNirGzb MGike3ekGTADCDDLceiQiNwSLS5MRAN/2oswX7ZzMRqBhPBKubsJfNgRZrssuCVVVNF0 wVUfkUaE5p3kAXOZb0yHgIKAHQqasYdQo1MWPOZ6V+Z3YTESCsiIgX5LeNOKZLCuks/H zoPeiuoyLJhN8EX01X9zBBnzinSBdICWLtgHbq7YoOPOcEtdHgm6mchXMsOtUwlA0nSN GtEg== 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=XOBbY723QPvtzFt4pwa0mpU0HWVBeuJRMHbL1UtjHyM=; b=T1Ri1blMQlmYy4gSPfilavwQnR/5quPVY/UdA1mR/5ZuI6ez1ZokTW5zZ+Pew/eMrl ru+VuloqN5jGozKKE7kYdLSYS+p3vpRvdpktISi6CjRkWarjeW9wGkfVMC1CxVhYw5UC CbXWe1l8IwxnV1pee3YFcI9P+AfhcADItn+LfzFwxbCyAwP0C/a0UiF5c6BxZSWvZ9/r xExT9CUogx+WWdS9iijkdw3ZJfWaTYsRCRZydm6jCX9uKev9sxZn4+JX/maEFHPahWQX 1ifgcn/kAs56Bjz81F3bjEmHGR79GlNar8CT6/qa2jytwO4luPnTZmkeU8W2JZOtxQSY 8IHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=gQHNmX9H; 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 u17-20020a632351000000b00476759b878csi3857688pgm.328.2022.11.18.04.27.45; Fri, 18 Nov 2022 04:27: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=gQHNmX9H; 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 S241460AbiKRM0O (ORCPT + 99 others); Fri, 18 Nov 2022 07:26:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241567AbiKRM0G (ORCPT ); Fri, 18 Nov 2022 07:26:06 -0500 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB343976C6 for ; Fri, 18 Nov 2022 04:26:05 -0800 (PST) Received: by mail-wr1-x42a.google.com with SMTP id j15so8354257wrq.3 for ; Fri, 18 Nov 2022 04:26:05 -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=XOBbY723QPvtzFt4pwa0mpU0HWVBeuJRMHbL1UtjHyM=; b=gQHNmX9HawS79JfeWPLjvmVeWSkxrESjRcvkQVaP6nQPzkyEUQq67QRguT7YByBaU+ lxZNjUJpiSCTS7S4bLBL+EGQjhi4wHgGb3lGzwgEUp/Hzq1IkfdyXa+7uedgIHDJXnZi tDnkzhAm1GxRuVWQFq4Jyh1cvbyTKIi2hLF5vN5qxNLtzJgTw1vp7cKiBUDNy82S6Wsi 2uHaNc6aOL4Qzf2m+UPQjXjoF6LYd5Bh4vxMrNYMjARRHiGb3F2RXxtXmSVkwsEO2sQc SeNSRSck4Sn3FGXPNw5SSSYCSPKnD2AVBGHd8N6saFOkvwDTz4ig9kVUzBEhWMDIfF6t 5wHg== 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=XOBbY723QPvtzFt4pwa0mpU0HWVBeuJRMHbL1UtjHyM=; b=SY3oKYPACctvO77ynFvPq0XoKPEpzQi1JrKvES9wkOnzFqcQLrjVT2fiLytXvqpLWA iwpFwBYpKbqSCpRLggbw4h3y7FNRjI3R+4dYZPIoCDSnIcw8hUaTjp2cOJeyDCN7/+kw WSh5IetT7pk37954fBUA34NEP0dRc8y5UpGucYp1pDCg6Y5qupACYM6eW0qu5LskcN5t faGPPmp6KXHMMnc7z3AODkPAY2jJDDH08r6VsrGQ5Vezo2zXVQBx50OHaX4Z79JmlNe3 zFZg9OIoNUCRrC2gGYVYxUY0lut94Qbtpy+0z7nK8tMdSA3S8kppB23ftJP3N1NbFiBO htFw== X-Gm-Message-State: ANoB5pmJ75mGqaDRErHg+9Nygzeen1x6kO1vuvibJXwl7WMZxRWN1m6q mn3ivn87uj3ioV10kVoG9TgaPg== X-Received: by 2002:a5d:4b82:0:b0:236:84b5:2d30 with SMTP id b2-20020a5d4b82000000b0023684b52d30mr4316250wrt.591.1668774364247; Fri, 18 Nov 2022 04:26:04 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:03 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 02/15] tty: serial: qcom-geni-serial: remove unused symbols Date: Fri, 18 Nov 2022 13:25:26 +0100 Message-Id: <20221118122539.384993-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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?1749836868575277996?= X-GMAIL-MSGID: =?utf-8?q?1749836868575277996?= 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 Fri Nov 18 12:25:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 22299 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp165681wrr; Fri, 18 Nov 2022 04:28:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Io4hcFHFeFLr3KW+hfvRRdXNESOkcrdD1JV6MFWdO5AfDdsxSH8VIY37IFBTmkHQxHyBY X-Received: by 2002:a63:f514:0:b0:470:30c5:5af with SMTP id w20-20020a63f514000000b0047030c505afmr6640959pgh.259.1668774479965; Fri, 18 Nov 2022 04:27:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668774479; cv=none; d=google.com; s=arc-20160816; b=cvjN3Wl1WZM9FAfjOZkgA4dPh93XATrUNBKkZxr52McP6SibtJbbjFHvIILbErSfHN aL+KxWk3XtVV9NAm2VxyN50Ij9ELuB4Dpips+1gTGgcHWuBiVXGWgbCN7OmPllJXMyFR AYrwHwrUw/dv24Vvcb4hCmRLxbBFpDjwQMtdhF4OIX5hfX+pEFWbBpx/vvf/8jtSwPpZ rqPHL3/o11BcR6x7lvZpqqCVXnlLPT/bdkwdBEQXXLJh0XuRRWOgOeiUabW3zkhyGQYB SPMKh7/CQsAKJUx1RZNKN8boPeMgW3spUtecjM/M/RNOwxs3s0SNG3Uq67QKibAxW5Jn q0KQ== 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=Ix98Buqrm8hc4zZgibw2ROra30KJmpCLaRPoOVSax6U=; b=yQuJ2rtRg0plOz5h3OQTFLhuwiW2Bc71xrzQn+ERB38KZGUe7wnN0mR4s60sOkZYnC XD+cPatWTJVm9aHv5cOrOis2eH59ZZeR958COCyA6JraJy8EWEb1TcRD5kVKIJj17orN XvtIopf4jnyYTGwR297NQGqUOfo6X7nx9qHc5XYeZXgYn0DC+kXSbwn9suFtZN2xwwLz 69Tm4G5yiInWAALyEsTUC2kNsnIoppHzKFuSZvBGPO51Aoy4uV7BtJFfOncWM7m7YUhD KeeSl6Xpzoj4X3OAizjQMIjMlYZgYIJDh1HxgYKUyRSZe4drlD5tOPGzMLWLInG55897 ceKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=fr2y+fgp; 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 t64-20020a638143000000b0046eb96c4f90si3711337pgd.549.2022.11.18.04.27.45; Fri, 18 Nov 2022 04:27: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=fr2y+fgp; 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 S241578AbiKRM0R (ORCPT + 99 others); Fri, 18 Nov 2022 07:26:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241701AbiKRM0H (ORCPT ); Fri, 18 Nov 2022 07:26:07 -0500 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5C6797362 for ; Fri, 18 Nov 2022 04:26:06 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id g2so5342703wrv.6 for ; Fri, 18 Nov 2022 04:26:06 -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=Ix98Buqrm8hc4zZgibw2ROra30KJmpCLaRPoOVSax6U=; b=fr2y+fgpu7yMtDfL/F6WHS15il9rZPexAjvuSgluGk58Q50xnOVM6u6jOY/KO/1xsY z0h4BK4SSg7EJEYSkG0kxrjxd1rgA+X6ACOkAllPjRlzpLsrQq0hvwHKvHKHJuOR5xU2 cZzLi6EJWcv5J0IkgWUjzxMJMKjT9OYRPIs5OE0izDQEyfjW1RzYl6QriSImMbbaYz+a 5+TVTTdxVl8vu0gTd84Is720pu7ojdK4DjYoPZxYWz3YB9KwsD0iT8Jt7cPDjEnwXfE1 /8UwXwEItbZYJxEGYmqU+eTGqdPED/DcOQ5nZ/yf6Zi90pQJuD7R8aumxus6kn1JyLm4 MnKg== 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=Ix98Buqrm8hc4zZgibw2ROra30KJmpCLaRPoOVSax6U=; b=M49aB5NemuDdXCSoDVa30yH+Ib8r+VJ/+TowNDe7ZnvofQCg9CWg9HSj3XkZYHrRJ3 DYLQIstQ31GW+j5SAiehFRYsj+/It25MqRBt5zrVa8nOke6ePfdAFUX5SjyLzJKeho/s XYmHmd9KYiAis1O6csjihCR8fU/f/wPzFCwBHYSeVL5IvL91JOiGe06tKgJ4Src1AsxK 158gMjkq7pFjCADV7jqa7GhfVb1BU9pwlM3Z1NxYQFGyVGh1WXjfOn56SEqBPw10eR1C lYBlUF4NJ0vAbWDjCToOHf1INa/Wa0NJspZP6c/2WqP6Utp15226z1GJgeqRzkc5MaMk PaHA== X-Gm-Message-State: ANoB5plcsGyt9GZz56FjmbKr/lR8XOpLGB9uCElfbDLhSNRciN/VW8Ah hMPCs0XutGkN5+UrRhWxIRJUNg== X-Received: by 2002:a05:6000:1d94:b0:238:3d85:8e2c with SMTP id bk20-20020a0560001d9400b002383d858e2cmr4248475wrb.650.1668774365147; Fri, 18 Nov 2022 04:26:05 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:04 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 03/15] tty: serial: qcom-geni-serial: align #define values Date: Fri, 18 Nov 2022 13:25:27 +0100 Message-Id: <20221118122539.384993-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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?1749836869375790491?= X-GMAIL-MSGID: =?utf-8?q?1749836869375790491?= 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 Fri Nov 18 12:25:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 22298 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp165674wrr; Fri, 18 Nov 2022 04:27:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf74FDz/uwb68s+4ZESSfM5Xro/Uy4hE8G2R0yW1IhS0DhIfwLORB/3HyQIHIKOYlG5ONxi4 X-Received: by 2002:a17:902:7d93:b0:186:ab02:664c with SMTP id a19-20020a1709027d9300b00186ab02664cmr7330407plm.49.1668774479425; Fri, 18 Nov 2022 04:27:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668774479; cv=none; d=google.com; s=arc-20160816; b=ig3VdH8etvoTppGtOKBwCEa0p70nfLLYRbmXWat6/FfHhKHUpihSxfRDW1eUO9Uyc/ GYsI1dbxNXDvNR8cbhEfotNSDLyo9cqKZJdB6qIod2r/I6SRYo3S4DZ1KYobh72z6p6B hYEAxRtfRh19Z/z98zHj4+OFjq80rxvVgCbyn3/eyblrJ7vNWra0Ge1Wt/OuscjuJxTW 7mp8vMGmhiiC6eXO9y7+tPu09HMZ8C7TqwpiiA1+4HOZPBuQHhpgGUrHYkyusbG+4k3T LxvRPKZqjjhro+Kg0ZQnBqfyGOAFXQUZAfQ5dU0aVr9t4gq7+3+wBMDX1kZ2Bo65O9jW BRCg== 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=2IDPXLtOOkutc4YEs1kDSCA4Awj/+cxV2z/RqKgbcLA=; b=fgIhh70rB5QiXhSqttcIgSIDdlINBK+8uRZRcnCDK/SCSSCTGMjCnbBIQ9xcB0ymTW bsABd62JogffWyhX/K3AcWIzothpsfagZYxqslmFxVLVk9DjRvVqDUPQNX1UTY3cGfLO a2+6ZsNpj5az6GpTKvDMs+904RV+ACLLeM3HMDdxY1rvwN+G9qStJpoxd0nQrABj477T c4wmnerBxbfiKBrGkdEgby1yzrIlAA97iN4cXyCRNsulZpsIZskgtWLLrYNYWhWjbtu7 oI36PWrRCNNW20mHl3LG/1SXPbtYD6h/n7FQBUQ9hIaHUHCN1mc7Kq3XBHRKe5eRQ8y5 sIHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=0yEPHWXG; 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 e18-20020a635452000000b0044cce26fa32si3652523pgm.632.2022.11.18.04.27.46; Fri, 18 Nov 2022 04:27: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=0yEPHWXG; 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 S241833AbiKRM0a (ORCPT + 99 others); Fri, 18 Nov 2022 07:26:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241762AbiKRM0I (ORCPT ); Fri, 18 Nov 2022 07:26:08 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94DC7976C2 for ; Fri, 18 Nov 2022 04:26:07 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id v1so8963164wrt.11 for ; Fri, 18 Nov 2022 04:26:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2IDPXLtOOkutc4YEs1kDSCA4Awj/+cxV2z/RqKgbcLA=; b=0yEPHWXGMIEMGGm7qbNRpxy7F8zvbYlplpNguPP1mvqn0Y3iakwqTO/ONs0OOqBU1t 1xq65nIWNlstgwiLav/4VWXp87OaKYpvUL2IX3bcKV95HZjx2E4O4RY2Zcfmi4GzevnG 1Erd0AXYTmcHA9DFiccDrBL2xca99UA+XUKoxpNDY1BKtP73Mti62zqukZZS32HoLc+G odIggvMNA/nafiS8LdxkJ8rD8rmDZWk6z6SAsig9kQaOVI+lTUZymgEw+A5VImNxe0QQ GlFwnZiU2zmULfJ/l5uyqDM6tmYA5WAiM5kl9xWA67RkOOw8svTDGESvjc6lNc0WO+yg kdXQ== 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=2IDPXLtOOkutc4YEs1kDSCA4Awj/+cxV2z/RqKgbcLA=; b=p1meQj9hvcVDyJEIriqb5jbjgl7dsA/GtFkiWi82gF3hI6TJIw+9RpIyK73V4PIFlV aLXkpyP/LBnrm4/Vq0TdHqjK/zpUqz60APVpkTNB924voZ+tAxw7OmnAUe9h8nnbIa5I 0RmmF4IG7sDMS2secsdzs6BSzPJtxozOObzCLMgZBEb0+SMl/gpwJX+/Xdq3nRlVmvd3 pQ+r5Ex7sn4o+uiV/g1tSpiFCtihA8dWzIxknrfTu0ChxjsdFdaFSbyP9tOnA8j+Aevq K9aVRViel2sJ0OJm2h6KBcXGBVblF1VfsFlaFwnokGwmzdXrnXUWEUqAkrLJ3c5YCYyU B5uQ== X-Gm-Message-State: ANoB5pmpRECVfc25jGuQ8YAno195eXXjHZDTRnLCYluKEmciSgR17G/1 Ly79CJKelbIlOR4ec4TCj8+bIA== X-Received: by 2002:a5d:5049:0:b0:241:bd33:4e17 with SMTP id h9-20020a5d5049000000b00241bd334e17mr2690828wrt.174.1668774366132; Fri, 18 Nov 2022 04:26:06 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:05 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 04/15] tty: serial: qcom-geni-serial: simplify the to_dev_port() macro Date: Fri, 18 Nov 2022 13:25:28 +0100 Message-Id: <20221118122539.384993-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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?1749836868951475679?= X-GMAIL-MSGID: =?utf-8?q?1749836868951475679?= 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. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- drivers/tty/serial/qcom_geni_serial.c | 33 +++++++++++++-------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 97ee7c074b79..1db2795804e9 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -133,8 +133,7 @@ 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) +#define to_dev_port(ptr) container_of(ptr, struct qcom_geni_serial_port, uport) static struct qcom_geni_serial_port qcom_geni_uart_ports[GENI_UART_PORTS] = { [0] = { @@ -175,7 +174,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 +211,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 +252,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 +505,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 +548,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 +597,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 +626,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 +648,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 +686,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 +706,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 +802,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 +868,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 +916,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 +1002,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 +1287,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 Fri Nov 18 12:25:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 22300 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp165684wrr; Fri, 18 Nov 2022 04:28:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf7XUO/iQ2XNwx9bPPu4dhrZt2Trj+qeofMVjmBAHkxfpZSoVq4uqy4DysOzmuv8pfpF57f5 X-Received: by 2002:a17:902:bd83:b0:187:31da:a260 with SMTP id q3-20020a170902bd8300b0018731daa260mr7233317pls.64.1668774480103; Fri, 18 Nov 2022 04:28:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668774480; cv=none; d=google.com; s=arc-20160816; b=YzzAwTRAhQ3dlDveSG6vfb72INoXTR0m5FAZSNxPF2mKtgcgT4RCS9G8M51mebZxrK chYoFOeqTVaVZJqNZmOsAGoMhDlmwUbbn7HNr+6FWssN6Fja7r1/Tmm3nP6prSrKHXxZ PCl3iLF+ynSBm2RK9fJ9EWmeovBXSAORIU15XdqUMJXmSjeEV7bWf+ki8F8roBg2J52r TcZVXclMTX4um4yVE6U2z6TxNPqa6FUIfNqZ9f0msc6bcVQAGFb02vHc1CAhw/goaN9Y puibwpD259aJuYosCr1mWa093rwsF1ZAOa88YtBiDFRhAuhOJpBXE7lgDuacWk3NdCRw ngSA== 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=lTVRxd5tZFYcvUoBnJpH34+lxjijlQ63axYU+EIhaXk=; b=Ve8MXODbFVZtyYcCJIS5CP4GlyYXRCuibdb0GDwSSbb5ojJ7wP/UlZmJ0rhUpf/GXl JOh5JnaShIAFjCUjiNcFC4bC8pEC/qnALRoR8wYJfKxlWxaZrUs6SJtOvY+gatR9sI7C ReMA6a0YJLYPch8J6LXjqaPxrYb1LFcor8IWs9J+CU1Y04kPlZpCGWgS9nnxMSzHjPhS 9dHJj+L2ppsfu6BCGfvF4CDwxWJNrGggarAizIvCKfIfEQYL3CLDbkC1TesKVTE4JUJ5 pisWDgIaA2FRfWY8j1Kp8Ig73ChtmDhX8DrnqRqbUsEcWyjLRCeb2+VC7b5tOQBF6Vwb oE5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=BhYh54GU; 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 a190-20020a6390c7000000b00476a84ecadesi3598516pge.444.2022.11.18.04.27.46; Fri, 18 Nov 2022 04:28:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=BhYh54GU; 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 S241789AbiKRM0e (ORCPT + 99 others); Fri, 18 Nov 2022 07:26:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235247AbiKRM0J (ORCPT ); Fri, 18 Nov 2022 07:26:09 -0500 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B05997096 for ; Fri, 18 Nov 2022 04:26:08 -0800 (PST) Received: by mail-wr1-x42a.google.com with SMTP id v1so8963218wrt.11 for ; Fri, 18 Nov 2022 04:26:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lTVRxd5tZFYcvUoBnJpH34+lxjijlQ63axYU+EIhaXk=; b=BhYh54GUE+xzT/TMuZWnyrjmyv/UsQhZctMlScPYOoyvy4C/TGMOlYbyvWZLzt/xos lOWqQqfNM+T8o3IfIe/9N0HpoFMnPdF38KUpr4N/Sg7SW74bskjcgO7Buo/9wpNgZho3 FO7NnEic/tkdb+wEC89PNJaSNh7hACaj4jHPwRb4dqWfhBS8Lju/+5HDiN7mxRi8FYq/ DtkHmNbWUux+9CD70LNDEYtuEMlg2gQSts9D2qFRkcO7pnf0V2SRcALAG1HtAYVFojO2 Lb3v8sws7nnhiZRGFRPRHD5pQ3bzj1pYbIHAhwosIPDJJ/Lm673SaRAZkQ2tz2JIZov7 tcaw== 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=lTVRxd5tZFYcvUoBnJpH34+lxjijlQ63axYU+EIhaXk=; b=F3imbeNkNpeuCx8fW2UUxRpjPw0SiTIDQn0t4hZ6/tW5QSgnjEmkcn5gRbSGNMjznM U8ouD70bUlaWuoyDpb9pTVcXALLaMfhcRWRsC6AqDz4d73rwT1MtX+1MZRG3gY4Q08bL OQgaSnSrSUm3YQjiJ1yGHq1RUqp9l4+rbOlEDCzl1uievpnkDhK7dPEXN+QQU/+bAGs9 K1ZCtf/wVWubFccFCegvBtXY4V4fQP3b7ZU9FpUebih/uSWueL7FEr1qnbEn1RspbYqq RvTJUfctaAXssLjHcXWPlORUvL8D85fd9il+mN9EcqsBbJDuPk8rgGGCSdmC5WAszPgi vNYg== X-Gm-Message-State: ANoB5plYOZ2zH6s8W5VBsQgOTKcomo8EmxTvSO8nZE2PJrLAyvBKlJ6w 9yZWYjRknWKsBA5ZzMAfmdQ+Jg== X-Received: by 2002:adf:f54e:0:b0:241:c68b:6b41 with SMTP id j14-20020adff54e000000b00241c68b6b41mr223529wrp.95.1668774367058; Fri, 18 Nov 2022 04:26:07 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:06 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 05/15] tty: serial: qcom-geni-serial: remove stray newlines Date: Fri, 18 Nov 2022 13:25:29 +0100 Message-Id: <20221118122539.384993-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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?1749836869217294789?= X-GMAIL-MSGID: =?utf-8?q?1749836869217294789?= 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 1db2795804e9..dd1491a72deb 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -317,7 +317,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; @@ -542,7 +541,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 Fri Nov 18 12:25:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 22301 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp165685wrr; Fri, 18 Nov 2022 04:28:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf6VKA1g/2F5D3C0Sty0yWy7Lca2YO2MSn2CrKNJGr56p3pkPLytwUTq1c0+okoqnpp4ZdZ+ X-Received: by 2002:a63:144c:0:b0:474:bda:699b with SMTP id 12-20020a63144c000000b004740bda699bmr6328312pgu.366.1668774480099; Fri, 18 Nov 2022 04:28:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668774480; cv=none; d=google.com; s=arc-20160816; b=QZQNTAgaZ5TQRqKKE8VnzpbhwSj48h3kX7clvFbCPJNErUYpyVSPEiQEfU0CaEzftO 68hQMdEO+/i1Q6iCb7RWiLqZtYPVthVI5ZXfXVMYp3wBcie9s3o9xUQm8TjfcMNqb17D chw8SWwjsnaYW/X9BfImrVnF4wYmGSpDMCb76QonmFCoSMgt3wTIPXNZmCiFAgufLXip Cn+FjGv8eTMv7EqODxTKgtGQdbQvH9Jgp+8lFV8hkSj6jK4nmy0/GPTvKjsCI57giip1 R+yTtG7Flz2K12TJR2Oeq/MdMivAIkTJ+xTmrxO4nUnbtqFiq6LTwfW7JgM03H9ZDA35 gtQQ== 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=zJiQI08Pb3pmpY28T3+Fd6ggBQFLoumFh4Lv/NyHmzg=; b=DkTz6z6g4NmsD82wj4yNT8lZb3F6baOijo7ft20TmTowCyUcAsjNDGpg4dHrmdSBnf wqu9GHHTxqiY9dljJOZ2asC8wCc57mdiTguNeBHL/NEfSGkyQc81wJJu1OSHa3XiYyaw hjqZovwUd/aJSz/02SjDHv4HLJ4f8f2PbNTQsDbZaQtu48UBhAJZP+EgYimVcS+SKUtD MiCVvQRcbO5rnYURMqYbglIZOjAockgLnrOxnofMEFjSNDvh+5nbTMZiHoMtkGtwh19D lZO5ts6xdeKKvUTxWzZRjYFEOFrbatDSimDRU5Uwrya+1bgav2hDxK32vn3KMOj/Ef0m bwdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b="NTwSgH/p"; 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 rm1-20020a17090b3ec100b0020ad4d5b9e8si7907050pjb.89.2022.11.18.04.27.46; Fri, 18 Nov 2022 04:28:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b="NTwSgH/p"; 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 S241034AbiKRM0n (ORCPT + 99 others); Fri, 18 Nov 2022 07:26:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241542AbiKRM01 (ORCPT ); Fri, 18 Nov 2022 07:26:27 -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 8605D9737D for ; Fri, 18 Nov 2022 04:26:08 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id a14so9049120wru.5 for ; Fri, 18 Nov 2022 04:26:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zJiQI08Pb3pmpY28T3+Fd6ggBQFLoumFh4Lv/NyHmzg=; b=NTwSgH/pPCy0rx9k8+4HSIGh4YIOeNP51I2+IQZNCer+bRZZJMrHL4W8MOAZaSlcHa CQ3/fD/YOF7RVGFCC9csekJzz7aov9U4qd78L338s5sACCKRMpjk7BFjGdD7JViUsqKE Nc4YU02rLOIRMxsypwq3fAN7CJWgOTIE/AZHR110qhWm5SWYkZgOL2ghf/y9GdG5oQ6Z e7OYrK88Uok9baa7uaJTzMVwDpfgce8jdDZi8QKiBjpOCuNJ7x1L+2Si/dUbc1pHN2ol erzGM6k83Pov8QlyGvBpFXV3Xm6xzcPIICPjbeblWIjZRX7mbUVasH1o5J3PV/xC9OlN CS4A== 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=zJiQI08Pb3pmpY28T3+Fd6ggBQFLoumFh4Lv/NyHmzg=; b=PE0YQv1oyH1mG1vFDUcqHQJVEv6XacwnG89BNPVk/yQPFwR3uQGn3FisTM2cF2rXWP yWQ2XMp15C6/HieFCxjKX6b79Qdkvo6+AEkbwwONqOG+82kGdDMEBX2kKCEwg1GKUDNC 0Cg/uoaJpZpVOBT9AUAUTihfeOANV8nAVpNl6fIJ22Iq7ErTStxc5wtgGNXTRyDjKLs0 1M3kj/W92/yFK2tcFJEYeLVePAB+j2Hg/5qTHrQqiRCjxmgP3Cw8klUMChBY3JW3hk6Y 1xlOTizT3I6swU9snPdA49lgm3WBbcT5ggy02G04rQ6rOv+pB5rwg9uijcxUsOdSObDe jK8g== X-Gm-Message-State: ANoB5pl1Sr4RZNh60DDwEzMTLHiXMPJ9pvSh6oDUVBnogWE4OSMBQHiq Qv5XfHzkp5ipJMGjZyy8frY5nw== X-Received: by 2002:a5d:678c:0:b0:235:14dc:5e14 with SMTP id v12-20020a5d678c000000b0023514dc5e14mr4302820wru.252.1668774368100; Fri, 18 Nov 2022 04:26:08 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:07 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 06/15] tty: serial: qcom-geni-serial: refactor qcom_geni_serial_isr() Date: Fri, 18 Nov 2022 13:25:30 +0100 Message-Id: <20221118122539.384993-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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?1749836869209743220?= X-GMAIL-MSGID: =?utf-8?q?1749836869209743220?= 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 dd1491a72deb..22c1869c60f4 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -824,20 +824,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 Fri Nov 18 12:25:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 22311 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp166181wrr; Fri, 18 Nov 2022 04:29:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf5sOF28mHiwxmcO9db+WrdAFB03LvH5MDOuIouLNNn5uuCyQ/h1jNGZf6+NDhmQzLuTAMPO X-Received: by 2002:a17:90a:4206:b0:213:2039:64c2 with SMTP id o6-20020a17090a420600b00213203964c2mr13643500pjg.165.1668774550602; Fri, 18 Nov 2022 04:29:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668774550; cv=none; d=google.com; s=arc-20160816; b=mG+yUVCJvigg+oSJSpubGPLjjSmLU0TESGc338gfHigWVcyulqYuSgZLw2yWTE+JCd Lxc94v4vtNoo4g3HZPqystTY+PKBNAieGAPBcOrGFJAkXOzJ6fHXfrW1HUNNkG8lg+Nf c86+C/fG0pWzgTlZ8fMn7wH4kbEqZnkZJj1Kz4tJNltLnzkkFlcpysjftNhW5G5ud4Kw N66Ip69x2iYk+M2aBVmJxGiJ7YgMVANEBcFUjjNCK4Ajpv5st7QtYmwyq5rPlz8SzYSL u6uNog6n4CTKjK1ncRT8dITLiamMrfofUNVLg0JsYUvSeHW+V1B7QktUYhxSwKvJ3bOM EkCw== 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=vMYlxBECUyROeU2qoZzKEqhzlBfoiS2AeDouftWiN14=; b=A9BJDMW6vkN8KA2/e3nHM/Opc+OMrILnGIOKOSLHZPhpCDp41rEfyKHQbrSb/y0oPP 4WIHNDtZan5Q2AmdoGk8E5X5hzJmw8rOkZilMbrhk6bf6rdu0kdhM7GCtF6qFK3yuPJ8 bLPSZ5S/p234i7zWA5mztoGoIvYqa4TqZ8wnvWli3gPDtGgq79/exQY7TyjD8EykIQ8+ DwLyyQPOF87LTI+EM+dRksy8rCe+L+rUE9qE/qtn/VML+oEHOgPhfv9Q6/EDbk3yROQ+ F2Ool+8rVfuAR/BO92gPKUW3Gc1076J5xKkBIU7n0ucq7YxzTlNoP9cDdurw4wWyvv7e b1cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=h3ylSwyl; 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 w29-20020a63475d000000b004429ecbda9fsi3794995pgk.39.2022.11.18.04.28.57; Fri, 18 Nov 2022 04:29:10 -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=h3ylSwyl; 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 S241802AbiKRM0q (ORCPT + 99 others); Fri, 18 Nov 2022 07:26:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241788AbiKRM03 (ORCPT ); Fri, 18 Nov 2022 07:26:29 -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 895D7976F4 for ; Fri, 18 Nov 2022 04:26:10 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id i12so5146401wrb.0 for ; Fri, 18 Nov 2022 04:26:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vMYlxBECUyROeU2qoZzKEqhzlBfoiS2AeDouftWiN14=; b=h3ylSwylTpt/gTd5gxjRVlnohrLzxyaHkKxHSNdsMOgFdjULJkYTK9ag3H5B7bZGNF xpg0lzKa/Kdgi+wwNxNugBCVUxhRzAeEO0K9bZo5r+rixRV2dZT8E1XYBNEu5gFMBPMk u3QrTixzNo2+yRMl1tCa5RS9oH4RsO/lSqL1j8ZDZ+J1rahMob66xdS+/rt/GuPB8Fa0 /MnLjQYgrfLogwNpXSQwcE4A3zNxtyujkrgVt9k5TS5qYNyuHkGAJQeOPW+XFCv5Erio Cw+8ATnanhtooLYJuYJCabSEaLbnbmt3/ey5xxHhjF+06VG3BizN8UcivtyLeLRJEKaH BL9g== 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=vMYlxBECUyROeU2qoZzKEqhzlBfoiS2AeDouftWiN14=; b=H4kfBO9tbMlOAlsfGJWkrNsEnzRXjfybJrW58A477Qy2+ws0LVZ4Z17z03PjQaKwz0 lLuY1JZai7YhBa+JaCuMdCR5jdOjccG5lWRF8xsJ1Qj4ti/uuSR8poFfG+yfeDzPl+0a zEJiiP0nQwsZrl72HFDugWDSOruxoSXQxtBhrLOY4iYI3GJonS9dDtn4BKwLl4xSWZDx NAXyhKZGNiwzPGzw/ZS96UAy/odMOdggpave1ZON5CTOW0/oQadgfX1NzBnkeAA3s30D jISyjAlgqVz7bQqOb2gHjpdV49aKheWhp9aOU1o5CzRZiHOluMP8+NZhFx0pnQF0u/LX Z3sg== X-Gm-Message-State: ANoB5pl1aig70GyeX1VVH2/UhBAiO+MC3w5GUHRRUyWLwCQsNE4gA1a4 oYpsNYHs5MT3o0ZHOw8vBRZmTw== X-Received: by 2002:a5d:408b:0:b0:236:53d2:1668 with SMTP id o11-20020a5d408b000000b0023653d21668mr4185721wrp.694.1668774369037; Fri, 18 Nov 2022 04:26:09 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:08 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 07/15] tty: serial: qcom-geni-serial: remove unneeded tabs Date: Fri, 18 Nov 2022 13:25:31 +0100 Message-Id: <20221118122539.384993-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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?1749836943285991292?= X-GMAIL-MSGID: =?utf-8?q?1749836943285991292?= 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 22c1869c60f4..39041538e5d2 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -138,26 +138,26 @@ static struct uart_driver qcom_geni_uart_driver; 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 Fri Nov 18 12:25:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 22302 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp165757wrr; Fri, 18 Nov 2022 04:28:09 -0800 (PST) X-Google-Smtp-Source: AA0mqf6rrCZW2VghwpNxQl7rKF0gLi+4idHSMBXlNn++hu4IXFo0QZP8fhuvg060ObrpxeUQ5tLS X-Received: by 2002:a17:902:da87:b0:184:fa22:8b67 with SMTP id j7-20020a170902da8700b00184fa228b67mr7286899plx.149.1668774489040; Fri, 18 Nov 2022 04:28:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668774489; cv=none; d=google.com; s=arc-20160816; b=SI91QRtgaF9LEfazgZ5WEa92KHLC2xahMeEcn7ZPZkin7wlSq0q/6i+ZlbIj6rOV7R P5w6Ji4YceLNiny2ezPyyhicUzA6AX5Mxok7n6Cii/fPDTZa1zVGMS8gdvJ75QqQFfeI vJVHAGdblaaUGZMtGmQiBFXRGY5kVtbSF29DFP06V+F5mMVolQmJShqUY7orKAn4ecpr d8T8yHWgAcAx5DrZbecVSfCsrcAlqXnMz9VRyri9Eu+hcf/WzV9A+hhpTqenBtY6VQnR BalBrbBdE2lB0RjMsJ9dkRgBGY17IUbeBo8TtXVtXvBPg0vPdZQU/DcJHPnahWNkV6Zd 0OrQ== 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=TjRlvG98zfN2Bv4vCWR93fi5oSZzdVfhIH1TmLO20G0=; b=YaQGbQb5b2vbacQNqR/b4Q5GrQ/MyDIo4vLiIFW4GxRCrQcgvEEy+Lle4GBexDVKgo d/H3xReS0XW7PAs+tPOtzmifQh23tG3wP7a9wXYyaC94RSsEllXTJffTsEvX9GkRHda4 k4pkTrpUxcSA64gdCFPkk5MTFxvVTt0tI+XhdYi477i4swBO3nQff90ThJqDYEZ5yVeG /v0gk2vYZIWhTabnV+CzOTjNRUgBAOsHY3zf2XnSE6aqWZSb1FS/YjQMA/+mA1Mb/YiP Gl6hh2tHGJbiO3+5XPmCeNOh16Ob2z6JV85IRB+kAGq4kkT7rRqBrrYFKXclFxu+H3sd gw8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=36jVyEZd; 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 g184-20020a636bc1000000b00460358671e2si3904273pgc.547.2022.11.18.04.27.56; Fri, 18 Nov 2022 04:28:09 -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=36jVyEZd; 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 S241896AbiKRM0y (ORCPT + 99 others); Fri, 18 Nov 2022 07:26:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241792AbiKRM03 (ORCPT ); Fri, 18 Nov 2022 07:26:29 -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 677F1976E8 for ; Fri, 18 Nov 2022 04:26:10 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id g2so5342974wrv.6 for ; Fri, 18 Nov 2022 04:26:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TjRlvG98zfN2Bv4vCWR93fi5oSZzdVfhIH1TmLO20G0=; b=36jVyEZd8EBGn2gTFQTK9zvR7p60sA28fQEhTDPQkMGJJHXxRHDUQMpVvb0zR13FV2 LlhDzZc2eq4elS+3dSlFJhPCsYMO4ysrInRywPesrz74OhM1fKA/UR8xP1zchHCEtmf9 z7TAkuZMQmwtONuwkRfaNivre/GuU5iAD1wVXTTKHOODkNQ7bUvQtgNR8NEVjwffK2L9 dCQ71ySN60tAvZdJ64b91DGXG+Nsr1ur9E+5BzZWzJDZrior1vYifXlXv+YGF9IlO0xu ZICuIwAgfWie1nj2tZtVG7tTtbDfB7uwNLt8ebWFJITia3CYwIkBYDRPXSvFkEM2hHNY HRpw== 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=TjRlvG98zfN2Bv4vCWR93fi5oSZzdVfhIH1TmLO20G0=; b=P5YQZUKOrCtmidagqsTi6ENsbIpCzJ/EsdLSmxHlZqXsMmNiI6TOwRmMK91quyASaY 7fZr7yEjUcrsSUXSAMMFqdWUSQ4ZuKsIVlnLRBDPXop67uv2hG91XJVF5Fl15Jsoqeh7 97+PykYVoeC18jxmpuqaK6AFnwfNzwT8Dfn36gQ4upaYOuKoMvmoE+D+2vmhVVbiK9Ou RZ53wdRwSqG8kGQz5Op0AblOoQ/uY0zRYKPD3ligieeH8GyZtZUwva7/+GZuYK88Qu/A KcH2PL68+QTdM5oQ2EWP7CJ9hY+jRybbQpskW2d3u0F32DjiclcXnwvCW87t1RX56N6v /QkA== X-Gm-Message-State: ANoB5plJtRORb0tX0Uk85YS54knWXo+xahgwMM1NcTVeNWNELNmqpKfU 4w18App2U2NTI7J+j1pneXOeqQ== X-Received: by 2002:adf:f805:0:b0:236:ef0b:68c5 with SMTP id s5-20020adff805000000b00236ef0b68c5mr4316797wrp.373.1668774369979; Fri, 18 Nov 2022 04:26:09 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:09 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 08/15] tty: serial: qcom-geni-serial: split out the FIFO tx code Date: Fri, 18 Nov 2022 13:25:32 +0100 Message-Id: <20221118122539.384993-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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?1749836878594901853?= X-GMAIL-MSGID: =?utf-8?q?1749836878594901853?= 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(). Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- drivers/tty/serial/qcom_geni_serial.c | 60 +++++++++++++++------------ 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 39041538e5d2..4b155ca0ac74 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -701,19 +701,48 @@ static void qcom_geni_serial_start_rx(struct uart_port *uport) writel(irq_en, uport->membase + SE_GENI_M_IRQ_EN); } +static int 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; + size_t remaining = chunk; + int i, tail = xmit->tail; + + 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; + } + + return tail; +} + 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); @@ -732,7 +761,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; @@ -747,29 +775,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; + xmit->tail = qcom_geni_serial_send_chunk_fifo(uport, chunk); /* * The tx fifo watermark is level triggered and latched. Though we had From patchwork Fri Nov 18 12:25:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 22309 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp166048wrr; Fri, 18 Nov 2022 04:28:50 -0800 (PST) X-Google-Smtp-Source: AA0mqf6BEhqRQXM8ZdEbqi0nCkz9C11Gq4TuFARDtAxouZ7Xa4zIZgpF+/xr0fnkZBD8wjf/N/fN X-Received: by 2002:a62:1b4a:0:b0:573:20a7:d with SMTP id b71-20020a621b4a000000b0057320a7000dmr3717790pfb.65.1668774530329; Fri, 18 Nov 2022 04:28:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668774530; cv=none; d=google.com; s=arc-20160816; b=IVfObCyTEqAt3LQQh1SPTlPBc5M2USQ7GG/AobAq1MTba90DyImJFR7Bf8EDOiT2ju H0XjKDaF3lCbByWQ8DCLMqYZqHiuwTyJOsVdD/B7lUT6f/jvW/9Do8oRRs5W4CLbVz80 l/GAQD7McII4Iuu1l8hEyiDCoQnvqGmT3mKmsQTJkv39iiyA6H+b+ZhDjWhohqn9vPzY sBBSYsXRpXrXm2QGzhS5WR7tjvG4ZyF938cAHnS7wJV25uyEyyC/lSFCobOQ9JlOHE4r 2D7ve4s28wyMMRsvmie0C33MUXvOrlAarYxkdgB6yJcGMKmHbRvFDJk5k70zbzzlLLKd 2sGw== 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=pF1K9Osvm2bfxV7B3KPTmbXBc6bO2Z5qPB/LIZda4KU=; b=N6YXMg1a3gv5bkJPI0MH2n+ug4hmsVGcX2BgXmdbLJCSPc27VlaT7j+RtbX1JtATKi cfJdOYhnecRJ8dG+tPiyVdRnh7pc9wSL11L7t7AxrVdaRhpYGwJbQr4nopcckC1j8SMr MaXBDRfl11yOEmeKr3BEP1GRMjUyylC35MJLzBcYAWSElteHFb+duBO39aNGK1mIbhRq /zxo6dbHM/nKSUVACwHz3YlMbFTk3+NdHYRudCxFrRDafzfNhUX/JQ7bs05nYPcJp6k1 eYRj3w7awqGeqKhZTu8Nsr0fiKLPZIW0GGyBwp/zjQkpAK73mFSETCtI2+W5p0HChRbI i6Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=CxzI5e9N; 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 q23-20020a632a17000000b0047693f9d264si3474102pgq.833.2022.11.18.04.28.35; Fri, 18 Nov 2022 04:28:50 -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=CxzI5e9N; 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 S241881AbiKRM0u (ORCPT + 99 others); Fri, 18 Nov 2022 07:26:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241794AbiKRM03 (ORCPT ); Fri, 18 Nov 2022 07:26:29 -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 5A1C1976FF for ; Fri, 18 Nov 2022 04:26:11 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id l14so9073887wrw.2 for ; Fri, 18 Nov 2022 04:26:11 -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=pF1K9Osvm2bfxV7B3KPTmbXBc6bO2Z5qPB/LIZda4KU=; b=CxzI5e9N5IVV6UCsvmfkxAyhT/XdAotthqZtvueaQdC/kcNGJNscZX+6tGcAM4V6Pe EAhGgvhwvKRispf0xbrhrVd3lWFN8luWYVNjQ33vNr/niFWXQ0vdS4SGgjAp37f0goIY 3h1A/JAIJH9o46Sfq4OoIcTZCzWJ7or2/TjzXCWh7I0wLqFfw8JQQhwTpqbIBlhRT8mW lyHA6uue5Kvf3hlOZW7hSn1zgP7ZHq0dQCeFAl4OCxkLm6RhbpGWhZZ5J0+Crm8PlA5J 8luF2weu1CWp8n0yyZ/n/5tSas/gLib7hteSOR7EEtfTUw77XE2GtH6HMnjj4dnourDh RxgA== 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=pF1K9Osvm2bfxV7B3KPTmbXBc6bO2Z5qPB/LIZda4KU=; b=2kdu7hyp5W+yKZpJKPIQ67IrBz/QzT34G16ADC8ULh4Cm6wp6bB3IQ/XmMQVu6X5eA 2lvrNgdnoiG3FQabHrNXd46tyATl0eIVoebwtRWGUQ35snei7J6f6k1YnGUUdVGj9szH oRZAKoxK/ZMMBU54se4j6ay7YqXvJgPoOgT7Xj1tbK/5EobJvDPZFoH1YNIGYQqXUDh3 KJcGY5rKZgCOpDop9r7l4HL02E3jamo8K/7sPTyZbAwCl9rUFW/3ce50Z0XCTd7EtAO9 ad/P5DPYpeuxA1G8IbgzdYw9ESrmxgKdypbmQ8gGv2b7r1fhQv6lbzuClkEX0XkP6deC 9x6Q== X-Gm-Message-State: ANoB5plD7zpmu/65FzcCjvi91BEBSKJL1VMlIw4YhZWdrP1RLlxMWLcn rxA5vHPFC8Ag2MwQgChDT5LhAA== X-Received: by 2002:adf:f6cb:0:b0:236:7a11:b061 with SMTP id y11-20020adff6cb000000b002367a11b061mr4394865wrp.292.1668774370893; Fri, 18 Nov 2022 04:26:10 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:10 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 09/15] tty: serial: qcom-geni-serial: drop the return value from handle_rx Date: Fri, 18 Nov 2022 13:25:33 +0100 Message-Id: <20221118122539.384993-10-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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?1749836921768512480?= X-GMAIL-MSGID: =?utf-8?q?1749836921768512480?= 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 4b155ca0ac74..72d0e7b91080 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; @@ -499,7 +499,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)]; @@ -534,16 +534,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); @@ -554,7 +553,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) { @@ -564,7 +563,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 Fri Nov 18 12:25:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 22307 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp165867wrr; Fri, 18 Nov 2022 04:28:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf7yxn6TfgUqzrWNKD9AYWyCkOQ1IHa3+X7XF3BczgVG4bch0JqgShqI9ad7jc1isUIdCDYo X-Received: by 2002:a65:694e:0:b0:474:6749:407d with SMTP id w14-20020a65694e000000b004746749407dmr6314270pgq.425.1668774502866; Fri, 18 Nov 2022 04:28:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668774502; cv=none; d=google.com; s=arc-20160816; b=KVmOTvfKDAAK9mci+mw3iv1SsA4AGlwp13bIGZuixb9a4o168yg1viOfZQAHwBYFYw 1THdFThcETxGiFU8pTekChFLxZLmbwBPj6Vm+TDUBZrpkSYXzVXDay+7LAfLnM1OfwTD ncyYUHTQ/adWi2Uo0OoI/M+68oT4Qq2+tXvyawYeu2UjZrzaFZUTTTIqMjqkK/p08SmJ iIhGamZK04JicwBSwjE9JGp0ff63/vRY6HL0EW9Ahn2PyKN177EsxOJOCfA6Smq1BQ0t PIB1tGOcC8NcvpEKKdUQZFQ5uehkdzQW4ZVy/ngro9x30vOirBM/cgj9cl/YMWYXvyMb 0uVA== 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=+vWdaRfhODAgXHbciwp5dedPQgtHL42vE9HPN7sV7Xo=; b=yA27FOD98gKDdYfTvAQ0l+1UHH5SrQnhYEoC/vBfbcolCpK9UV50QOG0CUbm8Kx4je ezZ77NqV5mbqtL8IBbgc7Iitpj3vr+YzopeAXiiSNiTS9eAzZjAIp25zx8ifPxu3oJQH YuLeH12WKQ2PCLgw1ZgBrTZKrqYnzDwtUzV0/7NrFirLA4w4x13R8XbYqu8zo5BJiGVy edFciI0FT77E5Egyy4TZAMxypebXjzUap4+KcysMvo5COOCs8PKua4Qm35fZf6cKLp7t xXAu4K0zE6WafRCwmasgVvbtnNxdKWehj5LLDHl+hMQUmcvPzubnG34HCJRODFT9sK9Q ocKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=A3I9ebSn; 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 l27-20020a63ba5b000000b00476f2af54f6si3846652pgu.47.2022.11.18.04.28.08; Fri, 18 Nov 2022 04:28:22 -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=A3I9ebSn; 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 S241808AbiKRM1P (ORCPT + 99 others); Fri, 18 Nov 2022 07:27:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241758AbiKRM03 (ORCPT ); Fri, 18 Nov 2022 07:26:29 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 413BF97AB3 for ; Fri, 18 Nov 2022 04:26:12 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id w14so9026170wru.8 for ; Fri, 18 Nov 2022 04:26:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+vWdaRfhODAgXHbciwp5dedPQgtHL42vE9HPN7sV7Xo=; b=A3I9ebSn8MP5IHCkR+JU5No+kasmCPdQLMoUahVY7mTEMzWGkac6JsvBdCbC1srPAV PgzWDHNYqpDHW2tSapQU8V6Q65C7xcYlcP7Ft4Da6Xin20coIt6uEEvxJjibMd0+UA1+ esO+UwnxJTpphcJBdMD/4TzOn+6br3VLlg7CGm5QEO9OvSX/A2Jio5wq3iJXD8/9A7QF MdDtuKQUwEu7AV5W77SShOuhPh61NRsDoFsxB4pWpjX6y54U/IjeBENl2SPhz3nsNFU0 gL4A3Pa6nN/wOEFFhJ6lVTdTjyAJOrjhpQeAiVoJYVJPmSMopMyxq/jM1fhiCQH3a3po XIHw== 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=+vWdaRfhODAgXHbciwp5dedPQgtHL42vE9HPN7sV7Xo=; b=YleyxLCmoRxrm1vrZ/FqZZWTg0fwZIcvreaDG0SMVrhCTREHojV/lzNIzaIADQlpBK yNbkDfFVePF34mwHSFZxJeoDP65PTPC7GrhtXPIpUH+pR8Y8qgZ6oSrqpnkiCO+29zqd a8TaV3V2nNYqOBaZPJSTpe9160ZM6+/oQ1Wq+jJjiUClJboNZC71iC5RFCT4x7KCEmSk 410fVQ4uXIFmkp+FWsgyf1tlUg3fv5b8j58WjyMIuIdeOroNi/kpEbZ+bz67CgBvS5b4 v7PValqY/LIB4IadZPD3aKiE2ucBR7Pt2A2iU2SNBs7JChVHVaFjQGDvW19m7EcXTDBf KpPg== X-Gm-Message-State: ANoB5pn8LXNH6YGP0sjsZQEPKaM+NEpLdku2vyum1t6TvKAusLO0bzJu NAFhEzVB2CXN8rb4ADaNHHmpSw== X-Received: by 2002:a5d:6107:0:b0:241:9a7d:32d7 with SMTP id v7-20020a5d6107000000b002419a7d32d7mr4224230wrt.197.1668774371837; Fri, 18 Nov 2022 04:26:11 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:11 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 10/15] tty: serial: qcom-geni-serial: use of_device_id data Date: Fri, 18 Nov 2022 13:25:34 +0100 Message-Id: <20221118122539.384993-11-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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?1749836892789807630?= X-GMAIL-MSGID: =?utf-8?q?1749836892789807630?= 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 72d0e7b91080..6a9f3f937f29 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; @@ -637,7 +642,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) @@ -1348,13 +1353,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 { @@ -1364,7 +1370,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); @@ -1376,6 +1382,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"); @@ -1394,7 +1401,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) @@ -1424,7 +1431,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")) @@ -1446,7 +1453,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) @@ -1526,14 +1532,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 Fri Nov 18 12:25:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 22305 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp165824wrr; Fri, 18 Nov 2022 04:28:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf5L3amUq8LOjNIYEKwXJP82nX/ux+wgI5tbNkDUz5T0sRACFfzf4fLAnSdL8H021xZ6Fr9A X-Received: by 2002:a17:90b:3706:b0:218:8759:f15d with SMTP id mg6-20020a17090b370600b002188759f15dmr2732124pjb.135.1668774498215; Fri, 18 Nov 2022 04:28:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668774498; cv=none; d=google.com; s=arc-20160816; b=EwEwlEYnPbtry2GzfZ9AXgucmf5c/HJY00HM2XrB9wtH+O/TJUDNFLy9c3Il8dQ5Ph kb/72MWn/O+BsZSYeodkZxK0VIb4o2Ji5/5susODWPdSQi1uEs25liBuxJtUc5BtucHb KsBs+/ZCnitCoJxYUHXL010qkV4zH18tSSb7KMjXT4V8cDoCiwoBWV93WT7ChF3p4eyt Yk9gadTK5ovv3uP8YP3jkE8KGN/7IfKXNsEnTWcuRkl+AdK802LrdBUGE6nrD4kPM4s2 1yiB53xVlPhpnwsTqfixfo36C1y4RefmziKkWy27JvFSZ7FEM2VTM/fhyIvwTIee7FKW NVhA== 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=kA0mRGqH1AuIV+a1MO05ETt4x66olQAeBj4vK+Kxqj8=; b=Hr+4LwXg0ug7993XasFX9xMDkRCWiswjsVQke861GQVei5mEZuGDI6QO13En7cSKru pYG8nIF+FYSLMT+l/dHCovex8JHHwAtx6jWV9rFeU3wDhoRklEB0EjNxXAaPMkAMjPti X8uipMzOK9qPzS7Vq9QxLi2A6DvxzKlyjgUai1ZUu8x0DVdYFk29au+ENaKIWU6avjIY 4bVKJykoO1GA7uKgTCDH6+pwI/YNxvllmHXbY5Lb2nUobgucQAz5zvaoiju312NM2U9n sT7CB5StZpgpNWu0SGB9vJV9qslAFvhjVr7XtwMQdiTuKlRX+9trYKnkVcOw+2Ia6tfC dZEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=hkM7abkK; 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 g12-20020a170902740c00b00186ba56bda8si3638754pll.61.2022.11.18.04.28.04; Fri, 18 Nov 2022 04:28: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=hkM7abkK; 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 S241723AbiKRM1T (ORCPT + 99 others); Fri, 18 Nov 2022 07:27:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241823AbiKRM0a (ORCPT ); Fri, 18 Nov 2022 07:26:30 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3123799E8E for ; Fri, 18 Nov 2022 04:26:14 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id o30so3531969wms.2 for ; Fri, 18 Nov 2022 04:26:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kA0mRGqH1AuIV+a1MO05ETt4x66olQAeBj4vK+Kxqj8=; b=hkM7abkKGR4X3yahLkJH73KCQSaV68CGuVTJlrk2TkbNfZYOmVJ7x5d/hmfeRVUw2W bMJz3Cd3zkdJzfKbE0IsupzbOrHa9Hf5Vt9tnebhKw8SGEExrrH3ReA9zMoULFmgZhRU gID8QLVEX1dQcEB3sEHWFqUNAAEH44wROl1xrg8FyQp6c3uyCsajOuW0ENscAF0EhYbo 9WLVuTAS0xAzUPIAtt6Ao5E5a2uolP+G9WfZsmcMqoigK+o1Z03FyYBjEpfec8HeLf/i pkx4tG/oe1/eipwem9b9l7nV01FDqWtyr+JaEpSAVlyC9BNcWglA7jfYEcxUJ8KAuLPk nZ6g== 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=kA0mRGqH1AuIV+a1MO05ETt4x66olQAeBj4vK+Kxqj8=; b=j8cmTG5NVqX+U/miDXG2w+JnpkkAQEooYXih9a+x5iw7w075V1rQp6Qo6SB3MzPZHv dfPJSWfwDvZza/GDpND+agjuDtYSugKevQXPtADKcpfGCgB9aIfLJ0KJ8OPP8K/W1NEf FaS2Dq1v+7MS63BnqQIrUtaqeAdQ4wiEo8anenQarWtN/oVeQTcFV5onj+pfYMkGCDCE xbtfMPPct46nouMDPxfL2PGr3TNOuhg0FHTpO7zsMqy8qgElK1nOaSPvuz4eCIUG73mA byy9CFtWSecNZtkT90KdhBCnB7iM5tPVNig+7cCJnxbhQS0EzpM6NC70g67Hf8SnuyGb P/gA== X-Gm-Message-State: ANoB5pmTCj3JvSubPiIMefPpIrSebfqwftVqxdEIPjdLqeAcSno6bURy 50svidIsBtvQuxYvTQnRtVlh6Q== X-Received: by 2002:a05:600c:18a1:b0:3cf:a9d5:36c7 with SMTP id x33-20020a05600c18a100b003cfa9d536c7mr8256862wmp.13.1668774372729; Fri, 18 Nov 2022 04:26:12 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:12 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 11/15] tty: serial: qcom-geni-serial: stop operations in progress at shutdown Date: Fri, 18 Nov 2022 13:25:35 +0100 Message-Id: <20221118122539.384993-12-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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?1749836888015556496?= X-GMAIL-MSGID: =?utf-8?q?1749836888015556496?= 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 6a9f3f937f29..091b8f277a04 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -868,6 +868,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 Fri Nov 18 12:25:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 22304 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp165827wrr; Fri, 18 Nov 2022 04:28:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf5HnTF3ymcjkUkU39H3Aqfvp+X6FPbi7yV6K49VV/Z6hTX8EPdeSPD7YSvqH6uUfee/QN/Y X-Received: by 2002:a62:5f46:0:b0:56b:cc74:4bd5 with SMTP id t67-20020a625f46000000b0056bcc744bd5mr7673012pfb.79.1668774498282; Fri, 18 Nov 2022 04:28:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668774498; cv=none; d=google.com; s=arc-20160816; b=g4kT/09wB/GDzY9SRHk5uiBD+r2NxzaiO+vEgLdAQqDNLsDu890wjXzQihxhxj29Z/ j04fB5P2QilptoBIrTS5C0q9+5DEVKWUxqm/Hvm2A9NY1w3asHIOCmGYXTFDY5xpcJ/0 ++R6IruYW/QW71mkobZKtSvznwkBp1jGx0xFwpRGCFJa+Nd7XOV7oTs0M1BrxW1GPtym qcI894NRiTsnWxTrYosDRmB7UhpMToIOTUPH5L9Efs9pRxYlLOoW/YlFEGIVj1bGj7ZA pYaFIthoFEUNAxEMYePyiE6xbQPNK7iyT5FHE+uWXSBs5WH6BlrUezLKtRUb3UCJevFT Wu3g== 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=lcTGkZi/hIZqilnvW114+9B/8IQF3FSXsc7MbYvAakQyV1fZwcXDbflwA77O4Eai9i Uk4y2a4MDKpf91nctIsXe2USmf6avJdDTBKAznbPbereYzT+JGpW2GSVHBKVGNNSoFWN ZfrOUPmj70oQfouwIkhLgKRs/t8uU9RAYyTzW/CoKvw2pct5P91o4MTmkT5q8hhh4NmL 5SfBVjNsWc8WVUtxCrvUxzs9STD4oSE4IqV0gBCtp/sZtoRgMOs/xPolGq69yKRuCgR1 /MiPqRRO73orD/FfohXBkAn8KmESED5qBs8cVEe1CPEmFUkDl+1VLNJt7wcYTXUX+zSx Duyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=XgxLUl8p; 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 u18-20020a17090341d200b0016ce3d67e7csi3990959ple.387.2022.11.18.04.28.04; Fri, 18 Nov 2022 04:28: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=XgxLUl8p; 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 S241579AbiKRM1X (ORCPT + 99 others); Fri, 18 Nov 2022 07:27:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241837AbiKRM0a (ORCPT ); Fri, 18 Nov 2022 07:26:30 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28A2699EAA for ; Fri, 18 Nov 2022 04:26:15 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id l39-20020a05600c1d2700b003cf93c8156dso3910921wms.4 for ; Fri, 18 Nov 2022 04:26:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=j23hZnphv0jcgZfiOY9qWXNDpMCFFj9PRM3bEUKGmc4=; b=XgxLUl8pt1XNL0iLDiU427YWuA+WEaiaCkEvGhMxKvHS7AzO0WGlJgFy/efbY2ozcc DOQb1IEBoBtO3VW7x+t4MJQYkrfiPsUkhRvFkGp9UAoID4XLDZR8DnoIwBtbmXRAHpOc 1oAXfiRsZyf4XuQMoOBnck65CaxmocuvADWKoZ3v+xS5uJMkpxOVxStEib7omyU7FG7X C0XU2f6TZgVvuoiBIgwqpOGHZ+qbVlVWTpDgUyO2oTqQxS4y7gMJWOMZmlX9oupLSzvj V5IED7b3gL8JPqwwin/Vx0dh/ewtVRM8QWnjapPvxRs6gVqFpNBCjdSiH9oBrQFTwi9T vmSw== 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=4qplg9rJMtWKnDzAU5lm7H+599lVqr99qr6SBi1BnWv06XKzB9Obel86ZndOab6gQ7 PoyITMywi6cGJAtkOCXqy7rbYMfaw3Kfr6FXEERnwekr13G/GZmhEhSXXFb6lqiQCuTH oG3wR8o/R5qgN1DL+nju0jOHaAbkdi+yF+eVHrAWdpLeq5YEh3/c+pnHnNXEQffeR/cu ov8LnHWBdc3gMwSbae+QhPbe/ciHr3+Bl99Xxv4ICgGB/3Yxf5G/oUBxkP3RoMrwHVD6 ZsRTQqxZriL/HdwaW+5RqOcuLbpwgIG81dHfEJXp/teLg7nOFpvo0Jhwk8T2LhGSFFws wNiQ== X-Gm-Message-State: ANoB5plgx1DsiWz+NFT6QKvr73HKosWVIcpkBJ0zOQAAw0pzJZaflVhj UvTxLvhJx+/NZNkKYNT+bhO+SQ== X-Received: by 2002:a05:600c:19d0:b0:3cf:e7b7:d87d with SMTP id u16-20020a05600c19d000b003cfe7b7d87dmr7852582wmq.95.1668774373630; Fri, 18 Nov 2022 04:26:13 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:13 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 12/15] tty: serial: provide devm_uart_add_one_port() Date: Fri, 18 Nov 2022 13:25:36 +0100 Message-Id: <20221118122539.384993-13-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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?1749836888247515323?= X-GMAIL-MSGID: =?utf-8?q?1749836888247515323?= 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 Fri Nov 18 12:25:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 22310 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp166112wrr; Fri, 18 Nov 2022 04:29:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf6D0l5GAoW3TjYSaJDoQ1uXQOP4nYMSR4rBbK9qPtKMTC3Q7bfXxMIB+sEFhbnVlAUV3pWa X-Received: by 2002:a17:90a:d581:b0:212:b43b:ffe5 with SMTP id v1-20020a17090ad58100b00212b43bffe5mr7735473pju.32.1668774540435; Fri, 18 Nov 2022 04:29:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668774540; cv=none; d=google.com; s=arc-20160816; b=PPubpk6GtWXGai9FZ65ToUpA3rm/oF8lLipm2iUWZ8YmjFm3oU/KkiQMYMQi00gOSQ lTgngx5BUBdu1Yx8336x15En5TF4DBdviPNRQtn+CkPLoFn94pNRtMIQOJ5uRspXxd1y 4TZfTPTrE54On+N2RJxFXSxGO7kPn8tqG8mocp1tThFyH4Imd9LP6RPjVBksmVIsHrtv tc3w/MfDCB4sy2YazyHNh+QVyGdYLQXvaCdkKmyS+1jW/JYUoBBdZa6aaNTiL6jZ7YiM VoFHU3KcRJYgxCSyrzl8IEShGJT9dIoj5+cKvcLWXZQ9rJgTSeCwxbDjco6McbCCl5dW pZmA== 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=Ko+jjIDfILZRTvWmBV6W3WbxjLYlDDq9YeO4lkVcz7M=; b=VJWTNFhy3VgMb9cEH80B+LdjJ2s38A0fX6RUhL4Vat/5nlJBbfZKZoWbXoBncBfhkQ QEuNJVfdSIzHNqhXeWRwfFY6Fm0NK8paRyXHeXpG4pr/eRvNkUEoPomEFMQ9nYsBUYQZ omTdEXfd6YTp0vcZQZKY1ZnAsdNLYFvYZgytTOgCucJyUPgMp4/MBoJNvmIEpNvVoXB8 7dnT3Lg0PQ5Xin6JWJp7rguLMlto/Z26MO0qirUtoqeoQJEKIGYa/4RtidkEFhrjKNkZ XqBIcu/jqJLs0H8PnHn7Cd4uXRT1g2iA8wsn7UHz8RUPbPa5/Cvd85YmGlPfZUZjlpMP n4PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=wG6BBClF; 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 w65-20020a636244000000b0046f5e5d7310si3681962pgb.828.2022.11.18.04.28.46; Fri, 18 Nov 2022 04:29:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=wG6BBClF; 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 S241899AbiKRM13 (ORCPT + 99 others); Fri, 18 Nov 2022 07:27:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241653AbiKRM0o (ORCPT ); Fri, 18 Nov 2022 07:26:44 -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 2CFF99AC90 for ; Fri, 18 Nov 2022 04:26:16 -0800 (PST) Received: by mail-wr1-x434.google.com with SMTP id g12so8983777wrs.10 for ; Fri, 18 Nov 2022 04:26:16 -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=Ko+jjIDfILZRTvWmBV6W3WbxjLYlDDq9YeO4lkVcz7M=; b=wG6BBClFrP2ZpUq0SJaBVD26AkZ5G8xLeHuWRnkPNUG3LlK+lWfYOfpgG0tc92N1uK bUTXlgbeYtc5LiKT1YUb/h911q40aey2mzMn78dr2JFvwzletg79ZcqvbOqrXqsNPsLm G2G20KJ/8PP5178vDp02V87OlmQrRXPFUZ0X4zuCszl2nNuRrM7r5jfaJ+MCW4Yr+03y NYHlmAhr7aIddmXYZzez/xrD5V2fac10Sn4OTaFyEWP1LkUWHxMAyJDb92U7QmoxelwL UXB9oa4sFaWx8nqZScC9nLt2IRbGlSv/rrH8gH+Jcb34jmw9LvrWuqIiIPgmzi0KhhBH W9Og== 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=Ko+jjIDfILZRTvWmBV6W3WbxjLYlDDq9YeO4lkVcz7M=; b=abxepKHv4o9oebDCP6ncZ8y+yj01hfG9EsVa4m0ev3dkQ1wCM/vdbmAHRYely2ovwM KP8gdQXpYMLuWQKE/wp5tct7iYQntNbf61R/p8nM5SsSA6g3zcFY+dlZfUeKmTsyjHkq FkZp5SAi38Yylg9Uc0ea8GIkrZzpD4nisUyeg3w/cdiHpz1ZOv3oICWVX+hMW3i0wiGl tcV4CvqiHkvx3xz0EVEiWl0sVfLmEGeRKUGxaGCAKExI4Sxh5HmjAEbv6tYnqLQudPM0 U1ySPSfkZ38XH4NbwV/7tj3BceEI1hTrZ2Au9tbypvmWVYECPqUB/DjIeY8ajc2A+K+a VBHA== X-Gm-Message-State: ANoB5pkWTP7Tudv0dAXKTNdjgt2lrZ4A6ice1GnnA9lPdZm9SA8fASCs s9xHpo7opg3XzONXVbyJG08QsQ== X-Received: by 2002:a5d:5685:0:b0:235:f0a6:fafd with SMTP id f5-20020a5d5685000000b00235f0a6fafdmr4232376wrv.75.1668774374613; Fri, 18 Nov 2022 04:26:14 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:14 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 13/15] tty: serial: qcom-geni-serial: use devres for uart port management Date: Fri, 18 Nov 2022 13:25:37 +0100 Message-Id: <20221118122539.384993-14-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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?1749836932833891697?= X-GMAIL-MSGID: =?utf-8?q?1749836932833891697?= 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 091b8f277a04..cdd476d504da 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -1457,7 +1457,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; @@ -1466,7 +1466,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; } @@ -1483,7 +1482,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; } } @@ -1493,12 +1491,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 Fri Nov 18 12:25:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 22306 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp165846wrr; Fri, 18 Nov 2022 04:28:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf5rcsfz/BzS543h8/AHEHzQToFeOM4V1w4YXwWER0fylr6pABrpdpznCXV25CCoUcvPLNi/ X-Received: by 2002:a17:90a:7896:b0:218:6fd6:b693 with SMTP id x22-20020a17090a789600b002186fd6b693mr7974970pjk.29.1668774500264; Fri, 18 Nov 2022 04:28:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668774500; cv=none; d=google.com; s=arc-20160816; b=nprFoFaUqzodBPSDQmbIbLildvZ0jaomm6CKmRKyBDMStEFgFsT7cQyDs1nQhdCu1F LGMYKmEAMku5YO9cablIbav6roFtOXmem8UfOEj2qstkJUjSvT6FhlVqm0zEdUel6fsm F8097N6cPSyIeFvfA9qUG2TXIuuLqhFzuGRg9jz5eO2JT3+WYmCA0wRLILRZwRxYwi/W nhn/ue18ETkiG6d07nOBAPL5tjy5ejvUVfThQAv9i+ovOZUW1yVPqKBN/bzfShiE5Vdj 6FOoe/69yZHxEDRjISZ5OjDyPl9ZypFae8iMZZ3vSBzH689H9GNTEWxq/ACKF0u2wyN3 ez5A== 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=WB27jhF4DCx/Ah98HAn4Zt+8vZMKTVFmQpCWXcHg7GM=; b=MzJiv7a6kVdGNSYt2PcTa0hw+a00Xfv6nJ0jiZR+mR5odfj+LjLoLQwqzpRE0xncyt tpkevLol/IsufG4fcS9vOpTpzXDKo8pVkGh+NGJbVerWNffkR3GNZsFwiMwKVYh8e4Zb SyM5lrphwXncjZ7sDqC7xqK57YkxG+JhUgSafuJxRNvChgyZZamFXNFlyeNd6wlfeL40 OwSy0zK0Rj9XadbjGN7zwEUbcffQNd5YkH1L34x9MnozuoiLHaMMHdvdbUI6JzrnJqnn D8QRwcNGAgOwkOpGtytmjM/8U/UCWbPJeGTHRNYtmj2WFEf8GG7gtPcyqhchY3QAPoSV rPCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b="Hv4j2/dP"; 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 z3-20020a170903018300b0017f7fffb591si4284247plg.374.2022.11.18.04.28.07; Fri, 18 Nov 2022 04:28:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b="Hv4j2/dP"; 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 S241809AbiKRM11 (ORCPT + 99 others); Fri, 18 Nov 2022 07:27:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235217AbiKRM0c (ORCPT ); Fri, 18 Nov 2022 07:26:32 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 048559AC8C for ; Fri, 18 Nov 2022 04:26:16 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id v1so8963756wrt.11 for ; Fri, 18 Nov 2022 04:26:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WB27jhF4DCx/Ah98HAn4Zt+8vZMKTVFmQpCWXcHg7GM=; b=Hv4j2/dPaM9EBDU7n724L6eQsr4DNXdBQjGvzrtzZDn429adWSeIfWvr+e7+Mjbgfp 3NqMO0rr+HQIQsWTe0RTQiVILKK9vcb549WGRP+cGKonal19zGGv1Alpm8bIh/5R+0Qx cmEgAbVp47aUAPBQ9KyV+jYDb8GBGDTlHuhjGoG2bCMdjDAQPThWMPAsyiNiQKPsXH1e ViA7Y5Os/+LZ5VG6GxXLwsooznyMtBZ6aUVhvCJkYCiN+ehm1J0ehhTMxdBOyeIUV+yE uTUeMjURKolrFZr6a24URF5pNbnymttJUzfMWu0gmdhKQndYGm2GqegJmBr9Nb+ks9/J +cvg== 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=WB27jhF4DCx/Ah98HAn4Zt+8vZMKTVFmQpCWXcHg7GM=; b=xuiO2Xi23NBzmCvvaVNY0Hnl5YIWgx9hDaHBQTsd7C0A0Pc58V7g2W4lIklmPqwbgh 7zZv8hSOmce6X7rzueCwPH6NqFYhl2hS0D8Db47sDGBdKkdH3t0uxls9HO5dB/fxo4j0 fKhD8O2DmNvXCaxEPrx060TWSkCQ50MMsorwA6aSSb81Fm7FDWy34mYSLoVmWQglBPzE lTCe2E1xdT/JxfO/iA5dWwyeMe8eG4emFp1IkAYxOqPi1VPUlnLp/XOi33vvvRoJ7VK4 aOUGbf1Lx0+Rn4PszUWtZ9IvUY0Ep6OR8t2ndsHoexfqAGHYPdNw8eZ7mDtRFyw/lFsz I+9Q== X-Gm-Message-State: ANoB5pn6Mi/GO8SpNJbNtTVD186/x2O5XNwj3da1YCtcJ867Xd+tBRLx Mr2d9iU5Pbo0HqVWMp8aknW33A== X-Received: by 2002:a5d:6a46:0:b0:241:c2d5:7407 with SMTP id t6-20020a5d6a46000000b00241c2d57407mr1285401wrw.623.1668774375543; Fri, 18 Nov 2022 04:26:15 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:15 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 14/15] soc: qcom-geni-se: add more symbol definitions Date: Fri, 18 Nov 2022 13:25:38 +0100 Message-Id: <20221118122539.384993-15-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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?1749836890173565817?= X-GMAIL-MSGID: =?utf-8?q?1749836890173565817?= 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 Fri Nov 18 12:25:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 22308 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp165895wrr; Fri, 18 Nov 2022 04:28:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf4Li6NWGyZqJxFXwD791CYxYc6iHbsU5tfkCWax4D23JUWADgfXYqbFVwBniegRZk42UBYj X-Received: by 2002:a17:902:a606:b0:17d:6603:8e45 with SMTP id u6-20020a170902a60600b0017d66038e45mr7363037plq.173.1668774507406; Fri, 18 Nov 2022 04:28:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668774507; cv=none; d=google.com; s=arc-20160816; b=JyO3KQ2zyRtiys7Sx3O5yjWRijLn9MqAwYEV64oM1v/DrngmzSlpr7ODyYsh4FuBR9 zs2qBkRA6d7Mg6DN3PrN3B6TPB6z2bl7Z/uiSJCM8rMSV2GTAm8N5S44WfFJvpHiF3B4 i8o98tjx+BxjvHzU147+57S+QdIa3hVjGRS93JonmUzEjTGkOfYLP8Xqvoym0mpOanO3 mshVEqPbMJgzxoJZgP5jlXKfPjaLgO1nhdLPKQ4+b+4Z0etQXUWiGgZsy1Px9y4QqJSt EYuOR4gniAsU2ouArz/1f9gOW3adLkiSSuMQoyU2/HCpZP4YPpf/MDm7HZno0KwKzHCg r1qg== 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=1orAtl1REjTAzqj2djLLnWo1y+H+0MlMU6NANawZJ1g=; b=UdfaJWFUkk+jl1w/vNhylgkox3/OtpE5wUYmTkXhIwtfhFDdjvuZMU0R/r8ZE8XAhu GD7sbQOXaKpt280FFasGXYLPwU+XXe923eXwfFcQYnU4AXEdBRiazUKJmD8Y2RxU/2so nRg5QJEmkvAlk9q7Gst3OD+o8iEpTPnoZR52/YKANXjqkKyY+sYUMd/LVeA4mlhQDwgi fDUiK+9eZpEFEz+x28CUVTZVRKnj4O/xO0NddMoKKSb0YiHWWC647uuowkHVLFXFIgbT AN3C5hNO2uziENa1qygh1bgEoWJ92VVn64z0xjGnNNNraOEwUghTOVnn+ENJM3TDpyaM yk4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=eIwEM+xY; 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 n3-20020a63e043000000b0046f4d395e6dsi3806782pgj.573.2022.11.18.04.28.14; Fri, 18 Nov 2022 04:28:27 -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=eIwEM+xY; 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 S241916AbiKRM1c (ORCPT + 99 others); Fri, 18 Nov 2022 07:27:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241906AbiKRM0z (ORCPT ); Fri, 18 Nov 2022 07:26:55 -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 31B9C9BA05 for ; Fri, 18 Nov 2022 04:26:18 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id m7-20020a05600c090700b003cf8a105d9eso3921238wmp.5 for ; Fri, 18 Nov 2022 04:26:18 -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=1orAtl1REjTAzqj2djLLnWo1y+H+0MlMU6NANawZJ1g=; b=eIwEM+xYrWlEW5eEK2bF4g6HOnVDA99M2iQTRSGU2AenkQzfcXr4HNSbPZhbfoldv3 Cg6nmeWe1/ni5+JAuHzEMfRa5Xnhrpo86fJlu0U4iIk3dx1e6slTqpfsmEgLv2hUZyZl 199bs9WC/fWK4jf+oZH6NMZVA6kVzMzAMhZvcJ9mLigtMMTNO40zbecX7PAfeeqDezRT ZyejbcwYgas/DE6WUbJ/HNooN/GtnPMGtjocwE4CBDuw95CvNXlbtcQXMkEZWLI0DVD7 3o7eyq2LggIFasM74yXHev8L9Xq5LFoOovlWxv6Howc0jHveHQA0ZUBDFR1y2JuK4/LX oWPg== 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=1orAtl1REjTAzqj2djLLnWo1y+H+0MlMU6NANawZJ1g=; b=lenUcBsXCH1poh8p4cA5NaUyeAMkd32qOWtfmQPcjW+vabFhnmzif0JrMSZBds4MCY CaNo107QHZSySp4jeYasDTC+rjc/DYP3j1zWcdTQrF6R7NuXxB3Bm1jB2uMEcWmLKRuy QGhpFIapLEns15cLjmWUkxTOmBef+6QfFwZ9k7Eb/heVhuV5mviieNGWMPqNLdNW9RSC kDfMc8t4SSKSbIMZfqiYKKnRL034ToCW4liiBCh1I1j0qHa9QZs99zQkl9JtHM/qB89H 5cXbhc5y8xCUUQ7CF8XPYTQzWqJiQx+UxaNnQ1ggLUfrR1jtPTeemwjFVsapoxsGPNzt MTyg== X-Gm-Message-State: ANoB5pmaUca4MOJGNZs0sfN/sbJPVfndkHXkW7uRhV2kXi0z+Hvn8mug vEiBUEtyfoyvTlipvdKpWzVjJQ== X-Received: by 2002:a05:600c:1e1a:b0:3cf:7959:d8be with SMTP id ay26-20020a05600c1e1a00b003cf7959d8bemr5005668wmb.85.1668774376541; Fri, 18 Nov 2022 04:26:16 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:16 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 15/15] tty: serial: qcom-geni-serial: add support for serial engine DMA Date: Fri, 18 Nov 2022 13:25:39 +0100 Message-Id: <20221118122539.384993-16-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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?1749836897677342745?= X-GMAIL-MSGID: =?utf-8?q?1749836897677342745?= 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 | 288 ++++++++++++++++++++++---- 1 file changed, 246 insertions(+), 42 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index cdd476d504da..700e20860af0 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; @@ -549,18 +555,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); @@ -575,7 +574,69 @@ 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 = min_t(unsigned int, xmit_size, UART_XMIT_SIZE - xmit->tail); + + 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; @@ -594,7 +655,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; @@ -620,14 +681,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; @@ -642,10 +702,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; @@ -675,7 +735,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); @@ -683,7 +743,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; @@ -691,7 +751,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); @@ -704,6 +764,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 int qcom_geni_serial_send_chunk_fifo(struct uart_port *uport, unsigned int chunk) { @@ -736,8 +891,8 @@ static int qcom_geni_serial_send_chunk_fifo(struct uart_port *uport, return tail; } -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; @@ -757,7 +912,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; } @@ -800,12 +955,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; + + xmit->tail = (xmit->tail + port->tx_remaining) & (UART_XMIT_SIZE - 1); + geni_se_tx_dma_unprep(&port->se, port->tx_dma_addr, port->tx_remaining); + uport->icount.tx += 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); + else + 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; @@ -818,10 +993,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; @@ -831,10 +1011,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++; @@ -844,8 +1020,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); @@ -915,7 +1118,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; @@ -1313,10 +1516,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, @@ -1334,9 +1537,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, @@ -1405,9 +1609,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; } @@ -1531,12 +1735,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 = {