Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 188116
b: refs/heads/master
c: 4e06e24
h: refs/heads/master
v: v3
  • Loading branch information
Jiri Slaby authored and Dominik Brodowski committed Mar 16, 2010
1 parent 555738f commit 4f80996
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e794c01b7de40d180417eacbd910e8f31f2fafeb
refs/heads/master: 4e06e240dcbb803433ee31bfe89a3e785a77cd3b
28 changes: 16 additions & 12 deletions trunk/drivers/pcmcia/pcmcia_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev,
{
struct pcmcia_socket *s;
config_t *c;
int ret;

s = p_dev->socket;

Expand All @@ -264,13 +265,13 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev,

if (!(s->state & SOCKET_PRESENT)) {
dev_dbg(&s->dev, "No card present\n");
mutex_unlock(&s->ops_mutex);
return -ENODEV;
ret = -ENODEV;
goto unlock;
}
if (!(c->state & CONFIG_LOCKED)) {
dev_dbg(&s->dev, "Configuration isnt't locked\n");
mutex_unlock(&s->ops_mutex);
return -EACCES;
ret = -EACCES;
goto unlock;
}

if (mod->Attributes & CONF_IRQ_CHANGE_VALID) {
Expand All @@ -286,29 +287,30 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev,

if (mod->Attributes & CONF_VCC_CHANGE_VALID) {
dev_dbg(&s->dev, "changing Vcc is not allowed at this time\n");
return -EINVAL;
ret = -EINVAL;
goto unlock;
}

/* We only allow changing Vpp1 and Vpp2 to the same value */
if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) &&
(mod->Attributes & CONF_VPP2_CHANGE_VALID)) {
if (mod->Vpp1 != mod->Vpp2) {
dev_dbg(&s->dev, "Vpp1 and Vpp2 must be the same\n");
mutex_unlock(&s->ops_mutex);
return -EINVAL;
ret = -EINVAL;
goto unlock;
}
s->socket.Vpp = mod->Vpp1;
if (s->ops->set_socket(s, &s->socket)) {
mutex_unlock(&s->ops_mutex);
dev_printk(KERN_WARNING, &s->dev,
"Unable to set VPP\n");
return -EIO;
ret = -EIO;
goto unlock;
}
} else if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) ||
(mod->Attributes & CONF_VPP2_CHANGE_VALID)) {
dev_dbg(&s->dev, "changing Vcc is not allowed at this time\n");
mutex_unlock(&s->ops_mutex);
return -EINVAL;
ret = -EINVAL;
goto unlock;
}

if (mod->Attributes & CONF_IO_CHANGE_WIDTH) {
Expand All @@ -332,9 +334,11 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev,
s->ops->set_io_map(s, &io_on);
}
}
ret = 0;
unlock:
mutex_unlock(&s->ops_mutex);

return 0;
return ret;
} /* modify_configuration */
EXPORT_SYMBOL(pcmcia_modify_configuration);

Expand Down

0 comments on commit 4f80996

Please sign in to comment.