On 2022/9/23 18:12, Mark Brown wrote:
On Fri, Sep 23, 2022 at 06:42:58AM +0200, Lukas Wunner wrote:
On Wed, Sep 21, 2022 at 01:37:49PM +0100, Mark Brown wrote:
Or just use devm_spi_alloc_controller() directly.
There's no such thing. The driver needs to explicitly allocate a
master or slave and that will result in the slave bit being set
correctly in struct spi_controller.
Yang's v2 series now calls __devm_spi_alloc_controller()
but drivers should never call that directly.
Right, we should probably make the actual function to wrap that though -
I'd misremembered that that hadn't been created.
How about introduce devm_spi_alloc_controller() like this:
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index f089ee1ead58..67e510c8d15e 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -763,6 +763,8 @@ struct spi_controller
*__devm_spi_alloc_controller(struct device *dev,
unsigned int size,
bool slave);
+#define devm_spi_alloc_controller devm_spi_alloc_master
+
Thanks,
Yang