Merge branches 'edac-spr', 'edac-igen6' and 'edac-misc' into edac-updates-for-v5.11
[sfrench/cifs-2.6.git] / include / linux / spi / spi.h
index 99380c0825dbe1818460556312fee5d23c9c9fc1..b390fdac158760bf7330c3e1d88caecb850fccc5 100644 (file)
@@ -734,6 +734,25 @@ static inline struct spi_controller *spi_alloc_slave(struct device *host,
        return __spi_alloc_controller(host, size, true);
 }
 
+struct spi_controller *__devm_spi_alloc_controller(struct device *dev,
+                                                  unsigned int size,
+                                                  bool slave);
+
+static inline struct spi_controller *devm_spi_alloc_master(struct device *dev,
+                                                          unsigned int size)
+{
+       return __devm_spi_alloc_controller(dev, size, false);
+}
+
+static inline struct spi_controller *devm_spi_alloc_slave(struct device *dev,
+                                                         unsigned int size)
+{
+       if (!IS_ENABLED(CONFIG_SPI_SLAVE))
+               return NULL;
+
+       return __devm_spi_alloc_controller(dev, size, true);
+}
+
 extern int spi_register_controller(struct spi_controller *ctlr);
 extern int devm_spi_register_controller(struct device *dev,
                                        struct spi_controller *ctlr);