提交 69ba4433 编写于 作者: D Dominik Brodowski

pcmcia: deprecate CS_BAD_BASE, CS_BAD_IRQ, CS_BAD_OFFSET and CS_BAD_SIZE

These four error values mostly mean a badly written driver, so ds_dbg()
output and -EINVAL seems to be enough.
Signed-off-by: NDominik Brodowski <linux@dominikbrodowski.net>
上级 610e2374
......@@ -75,10 +75,6 @@ typedef struct lookup_t {
static const lookup_t error_table[] = {
{ 0, "Operation succeeded" },
{ CS_BAD_BASE, "Bad base address" },
{ CS_BAD_IRQ, "Bad IRQ" },
{ CS_BAD_OFFSET, "Bad offset" },
{ CS_BAD_SIZE, "Bad size" },
{ -EIO, "Input/Output error" },
{ -ENODEV, "No card present" },
{ -EINVAL, "Bad parameter" },
......
......@@ -149,7 +149,7 @@ static int adjust_irq(struct pcmcia_socket *s, adjust_t *adj)
irq = adj->resource.irq.IRQ;
if ((irq < 0) || (irq > 15))
return CS_BAD_IRQ;
return -EINVAL;
if (adj->Action != REMOVE_MANAGED_RESOURCE)
return 0;
......@@ -970,8 +970,7 @@ static int ds_ioctl(struct inode * inode, struct file * file,
case -ENOSYS:
err = ret;
break;
case CS_BAD_ARGS: case CS_BAD_IRQ:
case CS_BAD_TUPLE:
case CS_BAD_ARGS: case CS_BAD_TUPLE:
err = -EINVAL; break;
case -ENOMEM:
err = -ENOSPC; break;
......
......@@ -257,8 +257,10 @@ int pcmcia_map_mem_page(window_handle_t win, memreq_t *req)
return -EINVAL;
}
win->ctl.card_start = req->CardOffset;
if (s->ops->set_mem_map(s, &win->ctl) != 0)
return CS_BAD_OFFSET;
if (s->ops->set_mem_map(s, &win->ctl) != 0) {
ds_dbg(s, 0, "failed to set_mem_map\n");
return -EIO;
}
return 0;
} /* pcmcia_map_mem_page */
EXPORT_SYMBOL(pcmcia_map_mem_page);
......@@ -426,8 +428,10 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req)
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.AssignedIRQ != req->AssignedIRQ) {
ds_dbg(s, 0, "IRQ must match assigned one\n");
return -EINVAL;
}
if (--s->irq.Config == 0) {
c->state &= ~CONFIG_IRQ_REQ;
s->irq.AssignedIRQ = 0;
......@@ -802,11 +806,15 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h
align = (((s->features & SS_CAP_MEM_ALIGN) ||
(req->Attributes & WIN_STRICT_ALIGN)) ?
req->Size : s->map_size);
if (req->Size & (s->map_size-1))
return CS_BAD_SIZE;
if (req->Size & (s->map_size-1)) {
ds_dbg(s, 0, "invalid map size\n");
return -EINVAL;
}
if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) ||
(req->Base & (align-1)))
return CS_BAD_BASE;
(req->Base & (align-1))) {
ds_dbg(s, 0, "invalid base address\n");
return -EINVAL;
}
if (req->Base)
align = 0;
......
......@@ -291,13 +291,13 @@ typedef struct error_info_t {
#define CS_SUCCESS 0x00
#define CS_BAD_ADAPTER -ENODEV
#define CS_BAD_ATTRIBUTE -EINVAL
#define CS_BAD_BASE 0x03
#define CS_BAD_BASE -EINVAL
#define CS_BAD_EDC -ENODEV
#define CS_BAD_IRQ 0x06
#define CS_BAD_OFFSET 0x07
#define CS_BAD_IRQ -EINVAL
#define CS_BAD_OFFSET -EIO
#define CS_BAD_PAGE -EINVAL
#define CS_READ_FAILURE -EIO
#define CS_BAD_SIZE 0x0a
#define CS_BAD_SIZE -EINVAL
#define CS_BAD_SOCKET -EINVAL
#define CS_BAD_TYPE -EINVAL
#define CS_BAD_VCC -EINVAL
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册