aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/cs.c3
-rw-r--r--drivers/pcmcia/pcmcia_resource.c53
2 files changed, 43 insertions, 13 deletions
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index b0ec9c614ce7..b229f6d9e443 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -752,14 +752,17 @@ int pcmcia_reset_card(struct pcmcia_socket *skt)
752 mutex_lock(&skt->skt_mutex); 752 mutex_lock(&skt->skt_mutex);
753 do { 753 do {
754 if (!(skt->state & SOCKET_PRESENT)) { 754 if (!(skt->state & SOCKET_PRESENT)) {
755 dev_dbg(&skt->dev, "can't reset, not present\n");
755 ret = -ENODEV; 756 ret = -ENODEV;
756 break; 757 break;
757 } 758 }
758 if (skt->state & SOCKET_SUSPEND) { 759 if (skt->state & SOCKET_SUSPEND) {
760 dev_dbg(&skt->dev, "can't reset, suspended\n");
759 ret = -EBUSY; 761 ret = -EBUSY;
760 break; 762 break;
761 } 763 }
762 if (skt->state & SOCKET_CARDBUS) { 764 if (skt->state & SOCKET_CARDBUS) {
765 dev_dbg(&skt->dev, "can't reset, is cardbus\n");
763 ret = -EPERM; 766 ret = -EPERM;
764 break; 767 break;
765 } 768 }
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index 349bc5662fff..cda48ea9b6fd 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -159,8 +159,10 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev,
159 s = p_dev->socket; 159 s = p_dev->socket;
160 c = p_dev->function_config; 160 c = p_dev->function_config;
161 161
162 if (!(c->state & CONFIG_LOCKED)) 162 if (!(c->state & CONFIG_LOCKED)) {
163 dev_dbg(&s->dev, "Configuration isnt't locked\n");
163 return -EACCES; 164 return -EACCES;
165 }
164 166
165 addr = (c->ConfigBase + reg->Offset) >> 1; 167 addr = (c->ConfigBase + reg->Offset) >> 1;
166 168
@@ -174,6 +176,7 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev,
174 pcmcia_write_cis_mem(s, 1, addr, 1, &val); 176 pcmcia_write_cis_mem(s, 1, addr, 1, &val);
175 break; 177 break;
176 default: 178 default:
179 dev_dbg(&s->dev, "Invalid conf register request\n");
177 return -EINVAL; 180 return -EINVAL;
178 break; 181 break;
179 } 182 }
@@ -264,10 +267,14 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev,
264 s = p_dev->socket; 267 s = p_dev->socket;
265 c = p_dev->function_config; 268 c = p_dev->function_config;
266 269
267 if (!(s->state & SOCKET_PRESENT)) 270 if (!(s->state & SOCKET_PRESENT)) {
271 dev_dbg(&s->dev, "No card present\n");
268 return -ENODEV; 272 return -ENODEV;
269 if (!(c->state & CONFIG_LOCKED)) 273 }
274 if (!(c->state & CONFIG_LOCKED)) {
275 dev_dbg(&s->dev, "Configuration isnt't locked\n");
270 return -EACCES; 276 return -EACCES;
277 }
271 278
272 if (mod->Attributes & CONF_IRQ_CHANGE_VALID) { 279 if (mod->Attributes & CONF_IRQ_CHANGE_VALID) {
273 if (mod->Attributes & CONF_ENABLE_IRQ) { 280 if (mod->Attributes & CONF_ENABLE_IRQ) {
@@ -442,8 +449,10 @@ int pcmcia_release_window(window_handle_t win)
442 if ((win == NULL) || (win->magic != WINDOW_MAGIC)) 449 if ((win == NULL) || (win->magic != WINDOW_MAGIC))
443 return -EINVAL; 450 return -EINVAL;
444 s = win->sock; 451 s = win->sock;
445 if (!(win->handle->_win & CLIENT_WIN_REQ(win->index))) 452 if (!(win->handle->_win & CLIENT_WIN_REQ(win->index))) {
453 dev_dbg(&s->dev, "not releasing unknown window\n");
446 return -EINVAL; 454 return -EINVAL;
455 }
447 456
448 /* Shut down memory window */ 457 /* Shut down memory window */
449 win->ctl.flags &= ~MAP_ACTIVE; 458 win->ctl.flags &= ~MAP_ACTIVE;
@@ -482,8 +491,10 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
482 return -EINVAL; 491 return -EINVAL;
483 } 492 }
484 c = p_dev->function_config; 493 c = p_dev->function_config;
485 if (c->state & CONFIG_LOCKED) 494 if (c->state & CONFIG_LOCKED) {
495 dev_dbg(&s->dev, "Configuration is locked\n");
486 return -EACCES; 496 return -EACCES;
497 }
487 498
488 /* Do power control. We don't allow changes in Vcc. */ 499 /* Do power control. We don't allow changes in Vcc. */
489 s->socket.Vpp = req->Vpp; 500 s->socket.Vpp = req->Vpp;
@@ -595,14 +606,18 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req)
595 struct pcmcia_socket *s = p_dev->socket; 606 struct pcmcia_socket *s = p_dev->socket;
596 config_t *c; 607 config_t *c;
597 608
598 if (!(s->state & SOCKET_PRESENT)) 609 if (!(s->state & SOCKET_PRESENT)) {
610 dev_dbg(&s->dev, "No card present\n");
599 return -ENODEV; 611 return -ENODEV;
612 }
600 613
601 if (!req) 614 if (!req)
602 return -EINVAL; 615 return -EINVAL;
603 c = p_dev->function_config; 616 c = p_dev->function_config;
604 if (c->state & CONFIG_LOCKED) 617 if (c->state & CONFIG_LOCKED) {
618 dev_dbg(&s->dev, "Configuration is locked\n");
605 return -EACCES; 619 return -EACCES;
620 }
606 if (c->state & CONFIG_IO_REQ) { 621 if (c->state & CONFIG_IO_REQ) {
607 dev_dbg(&s->dev, "IO already configured\n"); 622 dev_dbg(&s->dev, "IO already configured\n");
608 return -EBUSY; 623 return -EBUSY;
@@ -666,11 +681,15 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
666 int ret = -EINVAL, irq = 0; 681 int ret = -EINVAL, irq = 0;
667 int type; 682 int type;
668 683
669 if (!(s->state & SOCKET_PRESENT)) 684 if (!(s->state & SOCKET_PRESENT)) {
685 dev_dbg(&s->dev, "No card present\n");
670 return -ENODEV; 686 return -ENODEV;
687 }
671 c = p_dev->function_config; 688 c = p_dev->function_config;
672 if (c->state & CONFIG_LOCKED) 689 if (c->state & CONFIG_LOCKED) {
690 dev_dbg(&s->dev, "Configuration is locked\n");
673 return -EACCES; 691 return -EACCES;
692 }
674 if (c->state & CONFIG_IRQ_REQ) { 693 if (c->state & CONFIG_IRQ_REQ) {
675 dev_dbg(&s->dev, "IRQ already configured\n"); 694 dev_dbg(&s->dev, "IRQ already configured\n");
676 return -EBUSY; 695 return -EBUSY;
@@ -731,8 +750,10 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
731#endif 750#endif
732 /* only assign PCI irq if no IRQ already assigned */ 751 /* only assign PCI irq if no IRQ already assigned */
733 if (ret && !s->irq.AssignedIRQ) { 752 if (ret && !s->irq.AssignedIRQ) {
734 if (!s->pci_irq) 753 if (!s->pci_irq) {
754 dev_printk(KERN_INFO, &s->dev, "no IRQ found\n");
735 return ret; 755 return ret;
756 }
736 type = IRQF_SHARED; 757 type = IRQF_SHARED;
737 irq = s->pci_irq; 758 irq = s->pci_irq;
738 } 759 }
@@ -740,8 +761,11 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
740 if (ret && (req->Attributes & IRQ_HANDLE_PRESENT)) { 761 if (ret && (req->Attributes & IRQ_HANDLE_PRESENT)) {
741 ret = request_irq(irq, req->Handler, type, 762 ret = request_irq(irq, req->Handler, type,
742 p_dev->devname, req->Instance); 763 p_dev->devname, req->Instance);
743 if (ret) 764 if (ret) {
765 dev_printk(KERN_INFO, &s->dev,
766 "request_irq() failed\n");
744 return ret; 767 return ret;
768 }
745 } 769 }
746 770
747 /* Make sure the fact the request type was overridden is passed back */ 771 /* Make sure the fact the request type was overridden is passed back */
@@ -780,8 +804,10 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h
780 u_long align; 804 u_long align;
781 int w; 805 int w;
782 806
783 if (!(s->state & SOCKET_PRESENT)) 807 if (!(s->state & SOCKET_PRESENT)) {
808 dev_dbg(&s->dev, "No card present\n");
784 return -ENODEV; 809 return -ENODEV;
810 }
785 if (req->Attributes & (WIN_PAGED | WIN_SHARED)) { 811 if (req->Attributes & (WIN_PAGED | WIN_SHARED)) {
786 dev_dbg(&s->dev, "bad attribute setting for iomem region\n"); 812 dev_dbg(&s->dev, "bad attribute setting for iomem region\n");
787 return -EINVAL; 813 return -EINVAL;
@@ -1020,7 +1046,8 @@ static int pcmcia_do_get_tuple(struct pcmcia_device *p_dev, tuple_t *tuple,
1020 if (*get->buf) { 1046 if (*get->buf) {
1021 get->len = tuple->TupleDataLen; 1047 get->len = tuple->TupleDataLen;
1022 memcpy(*get->buf, tuple->TupleData, tuple->TupleDataLen); 1048 memcpy(*get->buf, tuple->TupleData, tuple->TupleDataLen);
1023 } 1049 } else
1050 dev_dbg(&p_dev->dev, "do_get_tuple: out of memory\n");
1024 return 0; 1051 return 0;
1025}; 1052};
1026 1053