From patchwork Thu Sep 28 22:12:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 146415 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp3776258vqu; Thu, 28 Sep 2023 21:32:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGDEWBT58TmazR+2Cu5AtcyAk9GZYieabMMyfn6WdotpN2RF1QfZmNCdJxnDmPt8oIjeH1+ X-Received: by 2002:a17:90b:390d:b0:269:621e:a673 with SMTP id ob13-20020a17090b390d00b00269621ea673mr3006577pjb.1.1695961969121; Thu, 28 Sep 2023 21:32:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695961969; cv=none; d=google.com; s=arc-20160816; b=IRjVFH8eQTJB8NLfQEyc7Sowgl41NoZlRAXvfgjCI+cgMcLQVo1t+rA+5GGqHMSxtI 8arKGUhMTUrUqyYem/Rmau5H5ueGMKH6s8W3GRB6HOa++tREPDOZnC5FLqMLNobQfSh1 B+aqaQh/KXXTaonH1JPRwmwaIQjk9HkUc2BiS6VFd0nuCEVEaXPdqL4PZeoRCx5cyM5V 9UYTvMywDwAoaOXxCr3a7gjFk1p9u96NN5AUVZec/EbNdf9a9AZjcVhoo6kbDY6RuX4P BztByI5PEL9XIVDzAB7E2uhP6bwCIAOOt52//HCNlul1Es6wdSVDBtnX4U1vRVjFXIz1 12sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vJJdIPiNBx++tj9zJ3xfwS+JCLsCH3aBQui0XXS7z1o=; fh=SRJym8t1gs6ROJtIUNhOjWeP7E9fpzxhK4sMUQMqITs=; b=tunuX/CaTGw12aTZI0209tYQ5uLRgaevwXEmK8NTTDEP/VswxkwcfXObxLJ3Wx6r9v klC0f+Ajqu/82rsKIbc5pybhhhFCQMvAvGqOi3xkAQR3MxbEYgADo4Ql8grHKM35gorn YeDVyoOB5VQ4z47TTUgru0eHsGR417wt2XK65yF2BdfrBH/+ufBEHdQ9vaYRQIjbq0gv xCB1PF99iNiLPmIKnMLdArtNhIiTvdSB1SuuhAPgBrEYSjLLWxE8k8O2aQMXnM2fHucw jAO/zEVZnI3P5iqEPmhjJ0YuMmAijNG3X1zrfZyfTvPnQ9acKWgzVi1fBBfL3v64iBv0 yaSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=ucN9AKNM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id nk13-20020a17090b194d00b0027460ba24bfsi740450pjb.65.2023.09.28.21.32.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 21:32:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=ucN9AKNM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id CF5FD8718290; Thu, 28 Sep 2023 15:14:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232649AbjI1WOF (ORCPT + 21 others); Thu, 28 Sep 2023 18:14:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232566AbjI1WNx (ORCPT ); Thu, 28 Sep 2023 18:13:53 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20C4F199; Thu, 28 Sep 2023 15:13:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1695939213; x=1696544013; i=linosanfilippo@gmx.de; bh=vJJdIPiNBx++tj9zJ3xfwS+JCLsCH3aBQui0XXS7z1o=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=ucN9AKNMnNjgF0t/G/lNHGfY+LK1qfKnY83u1TXeWTRQwfnn2F7A+hSl8/Mtlv7qVAKjpkzbwnX J27DI96ZfVigm+YEK9umV1V/4ZYip72tywJU0QBNZB3ysZBhUyQqKZZoQqOcNDU3ErLrED+ggy8XC kw7aS0UVBNpi5M4jsv+wupz4yNDIMjwCAaskNeK6/el8GVnqiO4kNHPoOXhgiWdqzxdubiVgKI+xG Z6pKInF5CCOvaQ9BT4HDnVWuukIliUwFGFYzjpQrc3VWoNW1PR7EDFTIi0pKaan7MHqjmvaGrgFpm nyrdgiOvlOckpKYGXIsuF7qOmWDYiymASnTg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from Venus.speedport.ip ([84.162.21.41]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1McH9i-1rM8tF0x2a-00chIk; Fri, 29 Sep 2023 00:13:33 +0200 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, ilpo.jarvinen@linux.intel.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, l.sanfilippo@kunbus.com, LinoSanfilippo@gmx.de, lukas@wunner.de, p.rosenberger@kunbus.com Subject: [PATCH 2/6] serial: amba-pl011: get rid of useless wrapper pl011_get_rs485_mode() Date: Fri, 29 Sep 2023 00:12:42 +0200 Message-Id: <20230928221246.13689-3-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230928221246.13689-1-LinoSanfilippo@gmx.de> References: <20230928221246.13689-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:TpkKxtXsopZfiZUjpfsnzwKy/vXCM/Vs66OTnR8QnnHg11UC+ib /MXS/+n/r22VAEVPGicWkJpbejyF738VjNbNvsbUpmsGtcPE76CjoQcmIEbIr6shjNLK+ob 4kGco/DFP1HQxSC+ufkSTUeJD03TateVj312C0d9kGDjZWe/dC1+DCAI8pTTCJ6l+y9Jxla ijflsV4IFSiaRI4Cpgc3w== UI-OutboundReport: notjunk:1;M01:P0:g+IXyWx4S0s=;eXmYRB6me9QdFv/wdAED6xvpjP8 dWkkwOhhDhLlJubZMPVAGOUCzcijhC/0YmCiJRFxrOtxuc8FFCqDppHfkEF3d8SDlPCrDp84b juLlg3lhaySRX6P1cVVkQcNrBZMjECQ/MHCHmdt4zjR6RHbTBp7NBYfxL2vMcDEUofFuv/pPX FKUiGj71j/V7/BScIi85DOe5uX/vHyGTwt0fthwyFmZhxQVOmOXxs8lLv0ly7IX/0I5mTd3Ha mfpS5048peoCglxkxbXhsg3slVPyy6XPuobJcrWXvfU3m8jxwK4FsMYckYfT1yl8FpUaPG87u IY9/870PJ44PvTvPpIHDx36swSJobLMWquZUUDYxscNRB/ODhKGafF3T3kBGTTn8o90COzK49 D7zeMvjr4+paDpjbRaOMFhgVcGW6tqmcI4Cg+TUoqJKhhQxD25I12zzEwLSSDoXdiu5uLf0ML PPXrLq35UPKYHCccC7HHNi6mRF+rIqAuGJjaQHnUNYkYjrDv1Kn6EtMfE5qsCoYNZWVk3zEQN SRHH9282Wcv7WvFsYSsu7uaMW4d6MLJEEqcwd4KUktnGIvIN3OpRguLEduZESjCoFFwEmaj1M WvSfMkAcUjisKKr7zGNHsZK9WMW/wWkIvAmgiX888wYW/yjcKMWgZJRROewv1EcsxXrPAsHNo yEfk4XSuhztfBLPMzybfusEzXVR9hs3HQCjtrK3jAB2aXL0erwVZBWRtVu+008PrNQsXv3cx9 CrzOMWWx8E1m5zWLbh+YU3QkF7uRc0ovihCJhcP0b3HJZy8uLymy4H+4xPFGtFZpAVv5yBLKi 0Ac3RC9gV0TH+exyDVeuDyXVAxSf9NhToSJknwE3SdO4EgRmcFNiwHrRg0yj1VclK/PCOKkY2 iMAxrcoK/Kc7+qUCG+TQ6JxNjIzjOye/t5IN+8lQmTvIX4dgiJjUXYE9QPGquWKMGFJmWxXHH ehMKJQ== X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,MIME_BASE64_TEXT, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 28 Sep 2023 15:14:16 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778325001545537751 X-GMAIL-MSGID: 1778345017413718347 From: Lino Sanfilippo Due to earlier code changes function pl011_get_rs485_mode() is now merely a wrapper for uart_get_rs485_mode() which does not add any further functionality. So remove it and instead call uart_get_rs485_mode() directly. Signed-off-by: Lino Sanfilippo --- drivers/tty/serial/amba-pl011.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 3dc9b0fcab1c..70b44f3e9eb7 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2716,18 +2716,6 @@ static int pl011_find_free_port(void) return -EBUSY; } -static int pl011_get_rs485_mode(struct uart_amba_port *uap) -{ - struct uart_port *port = &uap->port; - int ret; - - ret = uart_get_rs485_mode(port); - if (ret) - return ret; - - return 0; -} - static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, struct resource *mmiobase, int index) { @@ -2748,7 +2736,7 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, uap->port.flags = UPF_BOOT_AUTOCONF; uap->port.line = index; - ret = pl011_get_rs485_mode(uap); + ret = uart_get_rs485_mode(&uap->port); if (ret) return ret; From patchwork Thu Sep 28 22:12:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 146360 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp3676425vqu; Thu, 28 Sep 2023 16:57:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFw1E2g3Mq7UgcMDdKeSrsYdo1lJbFzEOklYGVmd6QglzO4z1us93yyUoUCpMfP5k3gy4ic X-Received: by 2002:a05:6808:d49:b0:3a7:26fd:b229 with SMTP id w9-20020a0568080d4900b003a726fdb229mr2582419oik.48.1695945425820; Thu, 28 Sep 2023 16:57:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695945425; cv=none; d=google.com; s=arc-20160816; b=wM2aaet4YwriSnFG9MuDyp/B5dm2/fjPYUpjCcKYO3DPJy/sudfbta5yw2Zae3PHXE pnRawLJEB7AAsWtz1ZHx0kH9cYoxb8QZAfaMZMTFRFbrLt4uI8kN6ehJrhrS6IHvfpRo h8FzXCezFMG8C6nY5TivWHINnUq/FpDXhNCdAr9d2YJGmDCdKa6GMiZ+gTO59JXGkwt8 RvXo/c2ExJI6tWGydkXj3LVq00SBpc6A0zazNJjHakL+BY87tja1AMnDSq87IufFhufM H6B4gyyKIVisLSO9PGQttnb4b2PA3IRFzuvkq86fk5fvkBk/0SgLrs8OKeYuzBJFs4/9 hHIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mLPlHXBVRwexjH0Cj387VLbBgxjGGRTQWXTD7dFXyMo=; fh=SKJaSS2M7npxXGrfckcylXltvqohHYqDZnbS6Cca1co=; b=EA3yX5wwqRpmWId7tLDFIfoesWHRdBP/JsB0x+qEfXIuKO1F7OHepQXbGByrwysWai KPtsegt99nzKfQ1EX+I8R8YwRPfeqO35Yr7+i01kMaJZlMmBFkExv4og+ZNU+1SIbCDU yvE038KEvjVeFCOmuKBgyEbyiH4mw3Wgfq0+sb7pgPZKO8+fQ8DVOVi+VVDvFNZ4H1uf pSayl5tcwB98hXlD+vHUJBO2V6rz5bA83BEVnDl+vvcf3Eq6vuEa4ZvnDP4EzPLii2hh 10S3pcL5XX9kePoCV88kGb/d7DpRMsy5QSvVVc//FxJUmLwYSst1pNF4nCAeHR5L1m8j yfqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=KQLdbtXK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id y127-20020a62ce85000000b00690f22edc20si18652516pfg.333.2023.09.28.16.57.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 16:57:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=KQLdbtXK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 8809E84AB819; Thu, 28 Sep 2023 15:14:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232647AbjI1WOC (ORCPT + 21 others); Thu, 28 Sep 2023 18:14:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232552AbjI1WNw (ORCPT ); Thu, 28 Sep 2023 18:13:52 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B0CA1A2; Thu, 28 Sep 2023 15:13:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1695939214; x=1696544014; i=linosanfilippo@gmx.de; bh=mLPlHXBVRwexjH0Cj387VLbBgxjGGRTQWXTD7dFXyMo=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=KQLdbtXKMqmvGK1Ic+BlRFgjsdhtMa+SeK206YXzV9aLWtvVG3MwcYgjKoUQbdH/5H+HEPQ/98h 1f1UIEEaRq5EDiw6QmnAWVRBvcQx68gSlSmUTr/UkFn0TcTKQULUDGuMPzXKglAf0dLIKKvUdQHDF lXFnkYn/j4gO3Fitg9FsTeqgd9n41FEoFphuA1tv9qHepmeadFE/N6F1Fe0Z3j2cnRwIEKtQprXWs 6ZG9jcFkQoEylmIWrz5ceHC8/f0HNyM96VfoJZ0Hu9h2jSCpuXAKuJ6O0qPjNZn34ICO116qDw5xu p7of6bPxWU+UB7SWibAFzsQrMnbBFOCVIIvg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from Venus.speedport.ip ([84.162.21.41]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mr9Fs-1rOqb53LEM-00oBVU; Fri, 29 Sep 2023 00:13:33 +0200 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, ilpo.jarvinen@linux.intel.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, l.sanfilippo@kunbus.com, LinoSanfilippo@gmx.de, lukas@wunner.de, p.rosenberger@kunbus.com, stable@vger.kernel.org Subject: [PATCH 4/6] serial: core: fix sanitizing check for RTS settings Date: Fri, 29 Sep 2023 00:12:44 +0200 Message-Id: <20230928221246.13689-5-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230928221246.13689-1-LinoSanfilippo@gmx.de> References: <20230928221246.13689-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:q5g0/t22Us9cn/lBgY6QmJyAiEQaNgtDtxjK+YvBOStqaS2nDfQ zMcTJuIMThPdRFuVaW1gtGcUHYDcWQvKrpC6sbHrpdTc/V83oLE6S/gf+SZ0WT8FwTubJLA AK73xikeMQpfk/RPyTmOERBOOoOQ2mVVMRJMrA3y9kR1A2XLWdNRW+68nf0BpeantrkOKqd HzcieTLxxlfeczVfyRNjQ== UI-OutboundReport: notjunk:1;M01:P0:bWWTFd2uhgo=;AAkMwugWAP0QngTop9gN+mtLifq oyiuk799766XqgO1K4PbKk23jcF3B5UPyv7QojPxbW84dCERYBzE82tpJ2XRNJOQTiq33W6uP Kx4lAHLq9tSkIDhtZI1xZINRU/aUpmv3x0kv8cp+zWk1BZeAQqfb58pFZm/h2h4SDCVObX/xO NCEw/yQjvvsLFuGV4ggzxESWWrLboDBgfdRmzeu1iMSzZaXNJcWSFv+3o7VldANvdjCkCBPq/ IWdbDI/zo8tQHvUaSkeARUL69JhN5kD7+ePl7gf8lullnbfeFZtwai07MJv5sKWqH780ZnXSj v0bQ3TUEKZVU7EH4g3Z19bMO49QcV+hdKI934bbjfJbuhv/1lbUgVLD/uTSMLHkiv+U7kbq/E pBF56nWaK+So+UhfZnf8KsRCqFYHdKG7boemqTncZZaJ7v1cqC/fhmjb3xS1DB5/dEn4W6pwy icTY2jlHJokKpaw7JX222AdC5uvyf1dPGXrrrSep0JsmQGU1ltFfcmH10I1KsOT6/hrNZetpR IxGm/3w5odmbxEJw+SVJwFsFAaz/NRodQdT4aTtG+mK/+g+ydEdYu4ojdNw4kq++SBW9tl4Z8 E2avaKu6wq1+mIrQjzjXTtsGodmjX2fOcEFOI5kbLMzD2mDLDAznVWq8YyfjK0LNGMD1wMlwe j5EJsUxowU9Q1r8UEtFKDIIgpUfnmtv8uSIVQUvHnTucjg/nfwF5WW2yEjLf5+TXbQ+XhIVK0 waMoQgJUB4KhvgCfJfxxhpk+D8JfZer+Bff0qEatMvwwxqVggY+SsGwTjaYbi2msKxl/dxZeR QzrM55e/IgDbEDWL5hQysiHe5Aet7imB+qyAFBQvMDTN1VV0wXCaCC1i3U/syBRf7PQI846UW lPMzRTeKhKDg+mmdMrQQk+A0oKcKcBifty4FS3PtRc4Pg8Dv9oRWNBDLIj0KmW6CKcvuNDfwV irpBEA== X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MIME_BASE64_TEXT, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 28 Sep 2023 15:14:25 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778327670752467495 X-GMAIL-MSGID: 1778327670752467495 From: Lino Sanfilippo Among other things uart_sanitize_serial_rs485() tests the sanity of the RTS settings in a RS485 configuration that has been passed by userspace. If RTS-on-send and RTS-after-send are both set or unset the configuration is adjusted and RTS-after-send is disabled and RTS-on-send enabled. This however makes only sense if both RTS modes are actually supported by the driver. With commit be2e2cb1d281 ("serial: Sanitize rs485_struct") the code does take the driver support into account but only checks if one of both RTS modes are supported. This may lead to the errorneous result of RTS-on-send being set even if only RTS-after-send is supported. Fix this by changing the implemented logic: First clear all unsupported flags in the RS485 configuration, then adjust an invalid RTS setting by taking into account which RTS mode is supported. Cc: stable@vger.kernel.org Fixes: be2e2cb1d281 ("serial: Sanitize rs485_struct") Signed-off-by: Lino Sanfilippo --- drivers/tty/serial/serial_core.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 697c36dc7ec8..f4feebf8200f 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -1370,19 +1370,27 @@ static void uart_sanitize_serial_rs485(struct uart_port *port, struct serial_rs4 return; } + rs485->flags &= supported_flags; + /* Pick sane settings if the user hasn't */ - if ((supported_flags & (SER_RS485_RTS_ON_SEND|SER_RS485_RTS_AFTER_SEND)) && - !(rs485->flags & SER_RS485_RTS_ON_SEND) == + if (!(rs485->flags & SER_RS485_RTS_ON_SEND) == !(rs485->flags & SER_RS485_RTS_AFTER_SEND)) { - dev_warn_ratelimited(port->dev, - "%s (%d): invalid RTS setting, using RTS_ON_SEND instead\n", - port->name, port->line); - rs485->flags |= SER_RS485_RTS_ON_SEND; - rs485->flags &= ~SER_RS485_RTS_AFTER_SEND; - supported_flags |= SER_RS485_RTS_ON_SEND|SER_RS485_RTS_AFTER_SEND; - } + if (supported_flags & SER_RS485_RTS_ON_SEND) { + rs485->flags |= SER_RS485_RTS_ON_SEND; + rs485->flags &= ~SER_RS485_RTS_AFTER_SEND; - rs485->flags &= supported_flags; + dev_warn_ratelimited(port->dev, + "%s (%d): invalid RTS setting, using RTS_ON_SEND instead\n", + port->name, port->line); + } else { + rs485->flags |= SER_RS485_RTS_AFTER_SEND; + rs485->flags &= ~SER_RS485_RTS_ON_SEND; + + dev_warn_ratelimited(port->dev, + "%s (%d): invalid RTS setting, using RTS_AFTER_SEND instead\n", + port->name, port->line); + } + } uart_sanitize_serial_rs485_delays(port, rs485); From patchwork Thu Sep 28 22:12:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 146349 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp3664040vqu; Thu, 28 Sep 2023 16:25:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFFMVT6tPbJykdNzPXtx3MVnp5AMSV1Zk3VTIeL/YxLI6jTk1bnNLE2dfkswcD0mk+uiFVo X-Received: by 2002:a17:902:cec7:b0:1bc:1e17:6d70 with SMTP id d7-20020a170902cec700b001bc1e176d70mr4640676plg.24.1695943502213; Thu, 28 Sep 2023 16:25:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695943502; cv=none; d=google.com; s=arc-20160816; b=t0WirquVjetT/GeDVNhwU8xcxJpbVXjeWcj5UnXqS0wmlGbUEklaEGaKyfhLn+iPrY /UPHwAbtpNATRzuqwVM5wWnsCZT7W0CzS2NptF+GlfGzm2C6DKaU+uNO5g5r3/m0HxPx SMeZUEKRwvYdrZSuoEIch6Fs1C+pKAJT6tsnaMV+BxyDdlcDY8rLrVoZMe2QSzLomn/P 6trsn1Sfps6WxQIr36kXSaRpUg3YEZKWD/W0cEdbDlWrFGIdyzxsna+/X2onUTIg5SU6 Z7Rns0D7ThPAUg4Niwu64pyMFQOW3sKigLJUI6D1KR87+m3r0GQonzbzfjbAxueu3ZVh PM3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hg8w75pV0e3pjbzQLJFWM+TM+iujlrT3Ta4nBCXoDzs=; fh=SKJaSS2M7npxXGrfckcylXltvqohHYqDZnbS6Cca1co=; b=lpNAKgnyi0KowkTeEGX/d2fMOPkIXmHNmwIy/uRQxdNSfcHvbdn6RDh2hPjJIRekTg AiwOT0x89ZDAms0Ad5aXDG//kSQhoekYAdzMhKnuoV6KXzAY076gYhrkjNqYpsDQraXf wqwZ8CkXb58B5nwp6ub04nnW9W60cvVuHeayaliDSTMofC96bX2jVsV3ghFmJvrryJn2 SZhvrCiuOfKb+aVsdpcGj9N0vEqPoegh0cVO8YI0Bc9dc7o9EkSwPVQvaEaPI5xyxPuE T9H51/s5sjWZegDR74+zeZcntAeIaehzkfKjPrMshsRKrC1wfGdvWN+Dt72S3aecMFzr 2nBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=im686yKF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id x9-20020a170902ec8900b001bf0b29d935si15367841plg.34.2023.09.28.16.25.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 16:25:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=im686yKF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id CF21082F7FB7; Thu, 28 Sep 2023 15:14:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232651AbjI1WOI (ORCPT + 21 others); Thu, 28 Sep 2023 18:14:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232570AbjI1WNx (ORCPT ); Thu, 28 Sep 2023 18:13:53 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53DA91A3; Thu, 28 Sep 2023 15:13:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1695939214; x=1696544014; i=linosanfilippo@gmx.de; bh=hg8w75pV0e3pjbzQLJFWM+TM+iujlrT3Ta4nBCXoDzs=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=im686yKF1Pr+8T9GT14YLKy2cCDauXeY+iT4ymje2THJJk7u9j7Uge8hyl3oEPMXJcAauQXmX91 AFDdVBb+GoRvcxTu/8Z+/sZWdYpJAuDUDLs8l3ZvEraTB25HeE+c2zKZpF16a+M8o002ZDwgXpKF7 nD3wPOHaLK+Y77jsEUGDMtf1hyrplNC9fCPi5ZmogKhgyzM+OG8C+CvHJjqWRd4EwiPuFDsmYp5Pv an0H6Og+HttTsjmC2b5ZvdzO5ffeXi3N5gRW7bTNwoo307Yvze2UNCOeFZDOPialnUFOSH0v8ZtV4 dgX33wM8Hq/ad5/AQUZ3Th2972O37BdVsZqA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from Venus.speedport.ip ([84.162.21.41]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mi2Jn-1rGM8d0T8j-00e39X; Fri, 29 Sep 2023 00:13:34 +0200 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, ilpo.jarvinen@linux.intel.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, l.sanfilippo@kunbus.com, LinoSanfilippo@gmx.de, lukas@wunner.de, p.rosenberger@kunbus.com, stable@vger.kernel.org Subject: [PATCH 5/6] serial: core: make sure RS485 is cannot be enabled when it is not supported Date: Fri, 29 Sep 2023 00:12:45 +0200 Message-Id: <20230928221246.13689-6-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230928221246.13689-1-LinoSanfilippo@gmx.de> References: <20230928221246.13689-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:Od3l4xl/uII61q4WCOzbzrdpV4WzfRrpfpwW+63udSex6TYzbGi Yxm3kzO8B0/p69CY6IbF6VIwdpcOC33Yh2uLfiUs2hUzzB+NvbzOW9K2YruY4zacovT56Qp wL/RFiJJTxVqsTJyhS/Yoo3m+FZdjOkPZDyRzr8yEqSw7cWa5e5YcWFsyzcAe3qXgQ3pum4 pHQH9QaYtUL+pSUgFKF2Q== UI-OutboundReport: notjunk:1;M01:P0:RERU25vI7eg=;t4JI+TeEd/T7kk73bmESiZA6A3d e+nOfxVI8YqeYeQsHbIdBiVKShltFe6hCz0O3OHfJUgXga3s/L/1+YxP2bLkHWLgUmG/OT1mS 85HokF0MpWKcS1GPpiR5M9N/RwrKRtcWomL73hBQrIldlsLPCqH1hVpi7EI4Ty2kvzszI4frv RMic0di7sMBEKE/eZCC253W2uYY2438RJUUt5LOC13TqXEWWiuJdNEIvfC/HklzfBnQjuBokM a2nhL8W1DWZWAy/dPzKx7gHIP1XoT5ErCk6Ko+MgNRPiOqHHVrlKAapbTM2iAMO5HmeBHnEQx /jVqJfUan0e9tCw6ZYyfU67qrJu02q8E8x7D2JlwT7IB9h8dN6F7aRamWD8VWgD/0zjTa0LUG Bjs3XcSdH8btnkAkkrzZuVW7vGQH0AiN/QPkATOhmC8jNwX0NDxqgME0wN4v+NX38w4nrTg87 oyuwiZxDz1Cm0OlTRN1yfChU2qhpZ1H3BPtbQa4N64U/VXO6KHuDqExNpc+3Yig2pW9VZVN6c 7YCHKmPLq1Ptitz8p4S+4S2zY8IR0MAGcwB4uXG6PqIP9i3fFaxF7PqRdGSQuZrV/WRH/wNeZ zkhChi6kImrBx1ca/O1Sr4k2dUQpS0cLinZELGozGoG84xw+RpGncvtNhA5nqlIAl6YFu6kdY FUhi4JyEUY8GP79ZBl5xoD32lMEu8xrxvYfAHPgZ37dR06CT5nDCiciui79BEatfS4dL2gmdS m5X/UEkJzAbJiqumPWeHL4IHArpH6xpU3PsFUAyWo+LvmfLGU5WYj6MH0PNEGTI75OR01Gmel ncbbCyKwiEUjJsXhjAmpX/H589Sh6U3p8ucbCmxNT3yvVKmPH5jTCbVZ2kPmQP9Q0Gd6aKlV+ cC7Og39gUqsA3fr810DFj5a0P/vahgn67Q1dsAS3amoamgoi+/mQI3V66s+Qk0IC6m2Y6hUTg oxM+XA== X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,MIME_BASE64_TEXT, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 28 Sep 2023 15:14:18 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778325653407771455 X-GMAIL-MSGID: 1778325653407771455 From: Lino Sanfilippo Some uart drivers specify a rs485_config() function and then decide later to disable RS485 support for some reason (e.g. imx and ar933). In these cases userspace may be able to activate RS485 via TIOCSRS485 nevertheless, since in uart_set_rs485_config() an existing rs485_config() function indicates that RS485 is supported. Make sure that this is not longer possible by checking the uarts rs485_supported.flags instead and bailing out if SER_RS485_ENABLED is not set. Furthermore instead of returning an empty structure return -ENOTTY if the RS485 configuration is requested via TIOCGRS485 but RS485 is not supported. Cc: stable@vger.kernel.org Signed-off-by: Lino Sanfilippo --- drivers/tty/serial/serial_core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index f4feebf8200f..dca09877fabc 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -1432,6 +1432,9 @@ static int uart_get_rs485_config(struct uart_port *port, unsigned long flags; struct serial_rs485 aux; + if (!(port->rs485_supported.flags & SER_RS485_ENABLED)) + return -ENOTTY; + spin_lock_irqsave(&port->lock, flags); aux = port->rs485; spin_unlock_irqrestore(&port->lock, flags); @@ -1449,7 +1452,7 @@ static int uart_set_rs485_config(struct tty_struct *tty, struct uart_port *port, int ret; unsigned long flags; - if (!port->rs485_config) + if (!(port->rs485_supported.flags & SER_RS485_ENABLED)) return -ENOTTY; if (copy_from_user(&rs485, rs485_user, sizeof(*rs485_user)))