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 18, 2024
1 parent c120d00 commit df014a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions petalinux/aximemorymap/files/aximemorymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ ssize_t Map_Ioctl(struct file *filp, uint32_t cmd, unsigned long arg) {

if ( (base = Map_Find(rData.address)) == NULL ) return(-1);

iowrite32(rData.data,base);
writel(rData.data, base);
return(0);
break;

Expand All @@ -266,7 +266,7 @@ ssize_t Map_Ioctl(struct file *filp, uint32_t cmd, unsigned long arg) {
}

if ( (base = Map_Find(rData.address)) == NULL ) return(-1);
rData.data = ioread32(base);
rData.data = readl(base);

// Return the data structure
if ((ret=copy_to_user((void *)arg,&rData,sizeof(struct DmaRegisterData)))) {
Expand Down

0 comments on commit df014a6

Please sign in to comment.