Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2152391iog; Sun, 26 Jun 2022 08:02:40 -0700 (PDT) X-Google-Smtp-Source: AGRyM1stFLrGVmufnPdFzv7l8JKTwtOxvTcuRoqgYyvwCQG+dEx4e75v5bi61MeBzne6aaYm+Em7 X-Received: by 2002:a05:6a00:1592:b0:525:52ca:bee6 with SMTP id u18-20020a056a00159200b0052552cabee6mr9886899pfk.38.1656255759951; Sun, 26 Jun 2022 08:02:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656255759; cv=none; d=google.com; s=arc-20160816; b=CbC4qmS1CcgbgVetHyZex9WNElpTLf3sAcezU3jfgchKkWRhnInu8X/S646G8eNBMM WB+tDATtYqcsHVJtedft+0VAiqS2iN1royBmerGXi/VIIyS1LiTkK01Pp755bcw3GKsj +zJhsO84utCOVFNPY8ALtUKNsRbyIzrXiG2F91RGSe/97IZL2zPwKMst/mq7Q7gbnzLA rzHkgfwdtboJXxrmHTR6ODRVXgAY4giQW7hfqoIQS3IDSQUgZh5s/gFt7G8Iek32v0Hv k90FjjmCYPqEAASJy/z5NxwgdMS2F/BTJqr/pcmmr60Xt0YpCfUo0rc/qF9HWzco1s9G V2qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=OHEY1vlPV8w385jbNs8LY7dyB9oRAbPtqaTMNQPzQY0=; b=NFwTSncm9j6ej3MKQoTzx91GP0gHQozLm4E5luElq+w8N3tUVi1zTA/w98kMIc1ZwS 76pzRzz3acj3HhNlfFr0qwFp176F6uDpltLEu6NKSKPv6vjk0dWeaWnKeJc5uKCI0UmM prVnXcf65adAIDw04PnTPLn5HyytnTK0qh5VmWPrtFm7TR1omO+85hNYx07g3zkUV86J SFFOp++kWHF8sOlJV/4YzEgXZiagW2ap7qqyFuIN2NW/yvYJb7uqUdJYqVoK7zlMzXKn RJb8aZEm6ok2oWJPgg/d5BlXOx8JBvbYX5gTOLTGw0CxaAqKZSuxHKLXZwWBeqxEnJiy serA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=iDpI0X4c; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l29-20020a63ba5d000000b0040d0df8f12dsi5275664pgu.646.2022.06.26.08.02.27; Sun, 26 Jun 2022 08:02:39 -0700 (PDT) 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=@gmx.net header.s=badeba3b8450 header.b=iDpI0X4c; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231754AbiFZOZ3 (ORCPT + 99 others); Sun, 26 Jun 2022 10:25:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229550AbiFZOZ2 (ORCPT ); Sun, 26 Jun 2022 10:25:28 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBE18DFE2; Sun, 26 Jun 2022 07:25:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1656253505; bh=V2zLP+Q6I1/UFW3ZsVkjipSTGPK6qygTlMrwpvwc3qs=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=iDpI0X4c4EvjZ8K4GQRqgIdqOp/HEbZhDDbDSXNyk5rgbHJNgHI337HQOKD9sJ1Cx thZ6DBVg63qnXqKrKyQCpUggIIEThbzsD/2YrlcafB78FOnUVJfsNkIXkpQWsnFd0X 81sHAwsAOHozynaJVDbEWzKWn9RT1Z/8FJwcnG8c= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.0.33] ([46.223.2.248]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MacOQ-1nUknr1To2-00cDcr; Sun, 26 Jun 2022 16:25:05 +0200 Subject: Re: [PATCH 4/8] serial: core: sanitize RS485 delays read from device tree To: =?UTF-8?Q?Ilpo_J=c3=a4rvinen?= Cc: Greg Kroah-Hartman , Jiri Slaby , robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, Andy Shevchenko , vz@mleia.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-serial , LKML , lukas@wunner.de, p.rosenberger@kunbus.com, Lino Sanfilippo References: <20220622154659.8710-1-LinoSanfilippo@gmx.de> <20220622154659.8710-5-LinoSanfilippo@gmx.de> <5d406271-3290-f321-5984-bbc1f9a3bd96@linux.intel.com> From: Lino Sanfilippo Message-ID: <5f4f4750-95c1-fb39-fefc-dbd2cd51e4a7@gmx.de> Date: Sun, 26 Jun 2022 16:25:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <5d406271-3290-f321-5984-bbc1f9a3bd96@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:Yktu9u31aqAs7jhThOJR32JZKvmscc7SXjC6uQl83fXmjNX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W/Y2fHbu/Udhq5k6UPrfmot/RvYs0imOe7JBgSxTt2eJ5Hik+aO9uPi NQmqDyGuFFN4qB8sBy3KLBoflRgfZQeCSndiAg1L/AAy8ss6z8saRhU3jxeQK29l90yUSFh1R hv+D45VhabFJfOQTO/ek6LTIfrQ8m/xq9lU7ceWIV4lOjlIXuHoIrkjTwGu1Kkz08QNG5kYXC 7HXk6ewfowZeB9f5fnSWlPGWasI+my6ZadFmEK4BqbXVQQ7ICUYJPkcHXBTwHVIJNl/jy0PEa h9ss6mjMXq6oQ+R7spVx0iWQz4LsNHwkKEUTNBVqsoa+4ZiOaLc24kaJg== X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On 25.06.22 at 12:05, Ilpo J=C3=A4rvinen wrote: > On Wed, 22 Jun 2022, Lino Sanfilippo wrote: > >> From: Lino Sanfilippo >> >> When setting the RS485 configuration from userspace via TIOCSRS485 the >> delays are clamped to 100ms. Make this consistent with the values passe= d >> in by means of device tree parameters. >> >> Signed-off-by: Lino Sanfilippo >> --- >> drivers/tty/serial/serial_core.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/seri= al_core.c >> index fa6acadd7d0c..2e9f90e73e62 100644 >> --- a/drivers/tty/serial/serial_core.c >> +++ b/drivers/tty/serial/serial_core.c >> @@ -3382,6 +3382,8 @@ int uart_get_rs485_mode(struct uart_port *port) >> rs485conf->delay_rts_after_send =3D 0; >> } >> >> + uart_sanitize_serial_rs485_delays(port, rs485conf); >> + >> /* >> * Clear full-duplex and enabled flags, set RTS polarity to active hi= gh >> * to get to a defined state with the following properties: >> -- >> 2.36.1 > > While above works, if we go to this change user-visible behavior route, > uart_get_rs485_mode() could just call full uart_sanitize_serial_rs485()? As it is now uart_sanitize_serial_rs485() will clear the entire serial_rs4= 85 struct and return immediately if rs485-enabled-at-boot-time (and thus SER_RS485_ENABL= ED) is not set. That was one of the reasons I moved the delay checks into an o= wn fucntion. The other reason is that the remaining sanity check for RTS on send/after send in ua= rt_sanitize_serial_rs485() is not required in uart_get_rs485_mode() since here we already ensure a sane sett= ing. Regards, Lino