Re: [PATCH v2 02/28] soc: fsl: cpm1: qmc: Fix __iomem addresses declaration

From: Christophe Leroy
Date: Tue Aug 08 2023 - 11:52:36 EST




Le 26/07/2023 à 17:01, Herve Codina a écrit :
> Running sparse (make C=1) on qmc.c raises a lot of warning such as:
> ...
> warning: incorrect type in assignment (different address spaces)
> expected struct cpm_buf_desc [usertype] *[noderef] __iomem bd
> got struct cpm_buf_desc [noderef] [usertype] __iomem *txbd_free
> ...
>
> Indeed, some variable were declared 'type *__iomem var' instead of
> 'type __iomem *var'.
>
> Use the correct declaration to remove these warnings.
>
> Fixes: 3178d58e0b97 ("soc: fsl: cpm1: Add support for QMC")
> Signed-off-by: Herve Codina <herve.codina@xxxxxxxxxxx>

Reviewed-by: Christophe Leroy <christophe.leroy@xxxxxxxxxx>

> ---
> drivers/soc/fsl/qe/qmc.c | 34 +++++++++++++++++-----------------
> 1 file changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/soc/fsl/qe/qmc.c b/drivers/soc/fsl/qe/qmc.c
> index b3c292c9a14e..7ad0d77f1740 100644
> --- a/drivers/soc/fsl/qe/qmc.c
> +++ b/drivers/soc/fsl/qe/qmc.c
> @@ -175,7 +175,7 @@ struct qmc_chan {
> struct list_head list;
> unsigned int id;
> struct qmc *qmc;
> - void *__iomem s_param;
> + void __iomem *s_param;
> enum qmc_mode mode;
> u64 tx_ts_mask;
> u64 rx_ts_mask;
> @@ -203,9 +203,9 @@ struct qmc_chan {
> struct qmc {
> struct device *dev;
> struct tsa_serial *tsa_serial;
> - void *__iomem scc_regs;
> - void *__iomem scc_pram;
> - void *__iomem dpram;
> + void __iomem *scc_regs;
> + void __iomem *scc_pram;
> + void __iomem *dpram;
> u16 scc_pram_offset;
> cbd_t __iomem *bd_table;
> dma_addr_t bd_dma_addr;
> @@ -218,37 +218,37 @@ struct qmc {
> struct qmc_chan *chans[64];
> };
>
> -static inline void qmc_write16(void *__iomem addr, u16 val)
> +static inline void qmc_write16(void __iomem *addr, u16 val)
> {
> iowrite16be(val, addr);
> }
>
> -static inline u16 qmc_read16(void *__iomem addr)
> +static inline u16 qmc_read16(void __iomem *addr)
> {
> return ioread16be(addr);
> }
>
> -static inline void qmc_setbits16(void *__iomem addr, u16 set)
> +static inline void qmc_setbits16(void __iomem *addr, u16 set)
> {
> qmc_write16(addr, qmc_read16(addr) | set);
> }
>
> -static inline void qmc_clrbits16(void *__iomem addr, u16 clr)
> +static inline void qmc_clrbits16(void __iomem *addr, u16 clr)
> {
> qmc_write16(addr, qmc_read16(addr) & ~clr);
> }
>
> -static inline void qmc_write32(void *__iomem addr, u32 val)
> +static inline void qmc_write32(void __iomem *addr, u32 val)
> {
> iowrite32be(val, addr);
> }
>
> -static inline u32 qmc_read32(void *__iomem addr)
> +static inline u32 qmc_read32(void __iomem *addr)
> {
> return ioread32be(addr);
> }
>
> -static inline void qmc_setbits32(void *__iomem addr, u32 set)
> +static inline void qmc_setbits32(void __iomem *addr, u32 set)
> {
> qmc_write32(addr, qmc_read32(addr) | set);
> }
> @@ -318,7 +318,7 @@ int qmc_chan_write_submit(struct qmc_chan *chan, dma_addr_t addr, size_t length,
> {
> struct qmc_xfer_desc *xfer_desc;
> unsigned long flags;
> - cbd_t *__iomem bd;
> + cbd_t __iomem *bd;
> u16 ctrl;
> int ret;
>
> @@ -374,7 +374,7 @@ static void qmc_chan_write_done(struct qmc_chan *chan)
> void (*complete)(void *context);
> unsigned long flags;
> void *context;
> - cbd_t *__iomem bd;
> + cbd_t __iomem *bd;
> u16 ctrl;
>
> /*
> @@ -425,7 +425,7 @@ int qmc_chan_read_submit(struct qmc_chan *chan, dma_addr_t addr, size_t length,
> {
> struct qmc_xfer_desc *xfer_desc;
> unsigned long flags;
> - cbd_t *__iomem bd;
> + cbd_t __iomem *bd;
> u16 ctrl;
> int ret;
>
> @@ -488,7 +488,7 @@ static void qmc_chan_read_done(struct qmc_chan *chan)
> void (*complete)(void *context, size_t size);
> struct qmc_xfer_desc *xfer_desc;
> unsigned long flags;
> - cbd_t *__iomem bd;
> + cbd_t __iomem *bd;
> void *context;
> u16 datalen;
> u16 ctrl;
> @@ -663,7 +663,7 @@ static void qmc_chan_reset_rx(struct qmc_chan *chan)
> {
> struct qmc_xfer_desc *xfer_desc;
> unsigned long flags;
> - cbd_t *__iomem bd;
> + cbd_t __iomem *bd;
> u16 ctrl;
>
> spin_lock_irqsave(&chan->rx_lock, flags);
> @@ -694,7 +694,7 @@ static void qmc_chan_reset_tx(struct qmc_chan *chan)
> {
> struct qmc_xfer_desc *xfer_desc;
> unsigned long flags;
> - cbd_t *__iomem bd;
> + cbd_t __iomem *bd;
> u16 ctrl;
>
> spin_lock_irqsave(&chan->tx_lock, flags);