Re: [PATCH v5 4/4] iio: adc: ad9467: check for backend capabilities

From: Tomas Melin

Date: Mon Feb 02 2026 - 07:04:18 EST


Hi,

On 02/02/2026 12:42, Nuno Sá wrote:
> On Fri, 2026-01-30 at 09:17 +0000, Tomas Melin wrote:
>> Add capability checks for operation with backends that do not necessarily
>> support full set of features, but are otherwise compatible with the device.
>> This ensures a fully functional device, but with limited capabilities.
...
>>  
>> @@ -1263,8 +1271,10 @@ static void ad9467_debugfs_init(struct iio_dev *indio_dev)
>>   if (!st->chan_test)
>>   return;
>>  
>> - debugfs_create_file("calibration_table_dump", 0400, d, st,
>> -     &ad9467_calib_table_fops);
>> + if (iio_backend_has_caps(st->back, IIO_BACKEND_CAP_CALIBRATION)) {
>> + debugfs_create_file("calibration_table_dump", 0400, d, st,
>> +     &ad9467_calib_table_fops);
>> + }
>>  
>>   for (chan = 0; chan < st->info->num_channels; chan++) {
>>   snprintf(attr_name, sizeof(attr_name), "in_voltage%u_test_mode",
>
> Change the permissions for in_voltage%u_test_mode so that is WO in case we can't
> IIO_BACKEND_CAP_CALIBRATION. You can even reuse the above check to tweak the permissions
> accordingly. Then no need to check for the capability in ad9467_chan_test_mode_read()

This RO would be then only for cases PN9, PN23. For the other attributes
RW would still be applicable. But basically I think the test modes in
the device are still available even if the backend status does not exist?

IMHO the current approach is slightly cleaner, as all the test modes the
device supports are available and no need to think about which ones have
RW/RO inside this function. Please let me know, in case you insist on
this kind of approach.

Thanks,
Tomas