linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wilc1000: Remove misleading USE_SPI_DMA macro
@ 2021-12-07  0:26 David Mosberger-Tang
  2021-12-07 12:58 ` Ajay.Kathat
  2021-12-14 18:44 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: David Mosberger-Tang @ 2021-12-07  0:26 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel, David Mosberger-Tang

The USE_SPI_DMA macro name suggests that it could be set to 1 to
control whether or not SPI DMA should be used.  However, that's not
what it does.  If set to 1, it'll set the SPI messages'
"is_dma_mapped" flag to true, even though the tx/rx buffers aren't
actually DMA mapped by the driver.  In other words, setting this flag
to 1 will break the driver.

Best to clean up this confusion by removing the macro altogether.
There is no need to explicitly initialize "is_dma_mapped" because the
message is cleared to zero anyhow, so "is_dma_mapped" is set to false
by default.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 drivers/net/wireless/microchip/wilc1000/spi.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/spi.c b/drivers/net/wireless/microchip/wilc1000/spi.c
index 640850f989dd..1856525b9834 100644
--- a/drivers/net/wireless/microchip/wilc1000/spi.c
+++ b/drivers/net/wireless/microchip/wilc1000/spi.c
@@ -99,8 +99,6 @@ static int wilc_spi_reset(struct wilc *wilc);
 #define DATA_PKT_LOG_SZ				DATA_PKT_LOG_SZ_MAX
 #define DATA_PKT_SZ				(1 << DATA_PKT_LOG_SZ)
 
-#define USE_SPI_DMA				0
-
 #define WILC_SPI_COMMAND_STAT_SUCCESS		0
 #define WILC_GET_RESP_HDR_START(h)		(((h) >> 4) & 0xf)
 
@@ -240,7 +238,6 @@ static int wilc_spi_tx(struct wilc *wilc, u8 *b, u32 len)
 		memset(&msg, 0, sizeof(msg));
 		spi_message_init(&msg);
 		msg.spi = spi;
-		msg.is_dma_mapped = USE_SPI_DMA;
 		spi_message_add_tail(&tr, &msg);
 
 		ret = spi_sync(spi, &msg);
@@ -284,7 +281,6 @@ static int wilc_spi_rx(struct wilc *wilc, u8 *rb, u32 rlen)
 		memset(&msg, 0, sizeof(msg));
 		spi_message_init(&msg);
 		msg.spi = spi;
-		msg.is_dma_mapped = USE_SPI_DMA;
 		spi_message_add_tail(&tr, &msg);
 
 		ret = spi_sync(spi, &msg);
@@ -323,7 +319,6 @@ static int wilc_spi_tx_rx(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen)
 		memset(&msg, 0, sizeof(msg));
 		spi_message_init(&msg);
 		msg.spi = spi;
-		msg.is_dma_mapped = USE_SPI_DMA;
 
 		spi_message_add_tail(&tr, &msg);
 		ret = spi_sync(spi, &msg);
-- 
2.25.1


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

* Re: [PATCH] wilc1000: Remove misleading USE_SPI_DMA macro
  2021-12-07  0:26 [PATCH] wilc1000: Remove misleading USE_SPI_DMA macro David Mosberger-Tang
@ 2021-12-07 12:58 ` Ajay.Kathat
  2021-12-14 18:44 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Ajay.Kathat @ 2021-12-07 12:58 UTC (permalink / raw)
  To: davidm
  Cc: Claudiu.Beznea, kvalo, davem, kuba, linux-wireless, netdev, linux-kernel

On 07/12/21 05:56, David Mosberger-Tang wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> The USE_SPI_DMA macro name suggests that it could be set to 1 to
> control whether or not SPI DMA should be used.  However, that's not
> what it does.  If set to 1, it'll set the SPI messages'
> "is_dma_mapped" flag to true, even though the tx/rx buffers aren't
> actually DMA mapped by the driver.  In other words, setting this flag
> to 1 will break the driver.
>
> Best to clean up this confusion by removing the macro altogether.
> There is no need to explicitly initialize "is_dma_mapped" because the
> message is cleared to zero anyhow, so "is_dma_mapped" is set to false
> by default.
>
> Signed-off-by: David Mosberger-Tang <davidm@egauge.net>


Thanks!


Acked-by: Ajay Singh <ajay.kathat@microchip.com>


> ---
>   drivers/net/wireless/microchip/wilc1000/spi.c | 5 -----
>   1 file changed, 5 deletions(-)
>
> diff --git a/drivers/net/wireless/microchip/wilc1000/spi.c b/drivers/net/wireless/microchip/wilc1000/spi.c
> index 640850f989dd..1856525b9834 100644
> --- a/drivers/net/wireless/microchip/wilc1000/spi.c
> +++ b/drivers/net/wireless/microchip/wilc1000/spi.c
> @@ -99,8 +99,6 @@ static int wilc_spi_reset(struct wilc *wilc);
>   #define DATA_PKT_LOG_SZ                                DATA_PKT_LOG_SZ_MAX
>   #define DATA_PKT_SZ                            (1 << DATA_PKT_LOG_SZ)
>
> -#define USE_SPI_DMA                            0
> -
>   #define WILC_SPI_COMMAND_STAT_SUCCESS          0
>   #define WILC_GET_RESP_HDR_START(h)             (((h) >> 4) & 0xf)
>
> @@ -240,7 +238,6 @@ static int wilc_spi_tx(struct wilc *wilc, u8 *b, u32 len)
>                  memset(&msg, 0, sizeof(msg));
>                  spi_message_init(&msg);
>                  msg.spi = spi;
> -               msg.is_dma_mapped = USE_SPI_DMA;
>                  spi_message_add_tail(&tr, &msg);
>
>                  ret = spi_sync(spi, &msg);
> @@ -284,7 +281,6 @@ static int wilc_spi_rx(struct wilc *wilc, u8 *rb, u32 rlen)
>                  memset(&msg, 0, sizeof(msg));
>                  spi_message_init(&msg);
>                  msg.spi = spi;
> -               msg.is_dma_mapped = USE_SPI_DMA;
>                  spi_message_add_tail(&tr, &msg);
>
>                  ret = spi_sync(spi, &msg);
> @@ -323,7 +319,6 @@ static int wilc_spi_tx_rx(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen)
>                  memset(&msg, 0, sizeof(msg));
>                  spi_message_init(&msg);
>                  msg.spi = spi;
> -               msg.is_dma_mapped = USE_SPI_DMA;
>
>                  spi_message_add_tail(&tr, &msg);
>                  ret = spi_sync(spi, &msg);
> --
> 2.25.1
>


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

* Re: [PATCH] wilc1000: Remove misleading USE_SPI_DMA macro
  2021-12-07  0:26 [PATCH] wilc1000: Remove misleading USE_SPI_DMA macro David Mosberger-Tang
  2021-12-07 12:58 ` Ajay.Kathat
@ 2021-12-14 18:44 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2021-12-14 18:44 UTC (permalink / raw)
  To: David Mosberger-Tang
  Cc: Ajay Singh, Claudiu Beznea, Kalle Valo, David S. Miller,
	Jakub Kicinski, linux-wireless, netdev, linux-kernel,
	David Mosberger-Tang

David Mosberger-Tang <davidm@egauge.net> wrote:

> The USE_SPI_DMA macro name suggests that it could be set to 1 to
> control whether or not SPI DMA should be used.  However, that's not
> what it does.  If set to 1, it'll set the SPI messages'
> "is_dma_mapped" flag to true, even though the tx/rx buffers aren't
> actually DMA mapped by the driver.  In other words, setting this flag
> to 1 will break the driver.
> 
> Best to clean up this confusion by removing the macro altogether.
> There is no need to explicitly initialize "is_dma_mapped" because the
> message is cleared to zero anyhow, so "is_dma_mapped" is set to false
> by default.
> 
> Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
> Acked-by: Ajay Singh <ajay.kathat@microchip.com>

Patch applied to wireless-drivers-next.git, thanks.

dde02213fa64 wilc1000: Remove misleading USE_SPI_DMA macro

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20211207002453.3193737-1-davidm@egauge.net/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


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

end of thread, other threads:[~2021-12-14 18:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-07  0:26 [PATCH] wilc1000: Remove misleading USE_SPI_DMA macro David Mosberger-Tang
2021-12-07 12:58 ` Ajay.Kathat
2021-12-14 18:44 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).