DONOTMERGE Export of_register_spi_device() from SPI Core to allow registering SPI devices from device tree when the device node is not a child node of spi controller. Signed-off-by: Ayush Singh <ayush@xxxxxxxxxxxxxxx> --- drivers/spi/spi.c | 3 ++- include/linux/spi/spi.h | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 565b2e2dd5b9..8cd4d61958a2 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2566,7 +2566,7 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi, return 0; } -static struct spi_device * +struct spi_device * of_register_spi_device(struct spi_controller *ctlr, struct device_node *nc) { struct spi_device *spi; @@ -2612,6 +2612,7 @@ of_register_spi_device(struct spi_controller *ctlr, struct device_node *nc) spi_dev_put(spi); return ERR_PTR(rc); } +EXPORT_SYMBOL_GPL(of_register_spi_device); /** * of_register_spi_devices() - Register child devices onto the SPI bus diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 58e692226475..861b1cb4cca6 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -1686,6 +1686,9 @@ spi_transfer_is_last(struct spi_controller *ctlr, struct spi_transfer *xfer) #if IS_ENABLED(CONFIG_OF) struct spi_controller *of_find_spi_controller_by_node(struct device_node *node); + +struct spi_device * +of_register_spi_device(struct spi_controller *ctlr, struct device_node *nc); #endif #endif /* __LINUX_SPI_H */ -- 2.45.2