Re: [PATCH v3 00/13] Add support for AD7091R-2/-4/-8

From: David Lechner
Date: Thu Dec 07 2023 - 18:26:21 EST


On Thu, Dec 7, 2023 at 12:36 PM Marcelo Schmitt
<marcelo.schmitt@xxxxxxxxxx> wrote:
>
> From: Marcelo Schmitt <marcelo.schmitt1@xxxxxxxxx>
>
> ----------------- Updates -----------------
>
> Applied all changes suggested to the previous series.
>
> I tried to better explain the changes but, since there is a fair amount of
> rework in ad7091-base and ad7091r5, it may be hard to get the reasoning for the
> early patches before looking at the patch for ad7091r8.
>
> Change log v2 -> v3:
> - Split alert fix patch into 2 fix patches and one alignment cleanup patch
> - Corrected Fixes tag format
> - Moved MAINTAINERS update to the end of the series
> - Reworded some commit messages to provide context and make their goal clearer
> - Removed erroneous gmail sign off
> - Created container struct to store chip_info, regmap_config, and callbacks
> specific to each ADC design
> - Created callbacks for chip specific tasks such as setting device operation mode
> - Dropped the chip type enum struct
> - Applied suggestions related to device tree documentation
> - Added __aligned to list the of checkpatch attribute notes
> - Other code style tidy ups.
>
> I see regmap's interface for reading device registers under /sys/kernel/debug/regmap/.
> I can read all registers but can't write to any of them unless I force define
> REGMAP_ALLOW_WRITE_DEBUGFS.
>
> When testing events for this driver I often write to device registers
> to set different rising/falling thresholds. I do something like this:
> # echo 0x17 0x100 > /sys/kernel/debug/iio/iio:device0/direct_reg_access
>
> I tried read/writing to files under iio:device events directory but always
> get segmentation fault. I must be forgetting to implement something.
> What am I missing?
>

It looks like event callbacks (.read_event_value and friends) are
missing from `static const struct iio_info ad7091r_info = { ... }`.
These callbacks aren't checked for NULL, e.g. in iio_ev_value_show(),
so that is likely where the segfault is happening.