Re: [PATCH] iio: adc: ti-ads7138: explicitly include <linux/slab.h>
From: Andy Shevchenko
Date: Fri Apr 24 2026 - 05:09:52 EST
On Fri, Apr 24, 2026 at 12:18:10PM +0400, Giorgi Tchankvetadze wrote:
> ti-ads7138.c uses kmalloc() and kfree(), which are provided by
> linux/slab.h, but does not include that header directly.
> The driver currently gets these declarations through linux/i2c.h.
> Include linux/slab.h explicitly instead of relying on the transitive
> include.
If you want to make it real patch, please convert it to follow IWYU.
What you are saying is basically comes from kernel.h (yeah, i2c.h happens
earlier, but the kernel.h is PITA currently).
WRT to the kmalloc() use, wouldn't it be simply better to use
i2c_master_send_dmasafe() and kill that kmalloc() dance in the driver?
--
With Best Regards,
Andy Shevchenko