EDAC, pnd2: Use proper I/O accessors and address space annotation
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 6 Jun 2022 16:41:33 +0000 (19:41 +0300)
committerLee Jones <lee@kernel.org>
Thu, 14 Jul 2022 09:50:36 +0000 (10:50 +0100)
The driver uses rather voodoo kind of castings and I/O accessors.
Replace it with proper __iomem annotation and readl()/readq() calls.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Henning Schild <henning.schild@siemens.com>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/edac/pnd2_edac.c

index c94ca1f..7d1df12 100644 (file)
@@ -265,7 +265,7 @@ static u64 get_sideband_reg_base_addr(void)
 static int dnv_rd_reg(int port, int off, int op, void *data, size_t sz, char *name)
 {
        struct pci_dev *pdev;
-       char *base;
+       void __iomem *base;
        u64 addr;
        unsigned long size;
 
@@ -297,8 +297,9 @@ static int dnv_rd_reg(int port, int off, int op, void *data, size_t sz, char *na
                        return -ENODEV;
 
                if (sz == 8)
-                       *(u32 *)(data + 4) = *(u32 *)(base + off + 4);
-               *(u32 *)data = *(u32 *)(base + off);
+                       *(u64 *)data = readq(base + off);
+               else
+                       *(u32 *)data = readl(base + off);
 
                iounmap(base);
        }