From 8bf52f39e91bb5b6b0bc2ff20a98d18b122d2c0b Mon Sep 17 00:00:00 2001 From: Larry Ruckman Date: Sun, 18 Feb 2024 19:10:36 -0800 Subject: [PATCH] use readl() and writel() instead of ioread32() and iowrite32() These changes replace the direct I/O access functions with the recommended memory-mapped I/O functions, improving portability and security within the kernel module. --- petalinux/axistreamdma/files/axistreamdma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/petalinux/axistreamdma/files/axistreamdma.c b/petalinux/axistreamdma/files/axistreamdma.c index a5a4066..f8f9f40 100755 --- a/petalinux/axistreamdma/files/axistreamdma.c +++ b/petalinux/axistreamdma/files/axistreamdma.c @@ -188,14 +188,14 @@ int Rce_Probe(struct platform_device *pdev) { // Set hardware functions // Version 2 - if ( ((ioread32(dev->reg) >> 24) & 0xFF) >= 2 ) { + if ( ((readl(dev->reg) >> 24) & 0xFF) >= 2 ) { dev->hwFunc = &(AxisG2_functions); } // Version 1 else { - iowrite32(0x1,((uint8_t *)dev->reg)+0x8); - if ( ioread32(((uint8_t *)dev->reg)+0x8) != 0x1 ) { + writel(0x1,((uint8_t *)dev->reg)+0x8); + if ( readl(((uint8_t *)dev->reg)+0x8) != 0x1 ) { release_mem_region(dev->baseAddr, dev->baseSize); dev_info(dev->device,"Probe: Empty register space. Exiting\n"); return(-1);