Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp495029rdh; Thu, 23 Nov 2023 09:23:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IHrCHn9c0UDCgxgpV34lw+Qs0j3v1+IhDOvOI/TRTZUxcUe7UTKBNgTSpaYm/QcJxOpuEOf X-Received: by 2002:a05:6808:14c6:b0:3b2:f500:c1e5 with SMTP id f6-20020a05680814c600b003b2f500c1e5mr37824oiw.29.1700760212246; Thu, 23 Nov 2023 09:23:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700760212; cv=none; d=google.com; s=arc-20160816; b=wJPwHX7OCPje6P/ijRqJq7fp333sWnnjyJ6K31/7xGqg8NTcgFQ68p9l6hvZGHT5nc 7OczdfZeQl7VQuZHft18VRs+9N078I8PjX6/qjNpe1t++WDnGeXokyg6/2JTJzSfSTjC HqttQLn9wESoywCMn1YdvAqBo4aCFxxGT4PvRFvj1VAA5VtzYaamTzuBxOTpQ4LO7k7l ITQSEDYLx7hnL/3c76FgSGr+bxtNlIfJ9D3z1ItYaNPRAXRxulVHX1kjkH1i0pskACcq TUWdWl/Y2Wpp5hpCmPKrWrldRa0gvQzUWLCYrL4Oe/Z4NGkRKHqryBXuMXvnNQk4qgTS sSQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BriXBW0/IbDq/+PaPbv13bNKcvn4sPDApPDJM0klof4=; fh=fKyGnbNp4T4mmiLARJ80k9bdTlGvbdO5Amwmv7orhJY=; b=ks9xu6umMlIr18eDp/NO4LCaR3CoZHtF5WnU2Hz3RaiZc20O/aQqnI+tLdXxJg2zM4 RE76Vpih4yV9fGuXP0hF0j40E7mOQLoBPIk/xiYAmU5FkAjkaPQs16uT7OUoVGpyz/M9 qFnIUgneI+4h6nyTRLdYVXGq+Aw9NXaFii0ZFDb09y2B8qG/VTAtYYIruynjHe/DiFVE aBCuEC22wZQwu0Y7p303jeAKOstfk4cDgkzFM6/+YE4IPDVPcN4rZXVKOo0myUNtGxVF uh3n5TQBpWOqA7MXQlRIKbDoIHLOkTlOGB+AZO9MFewj98EAS7U4Ma/Ya9DqRB+3aznD u1ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ARnpA8sM; 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=linuxfoundation.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id h6-20020a635746000000b005855f67e490si1666085pgm.690.2023.11.23.09.23.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 09:23:32 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=ARnpA8sM; 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=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 590A1806B040; Thu, 23 Nov 2023 09:23:29 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345733AbjKWRXG (ORCPT + 99 others); Thu, 23 Nov 2023 12:23:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345722AbjKWRW5 (ORCPT ); Thu, 23 Nov 2023 12:22:57 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61900A1 for ; Thu, 23 Nov 2023 09:22:59 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80025C433CB; Thu, 23 Nov 2023 17:22:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1700760179; bh=XJ7kY1GciSBN8ZVxLG7wgVhOwuwldl8TrXxYyhxZJk4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ARnpA8sMQbZuhIT+Z/k4mFB5iiosqNIbRQs/7slljkiTk/VdyZ10RTaFGTBpww0MQ 2zlYhndKiGi8LNsfvLqVuSPqF7k8jy8XciAE7KzwE3KTr2tCC88rO/3MJxqeNINiWj Wsmj7MiYWZb38lteGIZjFpGaTdD0PN4n4Ktro2zw= Date: Thu, 23 Nov 2023 14:17:52 +0000 From: Greg KH To: Lino Sanfilippo Cc: jirislaby@kernel.org, ilpo.jarvinen@linux.intel.com, u.kleine-koenig@pengutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, cniedermaier@dh-electronics.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, lukas@wunner.de, p.rosenberger@kunbus.com, stable@vger.kernel.org, Rasmus Villemoes , Hugo Villeneuve Subject: Re: [RESEND PATCH v4 1/7] serial: Do not hold the port lock when setting rx-during-tx GPIO Message-ID: <2023112304-cornbread-coping-cdce@gregkh> References: <20231119112856.11587-1-l.sanfilippo@kunbus.com> <20231119112856.11587-2-l.sanfilippo@kunbus.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=0.1 required=5.0 tests=DATE_IN_PAST_03_06, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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, 23 Nov 2023 09:23:29 -0800 (PST) On Wed, Nov 22, 2023 at 12:55:49PM +0100, Lino Sanfilippo wrote: > > > On 19.11.23 12:28, Lino Sanfilippo wrote: > > Both the imx and stm32 driver set the rx-during-tx GPIO in rs485_config(). > > Since this function is called with the port lock held, this can be an > > problem in case that setting the GPIO line can sleep (e.g. if a GPIO > > expander is used which is connected via SPI or I2C). > > > > Avoid this issue by moving the GPIO setting outside of the port lock into > > the serial core and thus making it a generic feature. > > > > Since both setting the term and the rx-during-tx GPIO is done at the same > > code place, move it into a common function. > > > - const struct serial_rs485 *rs485) > > +/* > > + * Set optional RS485 GPIOs for bus termination and data reception during > > + * transmission. These GPIOs are controlled by the serial core independently > > + * from the UART driver. > > + */ > > +static void uart_set_rs485_gpios(struct uart_port *port, > > + const struct serial_rs485 *rs485) > > { > > if (!(rs485->flags & SER_RS485_ENABLED)) > > return; > > > > gpiod_set_value_cansleep(port->rs485_term_gpio, > > !!(rs485->flags & SER_RS485_TERMINATE_BUS)); > > + gpiod_set_value_cansleep(port->rs485_rx_during_tx_gpio, > > + !!(rs485->flags & SER_RS485_RX_DURING_TX)); > > } > > > > Rasmus is about to add support for another RS485 related GPIO (see > https://lore.kernel.org/all/20231120151056.148450-3-linux@rasmusvillemoes.dk/ ) > which has to be configured both before and after port->rs485_config(). This > does not fit very well with the idea of handling all these GPIOs in > one function. > > So I would like to revise this patch and send an updated version in a v5 > of this series in which the suggestion from Hugo > (see https://lore.kernel.org/all/20231011183656.5111ba32ec0c9d43171662a1@hugovil.com/) > is implemented to use separate functions for the GPIO configurations. > I'll drop this, thanks for letting me know. There are WAY too many different "enable 485 in this way" patches that are all conflicting with each other. Can you all decide on a common way to handle this, otherwise none of these are going to be acceptable :( thanks, greg k-h