From: sashiko-bot@kernel.org
To: "Piyush Patle" <piyushpatle228@gmail.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v11 06/11] iio: adc: hx711: introduce hx711_chip_info structure
Date: Wed, 03 Jun 2026 19:00:53 +0000 [thread overview]
Message-ID: <20260603190053.CE1F71F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260603184859.89693-7-piyushpatle228@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The driver now unconditionally fails to probe if `device_get_match_data()` returns NULL, which breaks legacy platform device instantiation.
- [Low] The patch uses an undefined macro `__counted_by_ptr` in the definition of `struct hx711_chip_info`, causing a syntax error and build failure.
--
commit 9bf695b7a4a3ec692793615e524f77137dfcf73f
Author: Piyush Patle <piyushpatle228@gmail.com>
iio: adc: hx711: introduce hx711_chip_info structure
Add a per-variant static configuration structure and populate the IIO
device fields from it at probe time. This prepares the driver for
supporting more compatible hardware variants.
> No functional change for existing HX711 users.
[Severity: High]
Is this description accurate? For legacy platform devices instantiated by
name, the newly added match data check prevents the driver from probing.
> diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c
> index 823fd74f9cf95..062d6860da7d6 100644
> --- a/drivers/iio/adc/hx711.c
> +++ b/drivers/iio/adc/hx711.c
[ ... ]
> @@ -74,6 +76,20 @@ static int hx711_get_scale_to_gain(const int *gain_scale, int scale)
> return -EINVAL;
> }
>
> +/**
> + * struct hx711_chip_info - per-variant static configuration
> + * @name: IIO device name
> + * @channels: channel specification array
> + * @num_channels: number of entries in @channels
> + * @iio_info: IIO info ops for this variant
> + */
> +struct hx711_chip_info {
> + const char *name;
> + const struct iio_chan_spec *channels __counted_by_ptr(num_channels);
[Severity: Low]
Does this compile? The macro __counted_by_ptr is not defined anywhere in
the kernel headers, which causes a syntax error and build failure.
> + unsigned int num_channels;
> + const struct iio_info *iio_info;
> +};
[ ... ]
> @@ -473,6 +498,12 @@ static int hx711_probe(struct platform_device *pdev)
>
> mutex_init(&hx711_data->lock);
>
> + chip_info = device_get_match_data(dev);
> + if (!chip_info)
> + return dev_err_probe(dev, -ENODEV, "missing driver data\n");
[Severity: High]
Will this break legacy platform device instantiation?
For devices instantiated manually via board files matching the driver name
hx711-gpio, device_get_match_data() will return NULL because the driver
does not provide a platform_device_id table.
Prior to this patch, the probe function ran successfully for these devices.
Now it aborts with -ENODEV.
> +
> + hx711_data->chip_info = chip_info;
> +
> /*
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260603184859.89693-1-piyushpatle228@gmail.com?part=6
next prev parent reply other threads:[~2026-06-03 19:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-03 18:48 [PATCH v11 00/11] iio: adc: Add support for AVIA HX710B ADC Piyush Patle
2026-06-03 18:48 ` [PATCH v11 01/11] dt-bindings: iio: adc: hx711: clean up existing binding text Piyush Patle
2026-06-03 18:48 ` [PATCH v11 02/11] dt-bindings: iio: adc: hx711: add VSUP and DVDD supply properties Piyush Patle
2026-06-03 18:48 ` [PATCH v11 03/11] dt-bindings: iio: adc: hx711: add RATE GPIO property Piyush Patle
2026-06-03 18:48 ` [PATCH v11 04/11] dt-bindings: iio: adc: hx711: add HX710B support Piyush Patle
2026-06-03 19:02 ` sashiko-bot
2026-06-03 18:48 ` [PATCH v11 05/11] iio: adc: hx711: move scale computation to per-device storage Piyush Patle
2026-06-03 18:48 ` [PATCH v11 06/11] iio: adc: hx711: introduce hx711_chip_info structure Piyush Patle
2026-06-03 19:00 ` sashiko-bot [this message]
2026-06-03 18:48 ` [PATCH v11 07/11] iio: adc: hx711: pass trailing pulse count into hx711_read Piyush Patle
2026-06-03 18:48 ` [PATCH v11 08/11] iio: adc: hx711: split variable assignments in hx711_read and hx711_reset Piyush Patle
2026-06-03 18:48 ` [PATCH v11 09/11] iio: adc: hx711: localize loop iterators in hx711_read Piyush Patle
2026-06-03 18:48 ` [PATCH v11 10/11] iio: adc: hx711: pass iio_chan_spec to hx711_reset_read Piyush Patle
2026-06-03 18:48 ` [PATCH v11 11/11] iio: adc: hx711: add support for HX710B Piyush Patle
2026-06-03 19:06 ` sashiko-bot
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=20260603190053.CE1F71F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=piyushpatle228@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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