Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 181991
b: refs/heads/master
c: 8533ee3
h: refs/heads/master
i:
  181989: 786834c
  181987: e4c2336
  181983: 341e2c1
v: v3
  • Loading branch information
Dominik Brodowski committed Feb 17, 2010
1 parent 8960f82 commit 439882f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8680c4b3faa298dc768c2a78a94a84d89854eca9
refs/heads/master: 8533ee31cdc08fc1f2533e5f21f8e4abf6a57dfc
10 changes: 10 additions & 0 deletions trunk/drivers/pcmcia/pcmcia_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev,
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;
Expand All @@ -320,6 +321,7 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev,
mdelay(40);
s->ops->set_io_map(s, &io_on);
}
mutex_unlock(&s->ops_mutex);
}

return 0;
Expand All @@ -345,6 +347,7 @@ int pcmcia_release_configuration(struct pcmcia_device *p_dev)
}
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)
Expand All @@ -355,6 +358,7 @@ int pcmcia_release_configuration(struct pcmcia_device *p_dev)
io.map = i;
s->ops->set_io_map(s, &io);
}
mutex_unlock(&s->ops_mutex);
}

return 0;
Expand Down Expand Up @@ -562,6 +566,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,

/* 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) {
Expand All @@ -580,6 +585,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
s->ops->set_io_map(s, &iomap);
s->io[i].Config++;
}
mutex_unlock(&s->ops_mutex);
}

c->state |= CONFIG_LOCKED;
Expand Down Expand Up @@ -625,10 +631,12 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req)
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;
}

Expand All @@ -638,9 +646,11 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req)
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;
Expand Down

0 comments on commit 439882f

Please sign in to comment.