On Tue, Jun 09, 2026 at 11:13:04AM +0100, Rodrigo Alencar via B4 Relay wrote:

> Use of local SPI bus data to manage a collection of SPI transfers and
> flush them to the SPI platform driver with the sync() operation. This
> allows for faster handling of multiple channel DAC writes, avoiding kernel
> overhead per spi_sync() call, which will be helpful when enabling
> triggered buffer support.

...

>  static int ad5686_spi_probe(struct spi_device *spi)
>  {
> -     return ad5686_probe(&spi->dev, spi_get_device_match_data(spi),
> -                         spi->modalias, &ad5686_spi_ops);
> +     const struct ad5686_chip_info *info = spi_get_device_match_data(spi);

        struct device *dev = &spi->dev;

> +     struct ad5686_spi_data *bus_data;
> +     unsigned int capacity;
> +
> +     /* read operation requires at least 2 transfers */
> +     capacity = max(info->num_channels, 2);
> +     bus_data = devm_kzalloc(&spi->dev,
> +                             struct_size(bus_data, xfers, capacity),
> +                             GFP_KERNEL);

        bus_data = devm_kzalloc(dev, struct_size(bus_data, xfers, capacity),
                                GFP_KERNEL);

> +     if (!bus_data)
> +             return -ENOMEM;
> +
> +     bus_data->capacity = capacity;
> +
> +     return ad5686_probe(&spi->dev, info, spi->modalias, &ad5686_spi_ops,
> +                         bus_data);

        return ad5686_probe(dev, info, spi->modalias, &ad5686_spi_ops, 
bus_data);

>  }

-- 
With Best Regards,
Andy Shevchenko



Reply via email to