Re: [PATCH 2/3] iio: dac: ad5706r: Add support for AD5706R DAC

Andy Shevchenko
2026-02-20T16:56:59Z

On Fri, Feb 20, 2026 at 03:02:37PM +0000, Nuno Sá wrote:
> On Fri, 2026-02-20 at 13:00 +0200, Andy Shevchenko wrote:
> > On Fri, Feb 20, 2026 at 10:48:59AM +0000, Nuno Sá wrote:
> > > On Fri, 2026-02-20 at 16:02 +0800, Alexis Czezar Torreno wrote:

...

> > > > +static void ad5706r_debugs_init(struct iio_dev *indio_dev)
> > > > +{
> > > > + struct dentry *d = iio_get_debugfs_dentry(indio_dev);
> > >
> > > It should have:
> > >
> > > if (!IS_ENABLED(CONFIG_DEBUGFS))
> > > return
> >
> > But why? The debugfs is a stub when disabled, nobody should do that
> > in the cases when the main purpose is not the debugfs code.
>
> Because the compiler can then optimize away all of the above code...

How is it different to the code elimination part that is inside in each of
the below calls?

> > > > + debugfs_create_file_unsafe("streaming_addr", 0600, d,
> > > > +    indio_dev, &ad5706r_streaming_addr_fops);
> > > > + debugfs_create_file_unsafe("streaming_len", 0600, d,
> > > > +    indio_dev, &ad5706r_streaming_len_fops);
> > > > + debugfs_create_file_unsafe("streaming_data", 0600, d,
> > > > +    indio_dev, &ad5706r_streaming_data_fops);
> > > > + debugfs_create_file_unsafe("streaming_reg_access", 0600, d,
> > > > +    indio_dev, &ad5706r_streaming_reg_access_fops);
> > > > + debugfs_create_file_unsafe("spi_speed_hz_write", 0600, d,
> > > > +    indio_dev, &ad5706r_spi_speed_write_fops);
> > > > + debugfs_create_file_unsafe("spi_speed_hz_read", 0600, d,
> > > > +    indio_dev, &ad5706r_spi_speed_read_fops);
> > > > +}

--
With Best Regards,
Andy Shevchenko