aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/pcmcia_resource.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2008-08-03 05:58:53 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2008-08-22 20:29:55 -0400
commit610e23749e87920136e1a221266a43cb7e3823f1 (patch)
tree5696af5b6e7be04e17a852e6c810798930a9b6c4 /drivers/pcmcia/pcmcia_resource.c
parent635d19bea0e91df473a81391ec8f3db2d049a218 (diff)
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.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index 8f2c805e793b..35a61577ae4e 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)
251 struct pcmcia_socket *s; 251 struct pcmcia_socket *s;
252 if ((win == NULL) || (win->magic != WINDOW_MAGIC)) 252 if ((win == NULL) || (win->magic != WINDOW_MAGIC))
253 return -EINVAL; 253 return -EINVAL;
254 if (req->Page != 0)
255 return CS_BAD_PAGE;
256 s = win->sock; 254 s = win->sock;
255 if (req->Page != 0) {
256 ds_dbg(s, 0, "failure: requested page is zero\n");
257 return -EINVAL;
258 }
257 win->ctl.card_start = req->CardOffset; 259 win->ctl.card_start = req->CardOffset;
258 if (s->ops->set_mem_map(s, &win->ctl) != 0) 260 if (s->ops->set_mem_map(s, &win->ctl) != 0)
259 return CS_BAD_OFFSET; 261 return CS_BAD_OFFSET;
@@ -420,8 +422,10 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req)
420 422
421 if (c->state & CONFIG_LOCKED) 423 if (c->state & CONFIG_LOCKED)
422 return -EACCES; 424 return -EACCES;
423 if (c->irq.Attributes != req->Attributes) 425 if (c->irq.Attributes != req->Attributes) {
424 return CS_BAD_ATTRIBUTE; 426 ds_dbg(s, 0, "IRQ attributes must match assigned ones\n");
427 return -EINVAL;
428 }
425 if (s->irq.AssignedIRQ != req->AssignedIRQ) 429 if (s->irq.AssignedIRQ != req->AssignedIRQ)
426 return CS_BAD_IRQ; 430 return CS_BAD_IRQ;
427 if (--s->irq.Config == 0) { 431 if (--s->irq.Config == 0) {
@@ -613,11 +617,15 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req)
613 ds_dbg(s, 0, "IO already configured\n"); 617 ds_dbg(s, 0, "IO already configured\n");
614 return -EBUSY; 618 return -EBUSY;
615 } 619 }
616 if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)) 620 if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)) {
617 return CS_BAD_ATTRIBUTE; 621 ds_dbg(s, 0, "bad attribute setting for IO region 1\n");
622 return -EINVAL;
623 }
618 if ((req->NumPorts2 > 0) && 624 if ((req->NumPorts2 > 0) &&
619 (req->Attributes2 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS))) 625 (req->Attributes2 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS))) {
620 return CS_BAD_ATTRIBUTE; 626 ds_dbg(s, 0, "bad attribute setting for IO region 2\n");
627 return -EINVAL;
628 }
621 629
622 ds_dbg(s, 1, "trying to allocate resource 1\n"); 630 ds_dbg(s, 1, "trying to allocate resource 1\n");
623 if (alloc_io_space(s, req->Attributes1, &req->BasePort1, 631 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
783 791
784 if (!(s->state & SOCKET_PRESENT)) 792 if (!(s->state & SOCKET_PRESENT))
785 return -ENODEV; 793 return -ENODEV;
786 if (req->Attributes & (WIN_PAGED | WIN_SHARED)) 794 if (req->Attributes & (WIN_PAGED | WIN_SHARED)) {
787 return CS_BAD_ATTRIBUTE; 795 ds_dbg(s, 0, "bad attribute setting for iomem region\n");
796 return -EINVAL;
797 }
788 798
789 /* Window size defaults to smallest available */ 799 /* Window size defaults to smallest available */
790 if (req->Size == 0) 800 if (req->Size == 0)