Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1623894rwd; Wed, 31 May 2023 17:10:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4z0rWUt/lf+zb3oA9WcpIcsFEHuHJwrPpipW6CV2QazUT6ciS95Ug9RaYbGO7MMjdIcP7q X-Received: by 2002:a05:6a20:a39f:b0:10b:5abf:6f0d with SMTP id w31-20020a056a20a39f00b0010b5abf6f0dmr5600824pzk.40.1685578209426; Wed, 31 May 2023 17:10:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685578209; cv=none; d=google.com; s=arc-20160816; b=moEEV+FvBQEIJ5Iq+x0gTS12tn9KZydApWDZLJJfWY9qiXEd0mQm+MtPVO607UQkRx mFVYBXqo+L+FQaCLqNkikTh0ik0aIbmYZG3L89zbyQpmiyz5a1eftvRyjolcDrIIUfzG jt7fuIcR7DITFSA7tSimNJPmjmB1nnNil731iC2SDUfr5UA+Z42SHLxx+lJT6V42sX/s Y2IAxxgEf1OGrnsciAeRxXn2Bc0tVtUTJ4DmMOd4yq7qzKzfyHDCD5HYJw4g0iVhMqD+ A808PEt0RnPw6wqIiO4aSLoY4f4ujQa03ggaxXsOGNWrBsAuzaZN6zjx5YRG++6wKmbW 8HhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:cc:to:from:date:dkim-signature; bh=Y9DD1VKb4vaExY2foglvuHGof5QOUeerkLNIvVZGDEQ=; b=YqENpigh/vWrmTPdBEZePMJHzf0O7c7+caBkn0R3bORB+g+zEMSHPbGuVf98f3jLsH lJMaNAZaEKtcx3XOTQFYxPzy1uW/yjx8qtavZLlmVIk2dQ0Nz+Kubj699Y2krtbYfz/x 8vDkkZw/wuZQt9Sk4O5JoPEiXZlFaXzfghKofrT3MxlBmeXEFdwQInPzFLjdGcaaLODl /JlzwebDa1uwzlEFA3EEQEBdmPrPFAqBIpEaIhs/zJHuskJ6adqFNaj1k4/3P22JD6cx hLBADK43VH8CCAo2R9Ahbteso/Xx8OTydNPJaS/xQXMXj+NU/w+hX6a8CQsSXNRN9JXK Yszw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hugovil.com header.s=x header.b="vvnO4y1/"; 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 y63-20020a638a42000000b005349316e59bsi1803866pgd.751.2023.05.31.17.09.55; Wed, 31 May 2023 17:10:09 -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; dkim=fail header.i=@hugovil.com header.s=x header.b="vvnO4y1/"; 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 S229795AbjEaX5o (ORCPT + 99 others); Wed, 31 May 2023 19:57:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbjEaX5m (ORCPT ); Wed, 31 May 2023 19:57:42 -0400 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D924E12F; Wed, 31 May 2023 16:57:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:Content-Type:Mime-Version: References:In-Reply-To:Message-Id:Cc:To:From:Date:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Y9DD1VKb4vaExY2foglvuHGof5QOUeerkLNIvVZGDEQ=; b=vvnO4y1/YdmDbe57+wazCVR5zN feiztkittz+w93Cd9Epmz/7MBfMJu4mDj3ODNRMY+8POmBVIzR1QCyqmjnEHxy55+X6oAafyy5pHh B3WpJU43jmEN7Z/B7HfAXfOkRbU1IIM8/Y48BqoMOIh7atKhjC15cM/r+ByMzooqa08Y=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:42554 helo=pettiford) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1q4Vgx-0007Zs-JL; Wed, 31 May 2023 19:57:24 -0400 Date: Wed, 31 May 2023 19:57:23 -0400 From: Hugo Villeneuve To: Andy Shevchenko Cc: gregkh@linuxfoundation.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, jirislaby@kernel.org, jringle@gridpoint.com, l.perczak@camlintechnologies.com, tomasz.mon@camlingroup.com, linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Hugo Villeneuve Message-Id: <20230531195723.462b140ac041b790711c1a7f@hugovil.com> In-Reply-To: References: <20230529140711.896830-1-hugo@hugovil.com> <20230529140711.896830-8-hugo@hugovil.com> <20230530113649.73f28b9f6ba91f17ace1e12f@hugovil.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Subject: Re: [PATCH v4 7/9] serial: sc16is7xx: fix regression with GPIO configuration X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 31 May 2023 00:56:57 +0300 Andy Shevchenko wrote: > On Tue, May 30, 2023 at 6:36 PM Hugo Villeneuve wrote: > > On Tue, 30 May 2023 01:38:17 +0300 > > andy.shevchenko@gmail.com wrote: > > > Mon, May 29, 2023 at 10:07:09AM -0400, Hugo Villeneuve kirjoitti: > > ... > > > > GENMASK() > > > > Ok done, altough even if in general I like the bit manipulation macros because they make the code easier to read/understand, I find it less obvious by using GENMASK in this case IMMO. > > GENMASK() was introduced to increase code robustness: > 1) to make sure the bits mentioned are correct > 2) to check the bit boundary. > > ... > > > > > + of_property_for_each_u32(dev->of_node, "nxp,modem-control-line-ports", > > > > + prop, p, u) { > > > > + if (u >= devtype->nr_uart) > > > > + continue; > > > > + > > > > + /* Use GPIO lines as modem control lines */ > > > > + if (u == 0) > > > > + mctrl_mask |= SC16IS7XX_IOCONTROL_MODEM_A_BIT; > > > > + else if (u == 1) > > > > + mctrl_mask |= SC16IS7XX_IOCONTROL_MODEM_B_BIT; > > > > + } > > > > > > Can we use device properties, please? > > > > I have converted this section to use device_property_count_u32() and device_property_read_u32_array(). Is that Ok? > > Yes, thank you! Hi Andy, now that I am using the device property API, I think I no longer have the need to test for "if (dev->of_node)" before reading the new property "nxp,modem-control-line-ports"? If that is the case, I will leave the test "if (dev->of_node)" only for the "irda-mode-ports" property. The pseudo code woulk look like this: if (dev->of_node) { struct property *prop; const __be32 *p; u32 u; of_property_for_each_u32(dev->of_node, "irda-mode-ports", prop, p, u) if (u < devtype->nr_uart) s->p[u].irda_mode = true; } /* Read "nxp,modem-control-line-ports" using device property API. */ sc16is7xx_setup_mctrl_ports(dev); Thank you, Hugo. > > > If you think about backporting to the earlier kernels (w/o properties in use in > > > this driver), perhaps an additional followup for that? > > > > I am not sure what you mean by this? > > If the device property API was not yet available for this fix being > backported to the old enough kernel we have to use old OF stuff. In > that case the device property conversion needs to be done in a > separate change. > > -- > With Best Regards, > Andy Shevchenko >