mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] drivers/spi-dw-core.c : remove redundant function spi_controller_set_devdata
@ 2023-03-08 14:55 Lizhe
  2023-03-09 12:10 ` Serge Semin
  0 siblings, 1 reply; 2+ messages in thread
From: Lizhe @ 2023-03-08 14:55 UTC (permalink / raw)
  To: fancer.lancer, broonie; +Cc: linux-spi, linux-kernel, 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.

Signed-off-by: Lizhe <sensor1010@163.com>
---
 drivers/spi/spi-dw-core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/spi/spi-dw-core.c b/drivers/spi/spi-dw-core.c
index c3bfb6c84cab..ad776c7eb66c 100644
--- a/drivers/spi/spi-dw-core.c
+++ b/drivers/spi/spi-dw-core.c
@@ -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);
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] drivers/spi-dw-core.c : remove redundant function spi_controller_set_devdata
  2023-03-08 14:55 [PATCH v1] drivers/spi-dw-core.c : remove redundant function spi_controller_set_devdata Lizhe
@ 2023-03-09 12:10 ` Serge Semin
  0 siblings, 0 replies; 2+ messages in thread
From: Serge Semin @ 2023-03-09 12:10 UTC (permalink / raw)
  To: Lizhe; +Cc: broonie, linux-spi, linux-kernel

On Wed, Mar 08, 2023 at 10:55:51PM +0800, Lizhe wrote:
> 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)

> 
> Signed-off-by: Lizhe <sensor1010@163.com>
> ---
>  drivers/spi/spi-dw-core.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/spi/spi-dw-core.c b/drivers/spi/spi-dw-core.c
> index c3bfb6c84cab..ad776c7eb66c 100644
> --- a/drivers/spi/spi-dw-core.c
> +++ b/drivers/spi/spi-dw-core.c
> @@ -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);
>  
> -- 
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-09 12:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-08 14:55 [PATCH v1] drivers/spi-dw-core.c : remove redundant function spi_controller_set_devdata Lizhe
2023-03-09 12:10 ` Serge Semin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®