From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4737AC43334 for ; Thu, 23 Jun 2022 09:46:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231313AbiFWJqv (ORCPT ); Thu, 23 Jun 2022 05:46:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229937AbiFWJql (ORCPT ); Thu, 23 Jun 2022 05:46:41 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C424949927; Thu, 23 Jun 2022 02:46:39 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id h23so39814731ejj.12; Thu, 23 Jun 2022 02:46:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CqZHI78qt9lumbdFWlSiHgcuuijsjPdVdWVBLjHodmk=; b=D38lj8H8nJhIo9qkx/MnZ8wJ1AkNoxYBlHUbMF4zwGLQsc73QZg/eYrvqbxfYv64R1 CdXo/2hZprxh0OmqHz63eiVupNkiL4+XXEbcnbk80c7Ovxq+15xb8CTuxVygBkRKOUrn aAba6DsefOi2kHghmRTRYRas8PHUyxqlGxAqfGnmVwOuUg/iBJE70Y3jnebaneuPwRIQ UPutxElfQgar0VmZVnbY6MNeF+wvaMI5vK6qMogMGyzDDlah/j5RuEfM7Fv95zoEX9Vw 6RhssvO9KLptXYbzKnUbonEPYK82iRuJ5b8ienIAqEk03TyQJR6UUwsJRMLDmclvDWbV PFaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CqZHI78qt9lumbdFWlSiHgcuuijsjPdVdWVBLjHodmk=; b=1p/R2+muDh1qgmwioYpFL+jDgcdTfC/XMO4J+1wZ8PICg+kIcBNWR+HYnoAyF4CChb YyT673YRGysYM8KbclFMlz8rM8mdKIFw8sezvnUi1o38ghhl3FJ8MYzf1TGe4yql4jX0 uN7NtEDSte1kQjKEOdhCHj5uLiv0gHliA+xnQT2na0nEWvuhNk0UyRMtRNXVhFXq+Jho a2ITMocXChcLIlSfWdY5TKzq4ZeNmYuO/FzMqbJ54n9cLIFv3gbUoB5rqO/stM38Tkr9 NEmuQF0VYVxmyfSSkne9pD1vytPr50b5y7/xrQ3OkYgbh+OoGH2I7hT5BkXWYpW9oPqe 2QQg== X-Gm-Message-State: AJIora9Q8Q2AGcCYnreocRN1G1qWTGaHLOVM0Gech1ljUR7FEWdoT/sL GVtHgSH3SmFVyxYQ0y6MZDjgcUYAw91e+PKtXbk= X-Google-Smtp-Source: AGRyM1tcdDytx3LsBRh8vBYNujZdlq64fb8nbca2bDlIhtR7BJ/rWehDXJzpfzQCwCnDrzBHegri9ri9odY7E19Xv+w= X-Received: by 2002:a17:906:434f:b0:711:eb76:c320 with SMTP id z15-20020a170906434f00b00711eb76c320mr7344946ejm.636.1655977598189; Thu, 23 Jun 2022 02:46:38 -0700 (PDT) MIME-Version: 1.0 References: <20220622154659.8710-1-LinoSanfilippo@gmx.de> <20220622154659.8710-2-LinoSanfilippo@gmx.de> <2dda5707-6f13-6d33-863d-a88b89e88a88@gmx.de> In-Reply-To: <2dda5707-6f13-6d33-863d-a88b89e88a88@gmx.de> From: Andy Shevchenko Date: Thu, 23 Jun 2022 11:45:57 +0200 Message-ID: Subject: Re: [PATCH 1/8] serial: core: only get RS485 termination gpio if supported To: Lino Sanfilippo Cc: Andy Shevchenko , Greg Kroah-Hartman , Jiri Slaby , =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , Rob Herring , Krzysztof Kozlowski , Vladimir Zapolskiy , linux-arm Mailing List , devicetree , "open list:SERIAL DRIVERS" , Linux Kernel Mailing List , Lukas Wunner , p.rosenberger@kunbus.com, Lino Sanfilippo Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 23, 2022 at 4:00 AM Lino Sanfilippo wrote: > On 22.06.22 at 19:04, Andy Shevchenko wrote: > > On Wed, Jun 22, 2022 at 05:46:52PM +0200, Lino Sanfilippo wrote: > >> From: Lino Sanfilippo > >> > >> In uart_get_rs485_mode() only try to get a termination GPIO if RS485 bus > >> termination is supported by the driver. > > > > I'm not sure I got the usefulness of this change. > > We request GPIO line as optional, so if one is defined it in the DT/ACPI, then > > they probably want to (opportunistically) have it> > > > > With your change it's possible to have a DTS where GPIO line defined in a > > broken way and user won't ever know about it, if they are using platforms > > without termination support. > > This behavior is not introduced with this patch, also in the current code the driver > wont inform the user if it does not make use erroneous defined termination GPIO. It does. If a previously stale GPIO resource may have deferred a probe and hence one may debug why the driver is not working, after this change one may put a stale GPIO resource into DT/ACPI and have nothing in the result. Meaning the change relaxes validation which I consider is not good. > This patch at least prevents the driver from allocating and holding a GPIO descriptor across > the drivers lifetime that will never be used. But it's not your issue, if DTS defines it, so the platform has an idea about its usage. > Furthermore it simplifies the code in patch 2 when we want to set the GPIO, since we can > skip the check whether or not the termination GPIO is supported by the driver. That's fine. -- With Best Regards, Andy Shevchenko From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E67D6C433EF for ; Thu, 23 Jun 2022 09:47:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3ze/tj1EMYZzHgqms30vuyVoJrVXDXcHT0XjVej1GFE=; b=tZ1JAHGKIUN5GR tk0SxgaaHkRvUQwhTE0nh+dUukSu79uqhhtn5WqVfPOljGNiLeHTFiU5TTZ773U4OE1zqXnAXhKqy FqFC7KbnGSmcbqtdK1rZrBbI0udyl4hfZAJ4jnxFcogeRvZ3QH0XgfE6Nt+7Smg9tblb8qpMewiog LQlLDgxJBxnvdYBVUnX5IM0hB0gdtZMtJSMbUv2JSIuM/VzTDdy8Ygh0BJrQnM+T8h1QlBwfbngUT YCrZGiLFdg8ZwCMRFadFCbo+qw2sofIQzSF/Ik4ZZWUydxgNb0Zxhf7lonYeWdseMEEwFO1i0d8qo OgG3t9CYnpW5jFkfSBaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o4JQG-00ENLx-N5; Thu, 23 Jun 2022 09:46:48 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o4JQA-00ENKL-Vu for linux-arm-kernel@lists.infradead.org; Thu, 23 Jun 2022 09:46:47 +0000 Received: by mail-ej1-x62f.google.com with SMTP id sb34so10799219ejc.11 for ; Thu, 23 Jun 2022 02:46:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CqZHI78qt9lumbdFWlSiHgcuuijsjPdVdWVBLjHodmk=; b=D38lj8H8nJhIo9qkx/MnZ8wJ1AkNoxYBlHUbMF4zwGLQsc73QZg/eYrvqbxfYv64R1 CdXo/2hZprxh0OmqHz63eiVupNkiL4+XXEbcnbk80c7Ovxq+15xb8CTuxVygBkRKOUrn aAba6DsefOi2kHghmRTRYRas8PHUyxqlGxAqfGnmVwOuUg/iBJE70Y3jnebaneuPwRIQ UPutxElfQgar0VmZVnbY6MNeF+wvaMI5vK6qMogMGyzDDlah/j5RuEfM7Fv95zoEX9Vw 6RhssvO9KLptXYbzKnUbonEPYK82iRuJ5b8ienIAqEk03TyQJR6UUwsJRMLDmclvDWbV PFaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CqZHI78qt9lumbdFWlSiHgcuuijsjPdVdWVBLjHodmk=; b=dsccWQDz4EajYIpqRVBTlSHBMGw96uw9UfYxIIUtQem7lr8w/hRoKoqIZN2ubT0bAL gOYcs1CorwraEnT0UkpX+6AjeFayuMxKe0xFqZJTZQmiFzlPwojwKk+pbqnr4rkOsAX3 QbIpB7ZCOZBpZHF16pkUzMfGGNmNOGu4+44T3p2+eVr5ssQtpxB3LpPvfEtHZtDwAWij UfrRQHJQIoblr3TGWOS9b5hmTsK+OboGGjSBeFN15Y0ZIfAjGOK1ZVZDVsK4DqnjMA4u y+92c6RhCvAsiZABQ9sH6VxD4sS8HTTxw3Pwn+5bzPp7R8LLMUB+He3+DtbzZasxsXV6 i5XQ== X-Gm-Message-State: AJIora+HEfYiSiZS/Ei2HEGUZ/ANAnXzbbuatF09s5vqk3HgFQS4Pr6M v3oxNzcJ60OZU0AoDjokX2hnwhpwfgx7p0V2WiA= X-Google-Smtp-Source: AGRyM1tcdDytx3LsBRh8vBYNujZdlq64fb8nbca2bDlIhtR7BJ/rWehDXJzpfzQCwCnDrzBHegri9ri9odY7E19Xv+w= X-Received: by 2002:a17:906:434f:b0:711:eb76:c320 with SMTP id z15-20020a170906434f00b00711eb76c320mr7344946ejm.636.1655977598189; Thu, 23 Jun 2022 02:46:38 -0700 (PDT) MIME-Version: 1.0 References: <20220622154659.8710-1-LinoSanfilippo@gmx.de> <20220622154659.8710-2-LinoSanfilippo@gmx.de> <2dda5707-6f13-6d33-863d-a88b89e88a88@gmx.de> In-Reply-To: <2dda5707-6f13-6d33-863d-a88b89e88a88@gmx.de> From: Andy Shevchenko Date: Thu, 23 Jun 2022 11:45:57 +0200 Message-ID: Subject: Re: [PATCH 1/8] serial: core: only get RS485 termination gpio if supported To: Lino Sanfilippo Cc: Andy Shevchenko , Greg Kroah-Hartman , Jiri Slaby , =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , Rob Herring , Krzysztof Kozlowski , Vladimir Zapolskiy , linux-arm Mailing List , devicetree , "open list:SERIAL DRIVERS" , Linux Kernel Mailing List , Lukas Wunner , p.rosenberger@kunbus.com, Lino Sanfilippo X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220623_024643_082477_8A23F7A3 X-CRM114-Status: GOOD ( 28.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jun 23, 2022 at 4:00 AM Lino Sanfilippo wrote: > On 22.06.22 at 19:04, Andy Shevchenko wrote: > > On Wed, Jun 22, 2022 at 05:46:52PM +0200, Lino Sanfilippo wrote: > >> From: Lino Sanfilippo > >> > >> In uart_get_rs485_mode() only try to get a termination GPIO if RS485 bus > >> termination is supported by the driver. > > > > I'm not sure I got the usefulness of this change. > > We request GPIO line as optional, so if one is defined it in the DT/ACPI, then > > they probably want to (opportunistically) have it> > > > > With your change it's possible to have a DTS where GPIO line defined in a > > broken way and user won't ever know about it, if they are using platforms > > without termination support. > > This behavior is not introduced with this patch, also in the current code the driver > wont inform the user if it does not make use erroneous defined termination GPIO. It does. If a previously stale GPIO resource may have deferred a probe and hence one may debug why the driver is not working, after this change one may put a stale GPIO resource into DT/ACPI and have nothing in the result. Meaning the change relaxes validation which I consider is not good. > This patch at least prevents the driver from allocating and holding a GPIO descriptor across > the drivers lifetime that will never be used. But it's not your issue, if DTS defines it, so the platform has an idea about its usage. > Furthermore it simplifies the code in patch 2 when we want to set the GPIO, since we can > skip the check whether or not the termination GPIO is supported by the driver. That's fine. -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel