Linux IIO development
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Jorijn van der Graaf <jorijnvdgraaf@catcrafts.net>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	linux-iio@vger.kernel.org,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	devicetree@vger.kernel.org, "Kees Cook" <kees@kernel.org>,
	"Gustavo A . R . Silva" <gustavoars@kernel.org>,
	linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Luca Weiss" <luca.weiss@fairphone.com>
Subject: Re: [PATCH v2 4/5] iio: light: stk3310: add per-chip match data
Date: Thu, 27 Aug 2026 10:47:29 +0300	[thread overview]
Message-ID: <ao_rkVztBCSQfQno@ashevche-desk.local> (raw)
In-Reply-To: <20260826175409.326131-5-jorijnvdgraaf@catcrafts.net>

On Wed, Aug 26, 2026 at 07:54:08PM +0200, Jorijn van der Graaf wrote:
> Introduce a chip_info structure carrying the device name and channel
> specification, attach it to every i2c, OF and ACPI table entry, and
> let probe take it from the match data, failing when there is none.
> Every firmware bind path carries match data, and with the id names in
> lower case a client instantiated through the sysfs new_device
> interface under a compatible-derived name receives it through the id
> table. The shared channel definitions move into macros.
> 
> The ACPI table entries change to named initializers, matching the
> other id tables.
> 
> This is a preparatory change for a variant that provides more channels
> than the existing parts. No functional change for firmware-described
> devices; a sysfs client under a name that binds without matching any
> id entry (the full compatible string) now fails probe with an error
> instead of probing as an stk3310.

...

> +/**
> + * struct stk3310_chip_info - chip-specific data
> + * @name: device name reported to the IIO core
> + * @channels: channel specification
> + * @num_channels: number of channels
> + */
> +struct stk3310_chip_info {
> +	const char			*name;
> +	const struct iio_chan_spec	*channels __counted_by_ptr(num_channels);
> +	unsigned int			num_channels;

I don't think we need tab-based indentation of the field names.

> +};

...

>  static int stk3310_probe(struct i2c_client *client)
>  {
> +	const struct stk3310_chip_info *chip_info;

	struct device *dev = &client->dev;

>  	int ret;
>  	struct iio_dev *indio_dev;
>  	struct stk3310_data *data;
>  
> +	chip_info = i2c_get_match_data(client);
> +	if (!chip_info)
> +		return dev_err_probe(&client->dev, -ENODEV,
> +				     "missing driver data\n");

Use -ENODATA

		return dev_err_probe(dev, -ENODATA, "missing driver data\n");

>  	indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
>  	if (!indio_dev)
>  		return -ENOMEM;

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-08-27  7:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26 17:54 [PATCH v2 0/5] iio: light: stk3310: per-chip match data and STK36C61 support Jorijn van der Graaf
2026-08-26 17:54 ` [PATCH v2 1/5] iio: light: stk3310: lower-case the i2c device ID names Jorijn van der Graaf
2026-08-27  6:45   ` Andy Shevchenko
2026-08-26 17:54 ` [PATCH v2 2/5] dt-bindings: iio: light: stk33xx: document the Sensortek STK36C61 Jorijn van der Graaf
2026-08-26 17:54 ` [PATCH v2 3/5] iio: light: stk3310: move the data registers into the channel address Jorijn van der Graaf
2026-08-27  6:47   ` Andy Shevchenko
2026-08-26 17:54 ` [PATCH v2 4/5] iio: light: stk3310: add per-chip match data Jorijn van der Graaf
2026-08-27  7:47   ` Andy Shevchenko [this message]
2026-08-26 17:54 ` [PATCH v2 5/5] iio: light: stk3310: support the Sensortek STK36C61 Jorijn van der Graaf
2026-08-27  7:53   ` Andy Shevchenko
2026-08-28  4:18   ` Marcelo Schmitt
2026-08-28 15:47     ` Jorijn van der Graaf
2026-08-30 15:03       ` Marcelo Schmitt
2026-08-30 20:19         ` Jorijn van der Graaf
2026-08-31  7:53           ` Luca Weiss
2026-09-01  0:54             ` Marcelo Schmitt
2026-09-01  1:28               ` Marcelo Schmitt
2026-09-01  2:55                 ` Jorijn van der Graaf
2026-09-01  6:57                   ` Luca Weiss
2026-08-30 23:48 ` [PATCH v2 0/5] iio: light: stk3310: per-chip match data and STK36C61 support Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ao_rkVztBCSQfQno@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=gustavoars@kernel.org \
    --cc=jic23@kernel.org \
    --cc=jorijnvdgraaf@catcrafts.net \
    --cc=kees@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca.weiss@fairphone.com \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox