Re: [PATCH v2 1/5] iio: magnetometer: ak8975: Convert enum->pointer for data in the match tables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Donnerstag, dem 19.10.2023 um 09:41 +0000 schrieb Biju Das:
> > Subject: Re: [PATCH v2 1/5] iio: magnetometer: ak8975: Convert
> > enum-
> > > pointer for data in the match tables
> > 
> > On Thu, Oct 19, 2023 at 07:08:23AM +0000, Biju Das wrote:
> > > > Subject: RE: [PATCH v2 1/5] iio: magnetometer: ak8975: Convert
> > > > enum-
> > 
> > ...
> > 
> > > > As mentioned in the patch.
> > > > /* If enumerated via firmware node, fix the ABI */
> > > > 
> > > > Looks like this issue is not introduced by this patch.
> > > > The previous code uses device_get_match_data() which returns a
> > > > match
> > > > as it uses DT node and it uses dev_name(&client->dev) instead
> > > > of
> > > > id->name;
> > > > 
> > > > Am I missing anything here? If it is just a test program, can
> > > > it be
> > fixed??
> > > > 
> > > > Please correct me if I am wrong.
> > > 
> > > I just realized that there is no .data in previous code for OF
> > > tables.
> > > 
> > > Maybe we should add a check, if it is DT node, return id->name?
> > > 
> > > Is there any API to distinguish DT node from ACPI??
> > 
> > Of course, but I discourage people to use that, you have to have a
> > very
> > good justification why you need it (and this case doesn't sound
> > good enough
> > to me, or please elaborate). Hence I leave it as a homework to find
> > those
> > APIs.
> 
> Andre, complained that his test app is broken with this patch. I am
> waiting for his response whether he can fix his test app? 
> If not, we need to find a solution. One solution
> is adding a name variable and use consistent name across
> OF/ACPI/I2C tables for various devices.

Just to make it clear, the functionality of the test application
(hwtest) is not affected by this patch. Only a less/none telling name
is shown now in the Model column of its output.

I'm not that familiar with the interfaces provided by the kernel. Is
there another way to get the device name if not from for example

/sys/bus/iio/devices/iio:device2/name

(which now shows '0-000d' instead of 'ak09911')

For the bmi160 device[1] the following code is used to get the name

	if (id)
		name = id->name;
	else
		name = dev_name(&client->dev);

but I don't know whether this is applicable here.

Thanks to all, for trying to find a solution.

André

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/iio/imu/bmi160/bmi160_i2c.c?h=v6.6-rc6#n31

> 
> Other solution is just add this check,
> 
> if (dev_fwnode(&client->dev) && !(IS_ENABLED(CONFIG_OF) && dev-
> >of_node))
> 	name = dev_name(&client->dev);
> else
> 	name = id->name;
> 
> Cheers,
> Biju
> 




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux