m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pci.c5
-rw-r--r--private_data.h4
-rw-r--r--surface.c8
3 files changed, 8 insertions, 9 deletions
diff --git a/pci.c b/pci.c
index 0402647..3c45d9b 100644
--- a/pci.c
+++ b/pci.c
@@ -20,7 +20,6 @@ irqreturn_t doom_irq(int irq, void *dev)
uint32_t interrupts;
struct doom_data *doom_data;
-
doom_data = dev;
interrupts = get_interrupts(doom_data->iomem);
@@ -59,8 +58,8 @@ int init_pci(struct pci_dev *dev)
pci_set_dma_mask(dev, DMA_BIT_MASK(32));
pci_set_consistent_dma_mask(dev, DMA_BIT_MASK(32));
- mutex_init(&doom_data->mutex);
- sema_init(&doom_data->ping_sem, 1);
+ mutex_init(&doom_data->cmd_mutex);
+ mutex_init(&doom_data->ping_mutex);
sema_init(&doom_data->pong_sem, 0);
ORFAIL(request_irq(dev->irq, doom_irq, IRQF_SHARED,
diff --git a/private_data.h b/private_data.h
index 39ceba8..0325b93 100644
--- a/private_data.h
+++ b/private_data.h
@@ -9,8 +9,8 @@ struct doom_data {
struct device *device;
struct device *pci_device;
void __iomem *iomem;
- struct mutex mutex;
- struct semaphore ping_sem;
+ struct mutex cmd_mutex;
+ struct mutex ping_mutex;
struct semaphore pong_sem;
};
diff --git a/surface.c b/surface.c
index 87304ab..27e1eae 100644
--- a/surface.c
+++ b/surface.c
@@ -22,13 +22,13 @@ long draw_lines(struct file *filp, unsigned long arg)
param = (struct doomdev_surf_ioctl_draw_lines *) arg;
lines = (struct doomdev_line *) param->lines_ptr;
- mutex_lock(&surface_data->doom_data->mutex);
+ mutex_lock(&surface_data->doom_data->cmd_mutex);
for (i = 0; i < param->lines_num; i++) {
draw_line(surface_data, lines[i]);
}
- mutex_unlock(&surface_data->doom_data->mutex);
+ mutex_unlock(&surface_data->doom_data->cmd_mutex);
return param->lines_num;
}
@@ -58,7 +58,7 @@ ssize_t surface_read(struct file *filp, char __user *buf, size_t count,
count = surface_data->surface_size - *offset;
}
- mutex_lock(&surface_data->doom_data->mutex);
+ mutex_lock(&surface_data->doom_data->ping_mutex);
ping_sync(surface_data->doom_data->iomem);
down(&surface_data->doom_data->pong_sem);
@@ -68,7 +68,7 @@ ssize_t surface_read(struct file *filp, char __user *buf, size_t count,
*offset += count - not_written;
- mutex_unlock(&surface_data->doom_data->mutex);
+ mutex_unlock(&surface_data->doom_data->ping_mutex);
return count - not_written;
}