Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2158502iof; Tue, 7 Jun 2022 21:42:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZuk2zjk0nWE+6fybv/OzhLYAd7xNdhyG6PGm30IcUM8w0Qcwz3ihseAAE6v9j4grkZgpG X-Received: by 2002:a17:90b:3806:b0:1e2:adc5:d192 with SMTP id mq6-20020a17090b380600b001e2adc5d192mr35917001pjb.223.1654663348547; Tue, 07 Jun 2022 21:42:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654663348; cv=none; d=google.com; s=arc-20160816; b=t1inDUDwklqGNvBsksfF+TNp9d4oZauh9K5a9PPReeqOsatOWhOYnbUfebYR7b7TbU xzIulu0f5evcmSGM2GA2rVlfDGIS0Sb+JdBnKZrmXF8fmAIjPGJAmtcUPJV+jjBt7WRg NYxINla9ho9qNmNjuVhvYKCvUZ9KfsL8m75qbvcoTbrG9fCqzd0Discjh7wsV837AcFt vZthGCA/RD+b8GEpbe+AljQ12BS6SE00BlSfW3etI0In42zerR/hOhvZIvHTnKxYhffq cWCbCmIgrC0RcWv734VjkCBF5fg+6Ywcks6quRdj1gMnbCkxwuG+ENbGqOtSUT6t9zvk YqPg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XmNJQJmpLdzsryPE/PXl8UYkxm/HYtSK8EbA98b/REI=; b=dV0rRs5/yfcyfQV8EGVnzI7ogkzsE+wPGHC8ovIvz1ZiuEW/G83WBSqXBkJsfI7r+z Q08HHOJt+ZSWGyussM1YnGzzf8P0KO8fjCyVNVbA8SDAamB1gdYfUogk1PrXJkAmouFM MhrIH35O8Z9diDAVtgAMELXft+IX5rPFGlAOSfuqN7hBjG9SZf03KNetgcOO8eXg5/jk UhMYvT0hSzmJul03GJmyX1v29bHsWhze8ItzuuBktgzRQLU2MHc3roz0ZSgf4UYUhVDL Z4R+L8jbU+iocjO2sPqwzugtBrM2mYljxGSk5ZIVU+uxeaO3rSUk9anu4cLwjcmw2GMQ sGQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ot1tANJ1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q13-20020a632a0d000000b003fcaa41c494si25402684pgq.175.2022.06.07.21.42.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:42:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ot1tANJ1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E70331DBBC6; Tue, 7 Jun 2022 21:12:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356621AbiFGWH3 (ORCPT + 99 others); Tue, 7 Jun 2022 18:07:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378784AbiFGVBt (ORCPT ); Tue, 7 Jun 2022 17:01:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2B9120ED4A; Tue, 7 Jun 2022 11:45:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 72C32B81FE1; Tue, 7 Jun 2022 18:45:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC305C385A2; Tue, 7 Jun 2022 18:45:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627535; bh=/nt2azIDU63waHlYWHq5Z5MohAVPxSo0yJVmg3AdC48=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ot1tANJ1Wsn5zbTEfXM5NttQ9KsdlgnnXLpA3bTpc0AhgylxbJ09AqD50jYawKoAv 6mbn/y//zQPMjV7/nf2cwzaUjEirGLPOtCziwXN2XeBQ17IEQmAe8M6O986Sov1Lwr dR6U7+VTMbZ62l1oXtIrVWVyhpohMy6JCqAOJYcs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiri Slaby Subject: [PATCH 5.17 737/772] serial: pch: dont overwrite xmit->buf[0] by x_char Date: Tue, 7 Jun 2022 19:05:29 +0200 Message-Id: <20220607165010.754152605@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164948.980838585@linuxfoundation.org> References: <20220607164948.980838585@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 From: Jiri Slaby commit d9f3af4fbb1d955bbaf872d9e76502f6e3e803cb upstream. When x_char is to be sent, the TX path overwrites whatever is in the circular buffer at offset 0 with x_char and sends it using pch_uart_hal_write(). I don't understand how this was supposed to work if xmit->buf[0] already contained some character. It must have been lost. Remove this whole pop_tx_x() concept and do the work directly in the callers. (Without printing anything using dev_dbg().) Cc: Fixes: 3c6a483275f4 (Serial: EG20T: add PCH_UART driver) Signed-off-by: Jiri Slaby Link: https://lore.kernel.org/r/20220503080808.28332-1-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/pch_uart.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c @@ -624,22 +624,6 @@ static int push_rx(struct eg20t_port *pr return 0; } -static int pop_tx_x(struct eg20t_port *priv, unsigned char *buf) -{ - int ret = 0; - struct uart_port *port = &priv->port; - - if (port->x_char) { - dev_dbg(priv->port.dev, "%s:X character send %02x (%lu)\n", - __func__, port->x_char, jiffies); - buf[0] = port->x_char; - port->x_char = 0; - ret = 1; - } - - return ret; -} - static int dma_push_rx(struct eg20t_port *priv, int size) { int room; @@ -889,9 +873,10 @@ static unsigned int handle_tx(struct eg2 fifo_size = max(priv->fifo_size, 1); tx_empty = 1; - if (pop_tx_x(priv, xmit->buf)) { - pch_uart_hal_write(priv, xmit->buf, 1); + if (port->x_char) { + pch_uart_hal_write(priv, &port->x_char, 1); port->icount.tx++; + port->x_char = 0; tx_empty = 0; fifo_size--; } @@ -946,9 +931,11 @@ static unsigned int dma_handle_tx(struct } fifo_size = max(priv->fifo_size, 1); - if (pop_tx_x(priv, xmit->buf)) { - pch_uart_hal_write(priv, xmit->buf, 1); + + if (port->x_char) { + pch_uart_hal_write(priv, &port->x_char, 1); port->icount.tx++; + port->x_char = 0; fifo_size--; }