[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aD4WndkKGIWVVWx6@surfacebook.localdomain>
Date: Tue, 3 Jun 2025 00:25:40 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: andriy.shevchenko@...ux.intel.com
Cc: Andy Shevchenko <andy@...nel.org>,
Jonathan Santos <Jonathan.Santos@...log.com>,
linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org,
linux-acpi@...r.kernel.org, nuno.sa@...log.com,
Michael.Hennerich@...log.com, marcelo.schmitt@...log.com,
jic23@...nel.org, robh@...nel.org, krzk+dt@...nel.org,
conor+dt@...nel.org, marcelo.schmitt1@...il.com,
linus.walleij@...aro.org, brgl@...ev.pl, lgirdwood@...il.com,
broonie@...nel.org, dlechner@...libre.com, rafael@...nel.org,
djrscally@...il.com
Subject: Re: [PATCH v9 09/12] iio: adc: ad7768-1: add support for
Synchronization over SPI
Mon, Jun 02, 2025 at 02:15:23PM -0300, Jonathan Santos kirjoitti:
> On 05/30, Andy Shevchenko wrote:
> > On Thu, May 29, 2025 at 07:50:29PM -0300, Jonathan Santos wrote:
...
> > > +static int ad7768_trigger_sources_sync_setup(struct device *dev,
> > > + struct fwnode_handle *dev_fwnode,
> > > + struct ad7768_state *st)
> > > +{
> > > + struct fwnode_reference_args args;
> > > +
> > > + struct fwnode_handle *fwnode __free(fwnode_handle) =
> > > + fwnode_find_reference_args(dev_fwnode, "trigger-sources",
> > > + "#trigger-source-cells", 0,
> > > + AD7768_TRIGGER_SOURCE_SYNC_IDX, &args);
> >
> > I don't see how args are being used. This puts in doubt the need of the first
> > patch.
>
> If the wrapper is the issue, maybe it is better doing this instead?
>
> static int ad7768_trigger_sources_sync_setup(struct device *dev,
> struct fwnode_handle *dev_fwnode,
Name it fwnode...
> struct ad7768_state *st)
> {
> struct fwnode_reference_args args;
> struct fwnode_handle *fwnode __free(fwnode_handle) = NULL;
...and this one something like 'ref'. Also I'm not sure the __free() will do
what you expect from it.
> int ret;
>
> ret = fwnode_property_get_reference_args(dev_fwnode, "trigger-sources",
> "#trigger-source-cells", 0,
> AD7768_TRIGGER_SOURCE_SYNC_IDX, &args);
> if (ret)
> return ret;
>
> fwnode = args.fwnode;
Yes, please. This looks better.
> > > + /* First, try getting the GPIO trigger source */
> > > + if (fwnode_device_is_compatible(fwnode, "gpio-trigger")) {
> > > + st->gpio_sync_in = devm_fwnode_gpiod_get_index(dev, fwnode,
> > > + NULL,
> > > + 0,
> > > + GPIOD_OUT_LOW,
> > > + "sync-in");
> > > + return PTR_ERR_OR_ZERO(st->gpio_sync_in);
> > > + }
> > > +
> > > + /*
> > > + * TODO: Support the other cases when we have a trigger subsystem
> > > + * to reliably handle other types of devices as trigger sources.
> > > + *
> > > + * For now, return an error message. For self triggering, omit the
> > > + * trigger-sources property.
> > > + */
> > > + return dev_err_probe(dev, -EOPNOTSUPP, "Invalid synchronization trigger source\n");
> > > +}
>
> Then we can get rid of the first patch.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists