diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2008-08-03 11:58:53 +0200 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2008-08-23 02:29:55 +0200 |
commit | 610e23749e87920136e1a221266a43cb7e3823f1 (patch) | |
tree | 5696af5b6e7be04e17a852e6c810798930a9b6c4 /drivers/pcmcia/pcmcia_resource.c | |
parent | 635d19bea0e91df473a81391ec8f3db2d049a218 (diff) | |
download | op-kernel-dev-610e23749e87920136e1a221266a43cb7e3823f1.zip op-kernel-dev-610e23749e87920136e1a221266a43cb7e3823f1.tar.gz |
pcmcia: deprecate CS_BAD_ATTRIBUTE, CS_BAD_TYPE and CS_BAD_PAGE
CS_BAD_TYPE was only used in cs.c and already properly annotated by error
messages. CS_BAD_ATTRIBUTE and CS_BAD_PAGE mean a badly written driver, so
ds_dbg() output and -EINVAL seems to be enough.
(includes bugfix from and
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
)
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/pcmcia_resource.c')
-rw-r--r-- | drivers/pcmcia/pcmcia_resource.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 8f2c805..35a6157 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) |