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