Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1585021iog; Sat, 25 Jun 2022 13:27:17 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u4Y/Ba5R6+5R6VVQBmNBggiZ1NORBmnHjwcLCbRXsKcFfDyDnFWMABJhZ33mxh+UuRg9S6 X-Received: by 2002:a17:906:11d:b0:712:abf:3210 with SMTP id 29-20020a170906011d00b007120abf3210mr5372048eje.292.1656188836973; Sat, 25 Jun 2022 13:27:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656188836; cv=none; d=google.com; s=arc-20160816; b=yjVuTADRH2zR8UpW2si8+MvEjhODBRuYMM1YTdjrSQq8XZRSTmL2jPPn77U9bqImI2 I9xgSIfKc7sQ7hfU3vbK7NRRaPBi74XcNTmAcUzfDkFO8tf4D5SV/npbExblTnnJRE62 F67E+ZOCkQ+PrCtdeneojOFYy29JNCPVClN0NIDHaRyl8cUWlFsfQ2NfIs7YSRE/FfhY i0r1P1RSiuQ32QTF93+rJQa5G8Wou7UCAYRezZtPDIz3ao26Cp5VdFiAhQgNmsV4ERWU FbOgOXnRVOOL2h+WibcZwRdK6wwJ8wluCPhVc25ZMIAoF1BSfqsU/jBzMswEkwp9BUIT J+PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=I8lZ28zcLuSJNEVmfDn/y2ZZC5GpKm+0mY7/qRJnSys=; b=rHL3vEFfq34ClVXEoBTHbHuBL7O9kSyfn9VrUeo0lrR1k1yPMS1aJEw3EQJLDMZ1go sCbioZA0bdD2cKrokBWmZOwA+ZmuZN3peY2YjbMZr5Y+ILqzboeN1+xPgKBkMgWWHbNm jQdzTpMqKLKzuCMirW1sWNE3syqUcf/JR7hNcHOBCwO0ItQig+n31Qt46eiCJku/64JE vz9Pl37eNRmvaS5Ar8dwJ7w3iDWcbRr5Bf8pZN78rHI1vELIN7OMHvL2ERRbLAo1FNWS Zd7wXIvqS3LAYcqr44l9N6tkutWEXC2+kYQIcjQVBezGf8jLAaT7QDNG49S+A34yBzAs zCMw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p7-20020a170906498700b0072677faec75si2571945eju.872.2022.06.25.13.26.50; Sat, 25 Jun 2022 13:27:16 -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; 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 S233600AbiFYUMi (ORCPT + 99 others); Sat, 25 Jun 2022 16:12:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233306AbiFYUMh (ORCPT ); Sat, 25 Jun 2022 16:12:37 -0400 Received: from bmailout1.hostsharing.net (bmailout1.hostsharing.net [IPv6:2a01:37:1000::53df:5f64:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5177713EB5; Sat, 25 Jun 2022 13:12:35 -0700 (PDT) Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL TLS DV RSA Mixed SHA256 2020 CA-1" (verified OK)) by bmailout1.hostsharing.net (Postfix) with ESMTPS id 46C2330000CCE; Sat, 25 Jun 2022 22:12:32 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 37F854CF4D3; Sat, 25 Jun 2022 22:12:32 +0200 (CEST) Date: Sat, 25 Jun 2022 22:12:32 +0200 From: Lukas Wunner To: Ilpo =?iso-8859-1?Q?J=E4rvinen?= Cc: linux-serial@vger.kernel.org, Greg KH , Jiri Slaby , linux-kernel@vger.kernel.org, Lino Sanfilippo Subject: Re: [PATCH 22/36] serial: Sanitize rs485_struct Message-ID: <20220625201232.GA17597@wunner.de> References: <20220606100433.13793-1-ilpo.jarvinen@linux.intel.com> <20220606100433.13793-23-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220606100433.13793-23-ilpo.jarvinen@linux.intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE, 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 Mon, Jun 06, 2022 at 01:04:19PM +0300, Ilpo J?rvinen wrote: > - if (rs485->delay_rts_before_send > RS485_MAX_RTS_DELAY) { > + if (!port->rs485_supported->delay_rts_before_send) { > + if (rs485->delay_rts_before_send) { > + dev_warn_ratelimited(port->dev, > + "%s (%d): RTS delay before sending not supported\n", > + port->name, port->line); > + } > + rs485->delay_rts_before_send = 0; > + } else if (rs485->delay_rts_before_send > RS485_MAX_RTS_DELAY) { > rs485->delay_rts_before_send = RS485_MAX_RTS_DELAY; > dev_warn_ratelimited(port->dev, > "%s (%d): RTS delay before sending clamped to %u ms\n", > port->name, port->line, rs485->delay_rts_before_send); > } This series seems to set rs485_supported->delay_rts_before_send to 1 in all drivers to indicate that a delay is supported. It would probably be smarter to define it as a maximum, i.e. drivers declare the supported maximum delay in their rs485_supported struct and the core can use that to clamp the value. Initially, all drivers may use RS485_MAX_RTS_DELAY. Some chips only support specific delays (multiples of the UART clock or baud clock). We can amend their drivers later according to their capabilities. Thanks, Lukas