aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pcmcia/cs.c6
-rw-r--r--drivers/pcmcia/ds.c9
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c16
-rw-r--r--drivers/pcmcia/pcmcia_resource.c30
4 files changed, 34 insertions, 27 deletions
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index 1c6c8c8f57c..48386f31e61 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -451,7 +451,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
if (status & SS_CARDBUS) {
if (!(skt->features & SS_CAP_CARDBUS)) {
cs_err(skt, "cardbus cards are not supported.\n");
- return CS_BAD_TYPE;
+ return -EINVAL;
}
skt->state |= SOCKET_CARDBUS;
}
@@ -465,7 +465,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
skt->socket.Vcc = skt->socket.Vpp = 50;
else {
cs_err(skt, "unsupported voltage key.\n");
- return CS_BAD_TYPE;
+ return -EIO;
}
if (skt->power_hook)
@@ -482,7 +482,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
skt->ops->get_status(skt, &status);
if (!(status & SS_POWERON)) {
cs_err(skt, "unable to apply power.\n");
- return CS_BAD_TYPE;
+ return -EIO;
}
status = socket_reset(skt);
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 591d9627bb2..4092a5976e6 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -74,22 +74,19 @@ typedef struct lookup_t {
} lookup_t;
static const lookup_t error_table[] = {
- { CS_SUCCESS, "Operation succeeded" },
- { CS_BAD_ATTRIBUTE, "Bad attribute", },
+ { 0, "Operation succeeded" },
{ CS_BAD_BASE, "Bad base address" },
{ CS_BAD_IRQ, "Bad IRQ" },
{ CS_BAD_OFFSET, "Bad offset" },
- { CS_BAD_PAGE, "Bad page number" },
{ CS_BAD_SIZE, "Bad size" },
- { CS_BAD_TYPE, "Bad type" },
{ -EIO, "Input/Output error" },
{ -ENODEV, "No card present" },
{ -EINVAL, "Bad parameter" },
{ CS_BAD_ARGS, "Bad arguments" },
{ -EACCES, "Configuration locked" },
- { CS_IN_USE, "Resource in use" },
+ { -EBUSY, "Resource in use" },
{ -ENOSPC, "No more items" },
- { CS_OUT_OF_RESOURCE, "Out of resource" },
+ { -ENOMEM, "Out of resource" },
{ CS_BAD_TUPLE, "Bad CIS tuple" }
};
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index a6289e5a75e..e27c71ebfda 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -964,19 +964,19 @@ static int ds_ioctl(struct inode * inode, struct file * file,
if ((err == 0) && (ret != 0)) {
ds_dbg(2, "ds_ioctl: ret = %d\n", ret);
switch (ret) {
- case CS_BAD_SOCKET: case CS_NO_CARD:
- err = -ENODEV; break;
- case CS_BAD_ARGS: case CS_BAD_ATTRIBUTE: case CS_BAD_IRQ:
+ case -ENODEV:
+ case -EINVAL:
+ case -EBUSY:
+ case -ENOSYS:
+ err = ret;
+ break;
+ case CS_BAD_ARGS: case CS_BAD_IRQ:
case CS_BAD_TUPLE:
err = -EINVAL; break;
- case CS_IN_USE:
- err = -EBUSY; break;
- case CS_OUT_OF_RESOURCE:
+ case -ENOMEM:
err = -ENOSPC; break;
case -ENOSPC:
err = -ENODATA; break;
- case -ENOSYS:
- err = -ENOSYS; break;
default:
err = -EIO; break;
}
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index 8f2c805e793..35a61577ae4 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -251,9 +251,11 @@ int pcmcia_map_mem_page(window_handle_t win, memreq_t *req)
struct pcmcia_socket *s;
if ((win == NULL) || (win->magic != WINDOW_MAGIC))
return -EINVAL;
- if (req->Page != 0)
- return CS_BAD_PAGE;
s = win->sock;
+ if (req->Page != 0) {
+ ds_dbg(s, 0, "failure: requested page is zero\n");
+ return -EINVAL;
+ }
win->ctl.card_start = req->CardOffset;
if (s->ops->set_mem_map(s, &win->ctl) != 0)
return CS_BAD_OFFSET;
@@ -420,8 +422,10 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req)
if (c->state & CONFIG_LOCKED)
return -EACCES;
- if (c->irq.Attributes != req->Attributes)
- return CS_BAD_ATTRIBUTE;
+ if (c->irq.Attributes != req->Attributes) {
+ ds_dbg(s, 0, "IRQ attributes must match assigned ones\n");
+ return -EINVAL;
+ }
if (s->irq.AssignedIRQ != req->AssignedIRQ)
return CS_BAD_IRQ;
if (--s->irq.Config == 0) {
@@ -613,11 +617,15 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req)
ds_dbg(s, 0, "IO already configured\n");
return -EBUSY;
}
- if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS))
- return CS_BAD_ATTRIBUTE;
+ if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)) {
+ ds_dbg(s, 0, "bad attribute setting for IO region 1\n");
+ return -EINVAL;
+ }
if ((req->NumPorts2 > 0) &&
- (req->Attributes2 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)))
- return CS_BAD_ATTRIBUTE;
+ (req->Attributes2 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS))) {
+ ds_dbg(s, 0, "bad attribute setting for IO region 2\n");
+ return -EINVAL;
+ }
ds_dbg(s, 1, "trying to allocate resource 1\n");
if (alloc_io_space(s, req->Attributes1, &req->BasePort1,
@@ -783,8 +791,10 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h
if (!(s->state & SOCKET_PRESENT))
return -ENODEV;
- if (req->Attributes & (WIN_PAGED | WIN_SHARED))
- return CS_BAD_ATTRIBUTE;
+ if (req->Attributes & (WIN_PAGED | WIN_SHARED)) {
+ ds_dbg(s, 0, "bad attribute setting for iomem region\n");
+ return -EINVAL;
+ }
/* Window size defaults to smallest available */
if (req->Size == 0)