Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2822405rwd; Fri, 26 May 2023 11:46:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ78IzP9yhRS1ALmhgiZTd7TnCrIFnIMRfRViDmf2UwateO7etdq0Bf7+6nhZHZ5fV1K6R8b X-Received: by 2002:a05:6a20:748b:b0:10c:7a20:6dd6 with SMTP id p11-20020a056a20748b00b0010c7a206dd6mr231473pzd.42.1685126768479; Fri, 26 May 2023 11:46:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685126768; cv=none; d=google.com; s=arc-20160816; b=YggCLtfI7/XvwORdujEORwlXAwZU2/IRGpUnAwfmB24ofk8wlUS+vZAmrI5E341ET+ /SR/KjdD0ULLKi+ujSc7HWsLwPFenxzC+QHwCkzizW83mlJ6Dznoe1dgqBvpXjCQFPLa UeUUXj4BoVAfFAE0ipD7CYU7clFqAO0PrcH3yYbx31jlV6ly+GHLGo76jpLy2EI5ruVC jrvGbomkO7MILfTCrctYJrod90PJWvVnTlY3qKkn67qT20hRtJnjkFH4KuDwHBRA857a uW5DTM9EefMl8+w1Y/lH+KtUo1VrFljMUgeQn54RM3eNZiZ6N8BsiCn+YPTXdxJ1tEyi isjQ== 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:date:from; bh=6JH63bTnA5KLrs564WDZqR0aVoQZCZ/0TOtIm0wnQDI=; b=yXLJ/XEi5BFyUA1TgAQ4ny5OhtwsOX51HgdHbTFfr7cEDEmLtyN+AYkvNycJs3Zg5U rw0AiVKdYkVftRnL/eEbXTVvPjZoFXuOYLxfp85xPQgR1yatLBcw+pTDDhwIrJMK9y4Y 97vkFs+s5AEXm8XbYRelZYgfU1rEdRgIV0dtyrugwPdOGDSj6m04C6I5ukQwsy6GJK/F kJ3C3UULWcm1ajaMF3JXo02zvGZdJONr1czh1xlwmRB487oFu+odxn0cjmwJ+D5TpUK/ W2/+ap8eMm1k1WtSTORRoZYx9vWbEMpHJMHS48ml45Jy6Du7bnC/aQNUAFMKlhB1NO+L be0w== 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t191-20020a6381c8000000b0051820b42b57si4199878pgd.619.2023.05.26.11.45.54; Fri, 26 May 2023 11:46:08 -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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242921AbjEZSfI (ORCPT + 99 others); Fri, 26 May 2023 14:35:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242415AbjEZSek (ORCPT ); Fri, 26 May 2023 14:34:40 -0400 Received: from fgw20-7.mail.saunalahti.fi (fgw20-7.mail.saunalahti.fi [62.142.5.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 755C7E6D for ; Fri, 26 May 2023 11:34:32 -0700 (PDT) Received: from localhost (88-113-26-95.elisa-laajakaista.fi [88.113.26.95]) by fgw20.mail.saunalahti.fi (Halon) with ESMTP id f3177185-fbf3-11ed-b3cf-005056bd6ce9; Fri, 26 May 2023 21:34:29 +0300 (EEST) From: andy.shevchenko@gmail.com Date: Fri, 26 May 2023 21:34:29 +0300 To: Hugo Villeneuve Cc: andy.shevchenko@gmail.com, gregkh@linuxfoundation.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, jirislaby@kernel.org, jringle@gridpoint.com, tomasz.mon@camlingroup.com, l.perczak@camlintechnologies.com, linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Hugo Villeneuve Subject: Re: [PATCH v3 08/11] serial: sc16is7xx: fix regression with GPIO configuration Message-ID: References: <20230525040324.3773741-1-hugo@hugovil.com> <20230525040324.3773741-9-hugo@hugovil.com> <20230525110255.6ffe0a0c3f88ae03c3fc5f25@hugovil.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230525110255.6ffe0a0c3f88ae03c3fc5f25@hugovil.com> X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_SOFTFAIL,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thu, May 25, 2023 at 11:02:55AM -0400, Hugo Villeneuve kirjoitti: > On Thu, 25 May 2023 14:19:52 +0300 > andy.shevchenko@gmail.com wrote: > > Thu, May 25, 2023 at 12:03:22AM -0400, Hugo Villeneuve kirjoitti: ... > > I'm wondering if we can avoid adding new ifdefferies... > > I am simply following waht was already done in the existing driver. > > Are you suggesting that we need to remove all these #defines? If not, what > exactly do you suggest? I was wondering and have nothing to suggest here. It seems a burden we have to cope with for now. > > > + s->gpio_configured = devtype->nr_gpio; > > > > The name of the variable is a bit vague WRT its content. > > Shouldn't be as simple as the rvalue, i.e. s->nr_gpio? > > Maybe the name could be improved (and/or comments). > > devtype->nr_gpio is the maximum "theoretical" number of GPIOs supported by > the chip. > > s->gpio_configured is the number of GPIOs that are configured or requested > according to the presence (or not) of the modem-control-line-ports property. > > I wanted to avoid using the same name to avoid potential confusion. > > Maybe devtype->nr_gpio could be renamed to devtype->nr_gpio_max and > s->gpio_configured to s->nr_gpio_requested or s->nr_gpio_configured? Maybe, but first try the approach with valid mask being involved. It may be that we won't need this variable at all. ... > > > + of_property_for_each_u32(dev->of_node, "nxp,modem-control-line-ports", > > > + prop, p, u) > > > > The driver so far is agnostic to property provider. Please keep it that way, > > i.e. no of_ APIs. > > The driver, before my patches, was already using the exact same function > of_property_for_each_u32() to process the irda-mode-ports property, so I > don't understand your comment. This is unfortunate. I missed that one, but i don't care about IrDA so much. > But what do you suggest instead of of_property_for_each_u32()? And do we need > to change it also for processing the irda-mode-ports property? device_property_read_u32_array(). Independently on the IrDA case, this one is more important and would have consequences if we avoid agnostic APIs. ... > > > + if (u < devtype->nr_uart) { > > > > Hmm... What other can it be? > > Again, this is similar to the handling of the irda-mode-ports property. > > But I am not sure I understand your question/concern? > > I think this check is important, because if someone puts the following > property in a DT: > > nxp,modem-control-line-ports = <0 1>; > > but the variant only supports 1 port, then the check is usefull, no? But you have below checks for u value. Wouldn't be enough? > > > + /* Use GPIO lines as modem control lines */ > > > + if (u == 0) > > > + val |= SC16IS7XX_IOCONTROL_MODEM_A_BIT; > > > + else if (u == 1) > > > + val |= SC16IS7XX_IOCONTROL_MODEM_B_BIT; > > > + -- With Best Regards, Andy Shevchenko