int i;
io_on.speed = io_speed;
+ mutex_lock(&s->ops_mutex);
for (i = 0; i < MAX_IO_WIN; i++) {
if (!s->io[i].res)
continue;
mdelay(40);
s->ops->set_io_map(s, &io_on);
}
+ mutex_unlock(&s->ops_mutex);
}
return 0;
}
if (c->state & CONFIG_LOCKED) {
c->state &= ~CONFIG_LOCKED;
+ mutex_lock(&s->ops_mutex);
if (c->state & CONFIG_IO_REQ)
for (i = 0; i < MAX_IO_WIN; i++) {
if (!s->io[i].res)
io.map = i;
s->ops->set_io_map(s, &io);
}
+ mutex_unlock(&s->ops_mutex);
}
return 0;
/* Configure I/O windows */
if (c->state & CONFIG_IO_REQ) {
+ mutex_lock(&s->ops_mutex);
iomap.speed = io_speed;
for (i = 0; i < MAX_IO_WIN; i++)
if (s->io[i].res) {
s->ops->set_io_map(s, &iomap);
s->io[i].Config++;
}
+ mutex_unlock(&s->ops_mutex);
}
c->state |= CONFIG_LOCKED;
return -EINVAL;
}
+ mutex_lock(&s->ops_mutex);
dev_dbg(&s->dev, "trying to allocate resource 1\n");
if (alloc_io_space(s, req->Attributes1, &req->BasePort1,
req->NumPorts1, req->IOAddrLines)) {
dev_dbg(&s->dev, "allocation of resource 1 failed\n");
+ mutex_unlock(&s->ops_mutex);
return -EBUSY;
}
req->NumPorts2, req->IOAddrLines)) {
dev_dbg(&s->dev, "allocation of resource 2 failed\n");
release_io_space(s, req->BasePort1, req->NumPorts1);
+ mutex_unlock(&s->ops_mutex);
return -EBUSY;
}
}
+ mutex_unlock(&s->ops_mutex);
c->io = *req;
c->state |= CONFIG_IO_REQ;