This change starts to hide some internal fields of the IIO device into the framework. This patchset assumes that all drivers have been addressed with respect to the use of iio_priv_to_dev(), so the first patch in the series (now) is to remove it, so that we don't need to move it. V2 series: https://patchwork.kernel.org/patch/11548709/ https://lore.kernel.org/linux-iio/20200514131710.84201-1-alexandru.ardelean@xxxxxxxxxx/ Referencing them, since it took a bit longer to get to V3 Changelog v2 -> v3: - no driver should use iio_priv_to_dev() now; all drivers that use it should have been taken care by now; and as a result, all patches from v2 are no longer here - added patch that just removes iio_priv_to_dev() - for patch 'iio: core: wrap IIO device into an iio_dev_opaque object' added comment about 'priv' field that it must be accessed via iio_priv() helper - patch 'iio: core: simplify alloc alignment code' removed added 'iio: core: remove padding from private information' instead - v2 did not address too many movements from iio_dev -> iio_dev_opaque this patchset introduces a few more, the ones that seemed easier; v2 only had 'iio: core: move debugfs data on the private iio dev info' anything after that was added in v3 Changelog v1 -> v2: - add pre-work patches that remove some calls to iio_priv_to_dev() from interrupt handlers - renamed iio_dev_priv -> iio_dev_opaque - moved the iio_dev_opaque to 'include/linux/iio/iio-opaque.h' this way it should be usable for debugging - the iio_priv() call, is still an inline function that returns an 'indio_dev->priv' reference; this field is added to 'struct iio_dev'; the reference is computed in iio_device_alloc() and should be cacheline aligned - the to_iio_dev_opaque() container is in the 'include/linux/iio/iio-opaque.h' header; it's still implemented with some pointer arithmetic; one idea was to do it via an 'indio_dev->opaque' field; that may still be an optionif there are some opinions in that direction Alexandru Ardelean (7): iio: core: remove iio_priv_to_dev() helper iio: core: wrap IIO device into an iio_dev_opaque object iio: core: remove padding from private information iio: core: move debugfs data on the private iio dev info iio: core: move channel list & group to private iio device object iio: core: move iio_dev's buffer_list to the private iio device object iio: core: move event interface on the opaque struct drivers/iio/industrialio-buffer.c | 38 ++++++---- drivers/iio/industrialio-core.c | 114 ++++++++++++++++++------------ drivers/iio/industrialio-event.c | 68 ++++++++++-------- include/linux/iio/iio-opaque.h | 36 ++++++++++ include/linux/iio/iio.h | 35 ++------- 5 files changed, 176 insertions(+), 115 deletions(-) create mode 100644 include/linux/iio/iio-opaque.h -- 2.17.1