On Thu, 18 Jun 2026 15:45:23 +0100
Nuno Sá <[email protected]> wrote:

> On Thu, Jun 18, 2026 at 02:27:21PM +0100, Rodrigo Alencar via B4 Relay wrote:
> > From: Rodrigo Alencar <[email protected]>
> > 
> > Add debugfs_reg64_access function pointer field into iio_info and modify
> > file operation callbacks to favor 64-bit variant when it is available.
> > 
> > Signed-off-by: Rodrigo Alencar <[email protected]>
> > ---
> >  drivers/iio/industrialio-core.c | 33 ++++++++++++++++++++++++---------
> >  include/linux/iio/iio-opaque.h  |  2 +-
> >  include/linux/iio/iio.h         |  4 ++++
> >  3 files changed, 29 insertions(+), 10 deletions(-)
> > 
> > @@ -471,7 +485,8 @@ static void iio_device_register_debugfs(struct iio_dev 
> > *indio_dev)
> >  {
> >     struct iio_dev_opaque *iio_dev_opaque;
> >  
> > -   if (indio_dev->info->debugfs_reg_access == NULL)
> > +   if (!indio_dev->info->debugfs_reg_access &&
> > +       !indio_dev->info->debugfs_reg64_access)
> >             return;  
> 
> Not really that important but should dev_warn() in case someone gives
> both callbacks? Can't use both anyways.
> 
> (We now have agentic help reviewing the code so maybe even if someone
> does it for some reason it won't pass review :))
> 
Definitely marginal. Not sure I'd bother. However the docs
could say something about the mutual exclusivity.  See below.

> - Nuno Sá
> >  
> >     if (!iio_debugfs_dentry)
> > diff --git a/include/linux/iio/iio-opaque.h b/include/linux/iio/iio-opaque.h
> > index b87841a355f8..98330385e08d 100644
> > --- a/include/linux/iio/iio-opaque.h
> > +++ b/include/linux/iio/iio-opaque.h
> > @@ -73,7 +73,7 @@ struct iio_dev_opaque {
> >  #if defined(CONFIG_DEBUG_FS)
> >     struct dentry                   *debugfs_dentry;
> >     unsigned int                    cached_reg_addr;
> > -   char                            read_buf[20];
> > +   char                            read_buf[24];
> >     unsigned int                    read_buf_len;
> >  #endif
> >  };
> > diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
> > index 711c00f67371..1c7d12af22da 100644
> > --- a/include/linux/iio/iio.h
> > +++ b/include/linux/iio/iio.h
> > @@ -484,6 +484,7 @@ struct iio_trigger; /* forward declaration */
> >   * @update_scan_mode:      function to configure device and scan buffer 
> > when
> >   *                 channels have changed
> >   * @debugfs_reg_access:    function to read or write register value of 
> > device
> > + * @debugfs_reg64_access: function to read or write 64-bit register value 
> > of device

Based on Nuno's observation above, I think this needs to say this and 
debugfs_reg_access
are mutually exclusive.

Otherwise LGTM.

> >   * @fwnode_xlate:  fwnode based function pointer to obtain channel 
> > specifier index.
> >   * @hwfifo_set_watermark: function pointer to set the current hardware
> >   *                 fifo watermark level; see hwfifo_* entries in
> > @@ -572,6 +573,9 @@ struct iio_info {
> >     int (*debugfs_reg_access)(struct iio_dev *indio_dev,
> >                               unsigned int reg, unsigned int writeval,
> >                               unsigned int *readval);
> > +   int (*debugfs_reg64_access)(struct iio_dev *indio_dev,
> > +                               unsigned int reg, u64 writeval,
> > +                               u64 *readval);
> >     int (*fwnode_xlate)(struct iio_dev *indio_dev,
> >                         const struct fwnode_reference_args *iiospec);
> >     int (*hwfifo_set_watermark)(struct iio_dev *indio_dev, unsigned int 
> > val);
> > 
> > -- 
> > 2.43.0
> > 
> >   


Reply via email to