Linux kernel staging patches
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: Align address to 4-byte boundary
@ 2024-06-14 22:42 Abhinav Jain
  2024-06-15 18:05 ` Nam Cao
  2024-06-24 13:17 ` Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Abhinav Jain @ 2024-06-14 22:42 UTC (permalink / raw)
  To: gregkh, linux-staging, linux-kernel
  Cc: skhan, javier.carrasco.cruz, jain.abhinav177

Add address alignment in sdio_local_read, _sdio_local_read &
sdio_local_write functions as per the TODO.

Signed-off-by: Abhinav Jain <jain.abhinav177@gmail.com>
---
 drivers/staging/rtl8723bs/hal/sdio_ops.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index 107f427ee4aa..caee2d2043b3 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -478,9 +478,6 @@ void sdio_set_intf_ops(struct adapter *adapter, struct _io_ops *ops)
 	ops->_write_port = &sdio_write_port;
 }
 
-/*
- * Todo: align address to 4 bytes.
- */
 static s32 _sdio_local_read(
 	struct adapter *adapter,
 	u32 addr,
@@ -494,6 +491,7 @@ static s32 _sdio_local_read(
 	u8 *tmpbuf;
 	u32 n;
 
+	addr = addr & ~3;
 	intfhdl = &adapter->iopriv.intf;
 
 	hal_sdio_get_cmd_addr_8723b(adapter, SDIO_LOCAL_DEVICE_ID, addr, &addr);
@@ -516,9 +514,6 @@ static s32 _sdio_local_read(
 	return err;
 }
 
-/*
- * Todo: align address to 4 bytes.
- */
 s32 sdio_local_read(
 	struct adapter *adapter,
 	u32 addr,
@@ -532,6 +527,7 @@ s32 sdio_local_read(
 	u8 *tmpbuf;
 	u32 n;
 
+	addr = addr & ~3;
 	intfhdl = &adapter->iopriv.intf;
 
 	hal_sdio_get_cmd_addr_8723b(adapter, SDIO_LOCAL_DEVICE_ID, addr, &addr);
@@ -557,9 +553,6 @@ s32 sdio_local_read(
 	return err;
 }
 
-/*
- * Todo: align address to 4 bytes.
- */
 s32 sdio_local_write(
 	struct adapter *adapter,
 	u32 addr,
@@ -572,6 +565,7 @@ s32 sdio_local_write(
 	s32 err;
 	u8 *tmpbuf;
 
+	addr = addr & ~3;
 	intfhdl = &adapter->iopriv.intf;
 
 	hal_sdio_get_cmd_addr_8723b(adapter, SDIO_LOCAL_DEVICE_ID, addr, &addr);
-- 
2.34.1


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

* Re: [PATCH] staging: rtl8723bs: Align address to 4-byte boundary
  2024-06-14 22:42 [PATCH] staging: rtl8723bs: Align address to 4-byte boundary Abhinav Jain
@ 2024-06-15 18:05 ` Nam Cao
  2024-06-24 13:17 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Nam Cao @ 2024-06-15 18:05 UTC (permalink / raw)
  To: Abhinav Jain
  Cc: gregkh, linux-staging, linux-kernel, skhan, javier.carrasco.cruz

On Fri, Jun 14, 2024 at 10:42:56PM +0000, Abhinav Jain wrote:
> Add address alignment in sdio_local_read, _sdio_local_read &
> sdio_local_write functions as per the TODO.
> 
> Signed-off-by: Abhinav Jain <jain.abhinav177@gmail.com>
> ---
>  drivers/staging/rtl8723bs/hal/sdio_ops.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c
> index 107f427ee4aa..caee2d2043b3 100644
> --- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
> +++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
> @@ -478,9 +478,6 @@ void sdio_set_intf_ops(struct adapter *adapter, struct _io_ops *ops)
>  	ops->_write_port = &sdio_write_port;
>  }
>  
> -/*
> - * Todo: align address to 4 bytes.
> - */
>  static s32 _sdio_local_read(
>  	struct adapter *adapter,
>  	u32 addr,
> @@ -494,6 +491,7 @@ static s32 _sdio_local_read(
>  	u8 *tmpbuf;
>  	u32 n;
>  
> +	addr = addr & ~3;
>  	intfhdl = &adapter->iopriv.intf;
>  
>  	hal_sdio_get_cmd_addr_8723b(adapter, SDIO_LOCAL_DEVICE_ID, addr, &addr);
> @@ -516,9 +514,6 @@ static s32 _sdio_local_read(
>  	return err;
>  }
>  
> -/*
> - * Todo: align address to 4 bytes.
> - */
>  s32 sdio_local_read(
>  	struct adapter *adapter,
>  	u32 addr,
> @@ -532,6 +527,7 @@ s32 sdio_local_read(
>  	u8 *tmpbuf;
>  	u32 n;
>  
> +	addr = addr & ~3;
>  	intfhdl = &adapter->iopriv.intf;
>  
>  	hal_sdio_get_cmd_addr_8723b(adapter, SDIO_LOCAL_DEVICE_ID, addr, &addr);
> @@ -557,9 +553,6 @@ s32 sdio_local_read(
>  	return err;
>  }
>  
> -/*
> - * Todo: align address to 4 bytes.
> - */
>  s32 sdio_local_write(
>  	struct adapter *adapter,
>  	u32 addr,
> @@ -572,6 +565,7 @@ s32 sdio_local_write(
>  	s32 err;
>  	u8 *tmpbuf;
>  
> +	addr = addr & ~3;
>  	intfhdl = &adapter->iopriv.intf;
>  
>  	hal_sdio_get_cmd_addr_8723b(adapter, SDIO_LOCAL_DEVICE_ID, addr, &addr);

Tthese functions are never called with "addr" that is not 4-byte-aligned.
So I don't think this patch is what the Todo notes meant.

Best regards,
Nam

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

* Re: [PATCH] staging: rtl8723bs: Align address to 4-byte boundary
  2024-06-14 22:42 [PATCH] staging: rtl8723bs: Align address to 4-byte boundary Abhinav Jain
  2024-06-15 18:05 ` Nam Cao
@ 2024-06-24 13:17 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2024-06-24 13:17 UTC (permalink / raw)
  To: Abhinav Jain; +Cc: linux-staging, linux-kernel, skhan, javier.carrasco.cruz

On Fri, Jun 14, 2024 at 10:42:56PM +0000, Abhinav Jain wrote:
> Add address alignment in sdio_local_read, _sdio_local_read &
> sdio_local_write functions as per the TODO.

How was this tested?

> 
> Signed-off-by: Abhinav Jain <jain.abhinav177@gmail.com>
> ---
>  drivers/staging/rtl8723bs/hal/sdio_ops.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c
> index 107f427ee4aa..caee2d2043b3 100644
> --- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
> +++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
> @@ -478,9 +478,6 @@ void sdio_set_intf_ops(struct adapter *adapter, struct _io_ops *ops)
>  	ops->_write_port = &sdio_write_port;
>  }
>  
> -/*
> - * Todo: align address to 4 bytes.
> - */
>  static s32 _sdio_local_read(
>  	struct adapter *adapter,
>  	u32 addr,
> @@ -494,6 +491,7 @@ static s32 _sdio_local_read(
>  	u8 *tmpbuf;
>  	u32 n;
>  
> +	addr = addr & ~3;

Are you sure you are allowed to do this?  Why?  And a comment about what
you are doing, and why it is required to do so, is needed for this to be
acceptable.

thanks,

greg k-h

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

end of thread, other threads:[~2024-06-24 13:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-14 22:42 [PATCH] staging: rtl8723bs: Align address to 4-byte boundary Abhinav Jain
2024-06-15 18:05 ` Nam Cao
2024-06-24 13:17 ` Greg KH

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