]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
soc: ti: knav_qmss: Fix __iomem annotations and __be32 type
authorNishanth Menon <nm@ti.com>
Tue, 12 May 2026 17:06:18 +0000 (12:06 -0500)
committerNishanth Menon <nm@ti.com>
Fri, 22 May 2026 15:55:55 +0000 (10:55 -0500)
Fix several address-space and type annotation issues reported by sparse:

- Change pdsp->command from 'void __iomem *' to 'u32 __iomem *' to
  match the other union members (acc_command, qos_command); adjust
  the offset in knav_queue_load_pdsp() from +0x18 to +0x6 to
  preserve the 24-byte offset.
- Fix knav_queue_pdsp_wait() declaration: correct the parameter
  annotation from 'u32 * __iomem' (pointer-in-iomem-space) to
  'u32 __iomem *' (pointer-to-iomem); use 'unsigned int' for the
  timeout parameter instead of bare 'unsigned'; fix the continuation-
  line alignment.
- Use IOMEM_ERR_PTR() in knav_queue_map_reg() instead of ERR_PTR()
  when returning an error as void __iomem *.
- Annotate the firmware data array as 'const __be32 *' instead of
  'u32 *', as be32_to_cpu() requires __be32 input.

Reviewed-by: Sai Sree Kartheek Adivi <s-adivi@ti.com>
Reviewed-by: Hari Prasath Gujulan Elango <gehariprasath@ti.com>
Link: https://patch.msgid.link/20260512170623.3174416-7-nm@ti.com
Signed-off-by: Nishanth Menon <nm@ti.com>
drivers/soc/ti/knav_qmss.h
drivers/soc/ti/knav_qmss_queue.c

index 9325e8ce2e25c78b633f7c1caf0100f559684dfb..037dc1b3664535b1911794a586dee80bf44d8b60 100644 (file)
@@ -123,7 +123,7 @@ struct knav_pdsp_info {
        const char                                      *name;
        struct knav_reg_pdsp_regs  __iomem              *regs;
        union {
-               void __iomem                            *command;
+               u32 __iomem                             *command;
                struct knav_reg_acc_command __iomem     *acc_command;
                u32 __iomem                             *qos_command;
        };
index 8af88a143159e57bc15742e9e80e19f14dfaec86..7410b63af0e62751ad4bdf5a012a777b70ebab27 100644 (file)
@@ -477,8 +477,8 @@ static int knav_queue_debug_show(struct seq_file *s, void *v)
 
 DEFINE_SHOW_ATTRIBUTE(knav_queue_debug);
 
-static inline int knav_queue_pdsp_wait(u32 * __iomem addr, unsigned timeout,
-                                       u32 flags)
+static inline int knav_queue_pdsp_wait(u32 __iomem *addr, unsigned int timeout,
+                                      u32 flags)
 {
        unsigned long end;
        u32 val = 0;
@@ -1368,7 +1368,7 @@ static void __iomem *knav_queue_map_reg(struct knav_device *kdev,
        if (ret) {
                dev_err(kdev->dev, "Can't translate of node(%pOFn) address for index(%d)\n",
                        node, index);
-               return ERR_PTR(ret);
+               return IOMEM_ERR_PTR(ret);
        }
 
        regs = devm_ioremap_resource(kdev->dev, &res);
@@ -1556,7 +1556,7 @@ static int knav_queue_load_pdsp(struct knav_device *kdev,
        int i, ret, fwlen;
        const struct firmware *fw;
        bool found = false;
-       u32 *fwdata;
+       const __be32 *fwdata;
 
        for (i = 0; i < ARRAY_SIZE(knav_acc_firmwares); i++) {
                if (knav_acc_firmwares[i]) {
@@ -1578,9 +1578,9 @@ static int knav_queue_load_pdsp(struct knav_device *kdev,
        dev_info(kdev->dev, "firmware file %s downloaded for PDSP\n",
                 knav_acc_firmwares[i]);
 
-       writel_relaxed(pdsp->id + 1, pdsp->command + 0x18);
+       writel_relaxed(pdsp->id + 1, pdsp->command + 0x6);
        /* download the firmware */
-       fwdata = (u32 *)fw->data;
+       fwdata = (const __be32 *)fw->data;
        fwlen = (fw->size + sizeof(u32) - 1) / sizeof(u32);
        for (i = 0; i < fwlen; i++)
                writel_relaxed(be32_to_cpu(fwdata[i]), pdsp->iram + i);