Skip to contentSkip to conversation

drivers/spi-dw-core.c : remove redundant function spi_controller_set_devdata

PATCH In review Lizhe 2 participants 2 messages Mar 8, 2023 – Mar 9, 2023 SPI

lore
Share & tools
lore

Lizhe

author
#0 lore raw

PATCH 1/1 drivers/spi-dw-core.c : remove redundant function spi_controller_set_devdata

in spi_alloc_master() already exists master_controller_set_devdata() called, add the struct dw_spi is passed to the spi_alloc_master() as the second parameter.

---
 drivers/spi/spi-dw-core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/spi/spi-dw-core.c +1 -3
index c3bfb6c84cab..ad776c7eb66c 100644
@@ -892,7 +892,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws)
 	if (!dws)
 		return -EINVAL;
 
-	master = spi_alloc_master(dev, 0);
+	master = spi_alloc_master(dev, sizeof(*dws));
 	if (!master)
 		return -ENOMEM;
 
@@ -901,8 +901,6 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws)
 	dws->master = master;
 	dws->dma_addr = (dma_addr_t)(dws->paddr + DW_SPI_DR);
 
-	spi_controller_set_devdata(master, dws);
-
 	/* Basic HW init */
 	dw_spi_hw_init(dev, dws);
 
Signature · 1 line
2.34.1
#1 lore raw
Quoted 3 lines · Lizhe

in spi_alloc_master() already exists master_controller_set_devdata() called, add the struct dw_spi is passed to the spi_alloc_master() as the second parameter.

Are you sure that the suggested change does what you think it does?

-Serge(y)

Quoted 31 lines
---
 drivers/spi/spi-dw-core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/spi/spi-dw-core.c +1 -3
index c3bfb6c84cab..ad776c7eb66c 100644
@@ -892,7 +892,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws)
 	if (!dws)
 		return -EINVAL;
 
-	master = spi_alloc_master(dev, 0);
+	master = spi_alloc_master(dev, sizeof(*dws));
 	if (!master)
 		return -ENOMEM;
 
@@ -901,8 +901,6 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws)
 	dws->master = master;
 	dws->dma_addr = (dma_addr_t)(dws->paddr + DW_SPI_DR);
 
-	spi_controller_set_devdata(master, dws);
-
 	/* Basic HW init */
 	dw_spi_hw_init(dev, dws);
 
Signature · 1 line
2.34.1