Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp1028929rdf; Wed, 22 Nov 2023 03:57:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IEdaHPMM6KvXFPA/O90wy+HmtesqTKXfb75gSd9Wod/NpD/HZ67PLOPfItLV0ev4ChCYchK X-Received: by 2002:a05:6a00:10d1:b0:6c6:7405:1dfc with SMTP id d17-20020a056a0010d100b006c674051dfcmr1882985pfu.31.1700654229876; Wed, 22 Nov 2023 03:57:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700654229; cv=pass; d=google.com; s=arc-20160816; b=Oh7uhW5kbieN2OdBelPB3/JvtoLAQOkgdf8ScNsS5EoVmhYdSSEfur2Lk5Xbvab2Xu w4mgEaGIO1Olym5epL9V/plK6Jr3L+heER3HFHH+xm7WutFQR1+uMqa/HeIkAjZVpppV kXyUXrKkaf0n5IuEUPSAWsUdLujXZUFP20ReMl5Jba4yPirXzVJRbEWQ2UTun3Nbn/jl Mclp3tyEqi0Rmlt0WAIu79l9bqx2T/sZDNhIfSR/U72YJjo9fVS2QBDWTgkw/JqqN69g ft8gXaKWKNFMROsR8zTf23KkV6eGF1Ndh4pyztbbqvghDxsq3M1f53hgHShleRTuDBzV oQJg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=DAZq1lqs0/i5JHU3+iZ2xT/hO6JGh13xOAcVSTw8Va4=; fh=IRg3j7IoyJO86ehY2Uhn3KsJ+R20Pu6pd/++Y4nyxyo=; b=gtrjtCnEGxVcgTYwYqYW6UxPIKHdovzURg50Oejk5FJHe6TIoLWdvvwGPdAK1Zh0Fb FkZJEKvOmNi1TH/7KaMUmc3PI8xgS4JUG5DX+aqSf0yk5oys25qB0Mn9R6CTKJELjfKs VgwtXGg+4+dvjMb0Hae/Ov9TtdAkVhsAlDX+1NoNnCx0EQDrgjmj+4ogJ3COEm/lC3jA XWd0YIhslqhiGmBFl7maL81x84lizuiRNq167Ghi1/wKOhzvxhJhX/L8fYB8OjWA+E8H WKIMES35VXY5UpLVp/Br2H3k2IJv7YJvcx2dycIcLPoElALrUvTTc+3pE7begFLMcVzo tBZg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kunbus.com header.s=selector1 header.b=D8eTDCkU; arc=pass (i=1 spf=pass spfdomain=kunbus.com dkim=pass dkdomain=kunbus.com dmarc=pass fromdomain=kunbus.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=kunbus.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id a21-20020a056a000c9500b006cb686c08f4si8756297pfv.211.2023.11.22.03.57.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 03:57:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@kunbus.com header.s=selector1 header.b=D8eTDCkU; arc=pass (i=1 spf=pass spfdomain=kunbus.com dkim=pass dkdomain=kunbus.com dmarc=pass fromdomain=kunbus.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=kunbus.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 2BDAD80BA6BA; Wed, 22 Nov 2023 03:56:48 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343917AbjKVL4E (ORCPT + 99 others); Wed, 22 Nov 2023 06:56:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343577AbjKVL4A (ORCPT ); Wed, 22 Nov 2023 06:56:00 -0500 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2069.outbound.protection.outlook.com [40.107.22.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82D2E91; Wed, 22 Nov 2023 03:55:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ea5DxXu7/gjxXBfTJsc1GiiNDAVu1dtSIATgT0diITRcHQKFoaOU8MVzpnOTIxW2EcePzVuhPk9bwRUYMsNu07+tuHvp04zEi7RNdeko4Yf/rh9KL86Fy+Yn/izkIz5+EIiYqLFaFpUurOJ4kEz4XZWUc2QQhFrqXPABnETZ1ry3kmWpwNITE0MPqkvhsJ3TvgFPloLOrafe90q4zz8S8NDtVFJXhXgv2zvhiAM2VsQyL+xTBADRPbdH9J5+e4BlOl/dlYyMkZZSj/jpj+Nw71Od9kUJoQDwE4vw2ATaf/Qnw/mOPQovRa19nUe7N/jWv7HNE+5dWAxwnUHq7KjWZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DAZq1lqs0/i5JHU3+iZ2xT/hO6JGh13xOAcVSTw8Va4=; b=KNF+TU5Iw/bBU9EVXX6bxA8a6a0M1MIMaWvc39AUJhqsgYrGjIoRZsde5FH0d+F/Zmfq/q8+YONeTqRYZP7M0thZ98mdmcBzlW+s6RnBDThrM1QKn5DcJFTaRduaZjUQUFKfX8Tz2jPruPozFg9653z5t7NVC4PzFBmguxj6vTUuwJ6L8Y0qZDnsQ2/AZeZ5q2jY/sBSrxLDzsndewxIveL/KqAayfWT94QDrc0LyKmlk4Onc/N4a99rva4MlBm6aw/Tplri9ZSEjphjhq9q6wNjGHBL/TaBTnlEJIxa3mLLjkDbc9LuQtfxM8jW9ZON0rUzPUa0vztHPPxHdASF8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=kunbus.com; dmarc=pass action=none header.from=kunbus.com; dkim=pass header.d=kunbus.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kunbus.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DAZq1lqs0/i5JHU3+iZ2xT/hO6JGh13xOAcVSTw8Va4=; b=D8eTDCkUM8m297oQsylbjrxzMCXZZuqXEjwiIwi2vkybgDBjesWmoN1nFdqmG1LOUQhAwHk1lkqGzzUeNZvFRKAtFYxynpp7dIT2LFWpIzPQiX3P7jMUpGRNOqx42xV7IirsuEFOud+02+Azx4gXCtNNNrG8btMRxiVhCV5wbWw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=kunbus.com; Received: from VI1P193MB0413.EURP193.PROD.OUTLOOK.COM (2603:10a6:803:4e::14) by PAXP193MB1904.EURP193.PROD.OUTLOOK.COM (2603:10a6:102:1c8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.19; Wed, 22 Nov 2023 11:55:52 +0000 Received: from VI1P193MB0413.EURP193.PROD.OUTLOOK.COM ([fe80::653f:d0f3:e7f6:8c06]) by VI1P193MB0413.EURP193.PROD.OUTLOOK.COM ([fe80::653f:d0f3:e7f6:8c06%5]) with mapi id 15.20.7025.019; Wed, 22 Nov 2023 11:55:52 +0000 Message-ID: Date: Wed, 22 Nov 2023 12:55:49 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [RESEND PATCH v4 1/7] serial: Do not hold the port lock when setting rx-during-tx GPIO Content-Language: en-US To: Lino Sanfilippo , gregkh@linuxfoundation.org, jirislaby@kernel.org, ilpo.jarvinen@linux.intel.com Cc: 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 References: <20231119112856.11587-1-l.sanfilippo@kunbus.com> <20231119112856.11587-2-l.sanfilippo@kunbus.com> From: Lino Sanfilippo In-Reply-To: <20231119112856.11587-2-l.sanfilippo@kunbus.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR4P281CA0319.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:eb::17) To VI1P193MB0413.EURP193.PROD.OUTLOOK.COM (2603:10a6:803:4e::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1P193MB0413:EE_|PAXP193MB1904:EE_ X-MS-Office365-Filtering-Correlation-Id: 3198fe32-ef41-45c1-0acf-08dbeb51f9d6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fTcgNzWOFz6neVuyNSKqs+kvjHE3oe5fPKFls8yWPXMpMrvDBRkOcYKfCTG2DTJYO5emVLfHWJ5eGO9Q8Jlk7r+DQbcBsPYKbXnM1vsVW/vPSafbRqhQU2cbNU8AwN3hn5fC2hrlMf+QFDRVc06lr1+N+/D9473hpqAER+wFlU5YfqsP8hIYNiIPorm90q9pdwD8l6Ao+WyZBQeawIwS0EPpA5JqC8w9iUpADWPW9KiR/RSv6GFrzoGeEWfn2oKx+E2QDyJdHr+MdyYZxJC74ml2hFeU0R3mSKJKUTKPWlNH7G+qyLhRoYS7PEUV6/yVwptlZgpzO65InQ9mwcvVDkOBTWumN+f/JnBllAyMuXA5v7Bt2zmphJBQGiY/yFfWhs1BT0nrqEoeCd9OGPeAuj+xsBmdL2vUE+myrsV/x+yvhyGVwqsgr/TJXglkSS/T/+UeyM5ORsluMcE62HHovGraRWGQvWyqoYbdfganv/cHdH0AQbwzPjprKjM+mGO9Jyk7AcAxDHUSz3Wgw8xj2FRsSTaain658SeA7L0tuXniYvZnDIoD6uphWQHN31VPyKAJkLm2/OxuJQQjFIunnKPP8CPux008si6DM8fa5z6SxjoCSCnhqqOfv4JQ4noyRcJtVXAqi8YNmz94gI7c0A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1P193MB0413.EURP193.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230031)(366004)(346002)(396003)(39840400004)(136003)(376002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(2616005)(6512007)(6666004)(53546011)(52116002)(6506007)(83380400001)(478600001)(7416002)(2906002)(5660300002)(41300700001)(966005)(6486002)(4326008)(8676002)(8936002)(54906003)(66476007)(66556008)(66946007)(316002)(38100700002)(36756003)(31696002)(86362001)(31686004)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bmVUUi84ajRnSWNIWktQSEo3MUNBOWd4M1l1eEtlRkVQRDA1L3JIN1dLQy9B?= =?utf-8?B?WTY3WGI1K3Y4T2ZhTWJpZWRERi92QXAxZEtTWmN4SkNQSy81VEpMMERWazRm?= =?utf-8?B?K0RlbkhNZEMyTzR5ZUtIakM2d0hlWUYvUFZ2eHNWOTluN0JZ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2VHVSsvNGNSRWpqLzB6VWw2VWlwRUM1ZTY0SUZmMVRuT2xS?= =?utf-8?B?ZWpnTnM5aEJVRjloamFKRWRvN0hyZHcyZnVnSG8wamNGTXU2RDAwdHRwOVZk?= =?utf-8?B?LzJYTlpGcW1WbGprTjdqNHQ2YTBGaGtpaDZFZDhzbWcwNkFUbmV6dVRNbUhU?= =?utf-8?B?THMyL3hYSVNnbFVXdHBOckJYQmZRaWVwMUxrczlsYkwyTmRULzdkdVVORW4v?= =?utf-8?Q?nElebTolCb05y027JlSNR+2PlLt+s475tRaZNxx5FVyc?= X-OriginatorOrg: kunbus.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3198fe32-ef41-45c1-0acf-08dbeb51f9d6 X-MS-Exchange-CrossTenant-AuthSource: VI1P193MB0413.EURP193.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2023 11:55:52.1313 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: aaa4d814-e659-4b0a-9698-1c671f11520b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yFKH903Erm6MHz98StTZEyK1yCGHIaGpsfKunYuhlZ0EI/boCpX9/UCJ/2feEHJscf8lz1a9Sbt5rX6taa8vMQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXP193MB1904 X-Spam-Status: No, score=-0.9 required=5.0 tests=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=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Wed, 22 Nov 2023 03:56:48 -0800 (PST) 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. Regards, Lino