Skip to content

Commit

Permalink
use readl() and writel() instead of ioread32() and iowrite32()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ruck314 committed Feb 19, 2024
1 parent 792af04 commit 8bf52f3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions petalinux/axistreamdma/files/axistreamdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8bf52f3

Please sign in to comment.