[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHp75VcNihyzn3t8C48w1V+WWRk_zj8Br7shTfbHLU09u4OtcA@mail.gmail.com>
Date: Thu, 1 Jun 2023 12:24:42 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Hugo Villeneuve <hugo@...ovil.com>
Cc: gregkh@...uxfoundation.org, robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org,
jirislaby@...nel.org, jringle@...dpoint.com,
l.perczak@...lintechnologies.com, tomasz.mon@...lingroup.com,
linux-serial@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org,
Hugo Villeneuve <hvilleneuve@...onoff.com>
Subject: Re: [PATCH v4 7/9] serial: sc16is7xx: fix regression with GPIO configuration
On Thu, Jun 1, 2023 at 2:57 AM Hugo Villeneuve <hugo@...ovil.com> wrote:
> On Wed, 31 May 2023 00:56:57 +0300
> Andy Shevchenko <andy.shevchenko@...il.com> wrote:
> > On Tue, May 30, 2023 at 6:36 PM Hugo Villeneuve <hugo@...ovil.com> wrote:
> > > On Tue, 30 May 2023 01:38:17 +0300
> > > andy.shevchenko@...il.com wrote:
> > > > Mon, May 29, 2023 at 10:07:09AM -0400, Hugo Villeneuve kirjoitti:
...
> > > > > + 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);
Looks good to me, thank you for following the advice!
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists