Skip to content

Commit

Permalink
limepcie: fix direct write/read to control port
Browse files Browse the repository at this point in the history
  • Loading branch information
rjonaitis committed Oct 10, 2024
1 parent 629f8ea commit c9d8b18
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/comms/PCIe/linux-kernel-module/limepcie.c
Original file line number Diff line number Diff line change
Expand Up @@ -892,26 +892,26 @@ static int limepcie_ctrl_open(struct inode *inode, struct file *file)

static ssize_t limepcie_ctrl_write(struct file *file, const char __user *userbuf, size_t count, loff_t *offset)
{
struct limepcie_device *s = file->private_data;
struct limepcie_data_cdev *ctrlDevice = file->private_data;
uint32_t value;
count = min(count, CSR_CNTRL_CNTRL_SIZE * sizeof(uint32_t));
for (int i = 0; i < count; i += sizeof(value))
{
if (copy_from_user(&value, userbuf + i, sizeof(value)))
return -EFAULT;
limepcie_writel(s, CSR_CNTRL_BASE + i, value);
limepcie_writel(ctrlDevice->owner, CSR_CNTRL_BASE + i, value);
}
return count;
}

static ssize_t limepcie_ctrl_read(struct file *file, char __user *userbuf, size_t count, loff_t *offset)
{
struct limepcie_device *s = file->private_data;
struct limepcie_data_cdev *ctrlDevice = file->private_data;
uint32_t value;
count = min(count, CSR_CNTRL_CNTRL_SIZE * sizeof(uint32_t));
for (int i = 0; i < count; i += sizeof(value))
{
value = limepcie_readl(s, CSR_CNTRL_BASE + i);
value = limepcie_readl(ctrlDevice->owner, CSR_CNTRL_BASE + i);
if (copy_to_user(userbuf + i, &value, sizeof(value)))
return -EFAULT;
}
Expand Down
2 changes: 1 addition & 1 deletion src/comms/PCIe/linux-kernel-module/version.in.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef LIMEPCIE_MODULE_VERSION_H
#define LIMEPCIE_MODULE_VERSION_H

#define LIMEPCIE_VERSION "0.1.5"
#define LIMEPCIE_VERSION "0.1.6"
#define LIMEPCIE_GIT_HASH "@GITHASH@"

#endif // LIMEPCIE_MODULE_VERSION_H

0 comments on commit c9d8b18

Please sign in to comment.