diff mbox series

[net-next,v2,03/17] soc: fsl: qe: store muram_vbase as a void pointer instead of u8

Message ID 20210119150802.19997-4-rasmus.villemoes@prevas.dk (mailing list archive)
State Accepted
Commit 155ea0dc8dcb6066aaf4af5addd005b8968ce820
Delegated to: Netdev Maintainers
Headers show
Series ucc_geth improvements | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count fail Series longer than 15 patches
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 2 maintainers not CCed: linuxppc-dev@lists.ozlabs.org linux-arm-kernel@lists.infradead.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 23 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Rasmus Villemoes Jan. 19, 2021, 3:07 p.m. UTC
The two functions cpm_muram_offset() and cpm_muram_dma() both need a
cast currently, one casts muram_vbase to do the pointer arithmetic on
void pointers, the other casts the passed-in address u8*.

It's simpler and more consistent to just always use void* and drop all
the casting.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
---
 drivers/soc/fsl/qe/qe_common.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Leo Li Jan. 19, 2021, 6:45 p.m. UTC | #1
On Tue, Jan 19, 2021 at 9:16 AM Rasmus Villemoes
<rasmus.villemoes@prevas.dk> wrote:
>
> The two functions cpm_muram_offset() and cpm_muram_dma() both need a
> cast currently, one casts muram_vbase to do the pointer arithmetic on
> void pointers, the other casts the passed-in address u8*.
>
> It's simpler and more consistent to just always use void* and drop all
> the casting.
>
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>

Acked-by: Li Yang <leoyang.li@nxp.com>

> ---
>  drivers/soc/fsl/qe/qe_common.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c
> index 0fbdc965c4cb..303cc2f5eb4a 100644
> --- a/drivers/soc/fsl/qe/qe_common.c
> +++ b/drivers/soc/fsl/qe/qe_common.c
> @@ -27,7 +27,7 @@
>
>  static struct gen_pool *muram_pool;
>  static spinlock_t cpm_muram_lock;
> -static u8 __iomem *muram_vbase;
> +static void __iomem *muram_vbase;
>  static phys_addr_t muram_pbase;
>
>  struct muram_block {
> @@ -225,7 +225,7 @@ EXPORT_SYMBOL(cpm_muram_addr);
>
>  unsigned long cpm_muram_offset(const void __iomem *addr)
>  {
> -       return addr - (void __iomem *)muram_vbase;
> +       return addr - muram_vbase;
>  }
>  EXPORT_SYMBOL(cpm_muram_offset);
>
> @@ -235,6 +235,6 @@ EXPORT_SYMBOL(cpm_muram_offset);
>   */
>  dma_addr_t cpm_muram_dma(void __iomem *addr)
>  {
> -       return muram_pbase + ((u8 __iomem *)addr - muram_vbase);
> +       return muram_pbase + (addr - muram_vbase);
>  }
>  EXPORT_SYMBOL(cpm_muram_dma);
> --
> 2.23.0
>
diff mbox series

Patch

diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c
index 0fbdc965c4cb..303cc2f5eb4a 100644
--- a/drivers/soc/fsl/qe/qe_common.c
+++ b/drivers/soc/fsl/qe/qe_common.c
@@ -27,7 +27,7 @@ 
 
 static struct gen_pool *muram_pool;
 static spinlock_t cpm_muram_lock;
-static u8 __iomem *muram_vbase;
+static void __iomem *muram_vbase;
 static phys_addr_t muram_pbase;
 
 struct muram_block {
@@ -225,7 +225,7 @@  EXPORT_SYMBOL(cpm_muram_addr);
 
 unsigned long cpm_muram_offset(const void __iomem *addr)
 {
-	return addr - (void __iomem *)muram_vbase;
+	return addr - muram_vbase;
 }
 EXPORT_SYMBOL(cpm_muram_offset);
 
@@ -235,6 +235,6 @@  EXPORT_SYMBOL(cpm_muram_offset);
  */
 dma_addr_t cpm_muram_dma(void __iomem *addr)
 {
-	return muram_pbase + ((u8 __iomem *)addr - muram_vbase);
+	return muram_pbase + (addr - muram_vbase);
 }
 EXPORT_SYMBOL(cpm_muram_dma);