Re: [PATCH v4 06/13] iio: dac: ds4424: use device match data for chip info

From: Oleksij Rempel

Date: Fri Feb 06 2026 - 02:57:51 EST


On Thu, Feb 05, 2026 at 08:43:25PM +0000, Jonathan Cameron wrote:
> On Tue, 3 Feb 2026 16:56:00 +0200
> Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:
>
> > On Tue, Feb 03, 2026 at 01:00:02PM +0100, Oleksij Rempel wrote:
> > > On Tue, Feb 03, 2026 at 01:51:23PM +0200, Andy Shevchenko wrote:
> > > > On Tue, Feb 03, 2026 at 11:17:42AM +0100, Oleksij Rempel wrote:
> > > > > On Tue, Feb 03, 2026 at 12:03:23PM +0200, Andy Shevchenko wrote:
> > > > > > On Tue, Feb 03, 2026 at 10:34:26AM +0100, Oleksij Rempel wrote:
> >
> > ...
> >
> > > > > > > - indio_dev->name = id->name;
> > > > > >
> > > > > > > + indio_dev->name = client->name;
> > > > > >
> > > > > > Isn't this an ABI breakage?
> > > > >
> > > > > I can't confirm it.
> > > > >
> > > > > before all patches:
> > > > > root@DistroKit:~ cat /sys/bus/iio/devices/iio:device3/name
> > > > > ds4424
> > > > >
> > > > > after:
> > > > > root@DistroKit:~ cat /sys/bus/iio/devices/iio:device3/name
> > > > > ds4424
> > > >
> > > > In ACPI case it might look differently, but I have no means to test this.
> > > >
> > > > id->name comes strictly from an i2c table, while client->name is constructed
> > > > using specifics of the firmware enumeration. In DT due to some (historical?)
> > > > reasons the client->name has no vendor substring and hence matches 1:1 to
> > > > id->name. In ACPI, IIRC, the client->name is ACPI device instance name,
> > > > something like ABCD0123:00.
> > >
> > > Ok, I see. Should I revert this line?
> >
> > Just do not introduce that change (change of the ->name field) in the original
> > patch, in that case no revert churn would be needed.
> >
> I think this got dealt with in discussion of next version but
> safest route is just have an extra copy of the name in the
> chip_info structure. Then we know it's stable against different
> firmware types etc.

Something like this?

diff --git a/drivers/iio/dac/ds4424.c b/drivers/iio/dac/ds4424.c
index ccf36d3e0443..ffa65b22a1fd 100644
--- a/drivers/iio/dac/ds4424.c
+++ b/drivers/iio/dac/ds4424.c
@@ -50,6 +50,7 @@
}

struct ds4424_chip_info {
+ const char *name;
int vref_mV;
int scale_denom;
u8 result_mask;
@@ -57,6 +58,7 @@ struct ds4424_chip_info {
};

static const struct ds4424_chip_info ds4402_info = {
+ .name = "ds4402",
.vref_mV = 1230,
.scale_denom = 4,
.result_mask = DS4404_DAC_MASK,
@@ -64,6 +66,7 @@ static const struct ds4424_chip_info ds4402_info = {
};

static const struct ds4424_chip_info ds4404_info = {
+ .name = "ds4404",
.vref_mV = 1230,
.scale_denom = 4,
.result_mask = DS4404_DAC_MASK,
@@ -71,6 +74,7 @@ static const struct ds4424_chip_info ds4404_info = {
};

static const struct ds4424_chip_info ds4422_info = {
+ .name = "ds4422",
.vref_mV = 976,
.scale_denom = 16,
.result_mask = DS4424_DAC_MASK,
@@ -78,6 +82,7 @@ static const struct ds4424_chip_info ds4422_info = {
};

static const struct ds4424_chip_info ds4424_info = {
+ .name = "ds4424",
.vref_mV = 976,
.scale_denom = 16,
.result_mask = DS4424_DAC_MASK,
@@ -335,7 +340,7 @@ static int ds4424_probe(struct i2c_client *client)

data = iio_priv(indio_dev);
i2c_set_clientdata(client, indio_dev);
- indio_dev->name = id->name;
+ indio_dev->name = chip_info->name;
data->chip_info = chip_info;

data->vcc_reg = devm_regulator_get(&client->dev, "vcc");


--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |