Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ static unsigned int mxdma_device_poll(struct file *file, poll_table *wait)
struct mx_pci_dev *mx_pdev;
struct mx_event *mx_event;
unsigned int mask = 0;
int flag;
int count;

mx_cdev = (struct mx_char_dev *)file->private_data;
if (!mx_cdev) {
Expand Down Expand Up @@ -271,11 +271,11 @@ static unsigned int mxdma_device_poll(struct file *file, poll_table *wait)

mx_event = &mx_pdev->event;
poll_wait(file, &mx_event->wq, wait);
flag = atomic_read(&mx_event->flag);
if (flag) {
count = atomic_read(&mx_event->count);
if (count > 0) {
atomic_dec(&mx_event->count);
mask = POLLIN | POLLRDNORM;
}
atomic_set(&mx_event->flag, 0);

return mask;
}
Expand Down
34 changes: 17 additions & 17 deletions init.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,31 @@ static void mx_event_init(struct mx_pci_dev *mx_pdev)
struct mx_event *mx_event = &mx_pdev->event;

init_waitqueue_head(&mx_event->wq);
atomic_set(&mx_event->flag, 0);
atomic_set(&mx_event->count, 0);
}

static irqreturn_t msi_irq_handler(int irq, void *data)
{
struct mx_pci_dev *mx_pdev;
struct mx_event *mx_event;
struct mx_pci_dev *mx_pdev;
struct mx_event *mx_event;

mx_pdev = (struct mx_pci_dev *)data;
if (mx_pdev == NULL) {
pr_err("Invalid data\n");
goto out;
}
mx_pdev = (struct mx_pci_dev *)data;
if (mx_pdev == NULL) {
pr_err("Invalid data\n");
goto out;
}

mx_event = &(mx_pdev->event);
if (mx_event == NULL) {
pr_err("Invalid event\n");
goto out;
}
mx_event = &(mx_pdev->event);
if (mx_event == NULL) {
pr_err("Invalid event\n");
goto out;
}

atomic_set(&mx_event->flag, 1);
wake_up_interruptible(&mx_event->wq);
atomic_inc(&mx_event->count);
wake_up_interruptible(&mx_event->wq);

out:
return IRQ_HANDLED;
return IRQ_HANDLED;
}

static void pci_device_exit(struct mx_pci_dev *mx_pdev, struct pci_dev *pdev)
Expand Down Expand Up @@ -390,7 +390,7 @@ int mxdma_driver_probe(struct pci_dev *pdev, const struct pci_device_id *id, int
}

pr_info("pci device is probed (vendor=%#x device=%#x bdf=%s cxl=mem%d)\n",
pdev->vendor, pdev->device, dev_name(&pdev->dev), cxl_memdev_id);
pdev->vendor, pdev->device, dev_name(&pdev->dev), cxl_memdev_id);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion mx_dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ struct mx_char_dev {
};

struct mx_event {
atomic_t flag;
atomic_t count;
wait_queue_head_t wq;
};

Expand Down
5 changes: 4 additions & 1 deletion transfer.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ static int mx_command_init_common(struct mx_transfer *transfer, int opcode)

id = transfer_id_alloc(transfer);
if (id < 0) {
pr_warn("Failed to trasfer_id_alloc\n");
pr_warn("Failed to trasfer_id_alloc (err=%d)\n", id);
return -ENOMEM;
}

Expand Down Expand Up @@ -342,9 +342,12 @@ static int mx_transfer_init_ctrl(struct mx_transfer *transfer, int opcode)

static int mx_transfer_destroy_ctrl(struct mx_transfer *transfer)
{
struct mx_command *comm = &transfer->cmd;
uint64_t value;
int ret;

transfer_id_free(comm->id);

if (transfer->dir != DMA_FROM_DEVICE)
return 0;

Expand Down