Commit d5187fef authored by Wesley W. Terpstra's avatar Wesley W. Terpstra

pcie_wb: mutex no longer required, and sleeping in MSI routines is safe

parent b1fd2e52
......@@ -60,14 +60,10 @@ static void wb_cycle(struct wishbone* wb, int on)
dev = container_of(wb, struct pcie_wb_dev, wb);
control = dev->pci_res[0].addr;
if (on) mutex_lock(&dev->mutex);
if (unlikely(debug))
printk(KERN_ALERT PCIE_WB ": cycle(%d)\n", on);
iowrite32((on?0x80000000UL:0) + 0x40000000UL, control + CONTROL_REGISTER_HIGH);
if (!on) mutex_unlock(&dev->mutex);
}
static void wb_byteenable(struct wishbone* wb, unsigned char be)
......@@ -216,8 +212,6 @@ static wb_data_t wb_read_cfg(struct wishbone *wb, wb_addr_t addr)
static int wb_request(struct wishbone *wb, struct wishbone_request *req)
{
/* All forms of sleep are forbidden in this method (no printk/mutex/etc) */
struct pcie_wb_dev* dev;
unsigned char* control;
uint32_t ctl;
......@@ -243,8 +237,6 @@ static int wb_request(struct wishbone *wb, struct wishbone_request *req)
static void wb_reply(struct wishbone *wb, int err, wb_data_t data)
{
/* All forms of sleep are forbidden in this method (no printk/mutex/etc) */
struct pcie_wb_dev* dev;
unsigned char* control;
......@@ -268,8 +260,6 @@ static const struct wishbone_operations wb_ops = {
static irqreturn_t irq_handler(int irq, void *dev_id)
{
/* All forms of sleep are forbidden in this method (no printk/mutex/etc) */
struct pcie_wb_dev *dev = dev_id;
pcie_int_enable(dev, 0);
......@@ -348,7 +338,6 @@ static int probe(struct pci_dev *pdev, const struct pci_device_id *id)
dev->wb.wops = &wb_ops;
dev->wb.parent = &pdev->dev;
dev->wb.mask = 0xffff;
mutex_init(&dev->mutex);
dev->window_offset = 0;
dev->low_addr = 0;
dev->width = 4;
......
......@@ -43,7 +43,6 @@ struct pcie_wb_dev {
int msi;
struct wishbone wb;
struct mutex mutex; /* only one user can open a cycle at a time */
unsigned int window_offset;
unsigned int low_addr, width, shift;
};
......
......@@ -37,12 +37,8 @@ static void wb_cycle(struct wishbone* wb, int on)
dev = container_of(wb, struct spec_wb_dev, wb);
if (on) mutex_lock(&dev->mutex);
if (unlikely(debug))
printk(KERN_ALERT SPEC_WB ": cycle(%d)\n", on);
if (!on) mutex_unlock(&dev->mutex);
}
static void wb_byteenable(struct wishbone* wb, unsigned char be)
......@@ -270,7 +266,6 @@ static int probe(struct pci_dev *pdev, const struct pci_device_id *id)
dev->wb.parent = &pdev->dev;
dev->wb.mask = 0; // not MSI capable
dev->msi = 1;
mutex_init(&dev->mutex);
dev->window_offset = 0;
dev->low_addr = 0;
dev->width = 4;
......
......@@ -34,7 +34,6 @@ struct spec_wb_dev {
int msi;
struct wishbone wb;
struct mutex mutex; /* only one user can open a cycle at a time */
unsigned int window_offset;
unsigned int low_addr, width, shift;
};
......
......@@ -49,17 +49,11 @@ static void wb_cycle(struct wishbone *wb, int on)
ctrl_win = dev->vme_res.map[MAP_CTRL]->kernel_va;
if (on)
mutex_lock(&dev->mutex);
if (unlikely(debug))
printk(KERN_ALERT ": Cycle(%d)\n", on);
iowrite32(cpu_to_be32((on ? 0x80000000UL : 0) + 0x40000000UL),
ctrl_win + CTRL);
if (!on)
mutex_unlock(&dev->mutex);
}
static wb_data_t wb_read_cfg(struct wishbone *wb, wb_addr_t addr)
......@@ -154,8 +148,6 @@ static wb_data_t wb_read(struct wishbone *wb, wb_addr_t addr)
static int wb_request(struct wishbone *wb, struct wishbone_request *req)
{
/* All forms of sleep are forbidden in this method (no printk/mutex/etc) */
struct vme_wb_dev *dev;
unsigned char *ctrl_win;
uint32_t ctrl;
......@@ -178,8 +170,6 @@ static int wb_request(struct wishbone *wb, struct wishbone_request *req)
static void wb_reply(struct wishbone *wb, int err, wb_data_t data)
{
/* All forms of sleep are forbidden in this method (no printk/mutex/etc) */
struct vme_wb_dev *dev;
unsigned char *ctrl_win;
......@@ -229,8 +219,6 @@ static void init_ctrl_reg(struct vme_wb_dev *dev)
int irq_handler(void *dev_id)
{
/* All forms of sleep are forbidden in this method (no printk/mutex/etc) */
struct vme_wb_dev *dev = dev_id;
wishbone_slave_ready(&dev->wb);
......@@ -443,7 +431,6 @@ static int vme_probe(struct device *pdev, unsigned int ndev)
dev->vme_res.vector = vector[ndev];
dev->vme_res.level = level[ndev]; /* Default value */
dev->vme_dev = pdev;
mutex_init(&dev->mutex);
dev->wb.wops = &wb_ops;
dev->wb.parent = pdev;
dev->wb.mask = 0xffff;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment