From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fgw22-7.mail.saunalahti.fi (fgw22-7.mail.saunalahti.fi [62.142.5.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1BAB2C3251 for ; Mon, 2 Jun 2025 21:25:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.83 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748899552; cv=none; b=lPU1jwasvw1693HdCa3VSbqX1h6bYG3qZgXZfX5/P50kxv0oUz4H8iSCQoAJlFqC94a4RSTP4vpSphkqQO0KkbOEJb7kZVXll6pCe4xhlwHPFEgJkVlpMNTtdzULpnWo3zyWj0AFpWySVeYx/0z02afyx+ajNJw/09Gk7O4RjFM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748899552; c=relaxed/simple; bh=jNUNQAqQgPC6l0XchUq2j78f67t3HtqKvRqBBAoRDbU=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OwCyTtD1emeLQzo0oFCXTG+B9GzL6zZPF9hmnn5ofvic9bbqa4XoxhKJYT/GghfJ7WpRKDLey5BtKZNeOrC9paiSF1TEvCO+QNWfBURWN0C7J61r3k3Al8xHd49ZG6G7mBVKal0QJyBbZbOOQFRLzrj0zPDQh9X7U1oVhXF71H4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.83 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from localhost (88-113-26-232.elisa-laajakaista.fi [88.113.26.232]) by fgw23.mail.saunalahti.fi (Halon) with ESMTP id 220d7b81-3ff8-11f0-a94d-005056bdfda7; Tue, 03 Jun 2025 00:25:41 +0300 (EEST) From: Andy Shevchenko Date: Tue, 3 Jun 2025 00:25:40 +0300 To: andriy.shevchenko@linux.intel.com Cc: Andy Shevchenko , Jonathan Santos , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, nuno.sa@analog.com, Michael.Hennerich@analog.com, marcelo.schmitt@analog.com, jic23@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, marcelo.schmitt1@gmail.com, linus.walleij@linaro.org, brgl@bgdev.pl, lgirdwood@gmail.com, broonie@kernel.org, dlechner@baylibre.com, rafael@kernel.org, djrscally@gmail.com Subject: Re: [PATCH v9 09/12] iio: adc: ad7768-1: add support for Synchronization over SPI Message-ID: References: <27cccb51cc56f1bb57cb06d279854a503d779e25.1748447035.git.Jonathan.Santos@analog.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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