Commit 6d9a299f authored by Dominik Brodowski's avatar Dominik Brodowski

pcmcia: extend error reporting and debug messages in core

Add a few more error and debug messages to the PCMCIA core.
Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
parent c9f50ddd
...@@ -752,14 +752,17 @@ int pcmcia_reset_card(struct pcmcia_socket *skt) ...@@ -752,14 +752,17 @@ int pcmcia_reset_card(struct pcmcia_socket *skt)
mutex_lock(&skt->skt_mutex); mutex_lock(&skt->skt_mutex);
do { do {
if (!(skt->state & SOCKET_PRESENT)) { if (!(skt->state & SOCKET_PRESENT)) {
dev_dbg(&skt->dev, "can't reset, not present\n");
ret = -ENODEV; ret = -ENODEV;
break; break;
} }
if (skt->state & SOCKET_SUSPEND) { if (skt->state & SOCKET_SUSPEND) {
dev_dbg(&skt->dev, "can't reset, suspended\n");
ret = -EBUSY; ret = -EBUSY;
break; break;
} }
if (skt->state & SOCKET_CARDBUS) { if (skt->state & SOCKET_CARDBUS) {
dev_dbg(&skt->dev, "can't reset, is cardbus\n");
ret = -EPERM; ret = -EPERM;
break; break;
} }
......
...@@ -159,8 +159,10 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, ...@@ -159,8 +159,10 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev,
s = p_dev->socket; s = p_dev->socket;
c = p_dev->function_config; c = p_dev->function_config;
if (!(c->state & CONFIG_LOCKED)) if (!(c->state & CONFIG_LOCKED)) {
dev_dbg(&s->dev, "Configuration isnt't locked\n");
return -EACCES; return -EACCES;
}
addr = (c->ConfigBase + reg->Offset) >> 1; addr = (c->ConfigBase + reg->Offset) >> 1;
...@@ -174,6 +176,7 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, ...@@ -174,6 +176,7 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev,
pcmcia_write_cis_mem(s, 1, addr, 1, &val); pcmcia_write_cis_mem(s, 1, addr, 1, &val);
break; break;
default: default:
dev_dbg(&s->dev, "Invalid conf register request\n");
return -EINVAL; return -EINVAL;
break; break;
} }
...@@ -264,10 +267,14 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev, ...@@ -264,10 +267,14 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev,
s = p_dev->socket; s = p_dev->socket;
c = p_dev->function_config; c = p_dev->function_config;
if (!(s->state & SOCKET_PRESENT)) if (!(s->state & SOCKET_PRESENT)) {
dev_dbg(&s->dev, "No card present\n");
return -ENODEV; return -ENODEV;
if (!(c->state & CONFIG_LOCKED)) }
if (!(c->state & CONFIG_LOCKED)) {
dev_dbg(&s->dev, "Configuration isnt't locked\n");
return -EACCES; return -EACCES;
}
if (mod->Attributes & CONF_IRQ_CHANGE_VALID) { if (mod->Attributes & CONF_IRQ_CHANGE_VALID) {
if (mod->Attributes & CONF_ENABLE_IRQ) { if (mod->Attributes & CONF_ENABLE_IRQ) {
...@@ -442,8 +449,10 @@ int pcmcia_release_window(window_handle_t win) ...@@ -442,8 +449,10 @@ int pcmcia_release_window(window_handle_t win)
if ((win == NULL) || (win->magic != WINDOW_MAGIC)) if ((win == NULL) || (win->magic != WINDOW_MAGIC))
return -EINVAL; return -EINVAL;
s = win->sock; s = win->sock;
if (!(win->handle->_win & CLIENT_WIN_REQ(win->index))) if (!(win->handle->_win & CLIENT_WIN_REQ(win->index))) {
dev_dbg(&s->dev, "not releasing unknown window\n");
return -EINVAL; return -EINVAL;
}
/* Shut down memory window */ /* Shut down memory window */
win->ctl.flags &= ~MAP_ACTIVE; win->ctl.flags &= ~MAP_ACTIVE;
...@@ -482,8 +491,10 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, ...@@ -482,8 +491,10 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
return -EINVAL; return -EINVAL;
} }
c = p_dev->function_config; c = p_dev->function_config;
if (c->state & CONFIG_LOCKED) if (c->state & CONFIG_LOCKED) {
dev_dbg(&s->dev, "Configuration is locked\n");
return -EACCES; return -EACCES;
}
/* Do power control. We don't allow changes in Vcc. */ /* Do power control. We don't allow changes in Vcc. */
s->socket.Vpp = req->Vpp; s->socket.Vpp = req->Vpp;
...@@ -595,14 +606,18 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req) ...@@ -595,14 +606,18 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req)
struct pcmcia_socket *s = p_dev->socket; struct pcmcia_socket *s = p_dev->socket;
config_t *c; config_t *c;
if (!(s->state & SOCKET_PRESENT)) if (!(s->state & SOCKET_PRESENT)) {
dev_dbg(&s->dev, "No card present\n");
return -ENODEV; return -ENODEV;
}
if (!req) if (!req)
return -EINVAL; return -EINVAL;
c = p_dev->function_config; c = p_dev->function_config;
if (c->state & CONFIG_LOCKED) if (c->state & CONFIG_LOCKED) {
dev_dbg(&s->dev, "Configuration is locked\n");
return -EACCES; return -EACCES;
}
if (c->state & CONFIG_IO_REQ) { if (c->state & CONFIG_IO_REQ) {
dev_dbg(&s->dev, "IO already configured\n"); dev_dbg(&s->dev, "IO already configured\n");
return -EBUSY; return -EBUSY;
...@@ -666,11 +681,15 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) ...@@ -666,11 +681,15 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
int ret = -EINVAL, irq = 0; int ret = -EINVAL, irq = 0;
int type; int type;
if (!(s->state & SOCKET_PRESENT)) if (!(s->state & SOCKET_PRESENT)) {
dev_dbg(&s->dev, "No card present\n");
return -ENODEV; return -ENODEV;
}
c = p_dev->function_config; c = p_dev->function_config;
if (c->state & CONFIG_LOCKED) if (c->state & CONFIG_LOCKED) {
dev_dbg(&s->dev, "Configuration is locked\n");
return -EACCES; return -EACCES;
}
if (c->state & CONFIG_IRQ_REQ) { if (c->state & CONFIG_IRQ_REQ) {
dev_dbg(&s->dev, "IRQ already configured\n"); dev_dbg(&s->dev, "IRQ already configured\n");
return -EBUSY; return -EBUSY;
...@@ -731,8 +750,10 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) ...@@ -731,8 +750,10 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
#endif #endif
/* only assign PCI irq if no IRQ already assigned */ /* only assign PCI irq if no IRQ already assigned */
if (ret && !s->irq.AssignedIRQ) { if (ret && !s->irq.AssignedIRQ) {
if (!s->pci_irq) if (!s->pci_irq) {
dev_printk(KERN_INFO, &s->dev, "no IRQ found\n");
return ret; return ret;
}
type = IRQF_SHARED; type = IRQF_SHARED;
irq = s->pci_irq; irq = s->pci_irq;
} }
...@@ -740,8 +761,11 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) ...@@ -740,8 +761,11 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
if (ret && (req->Attributes & IRQ_HANDLE_PRESENT)) { if (ret && (req->Attributes & IRQ_HANDLE_PRESENT)) {
ret = request_irq(irq, req->Handler, type, ret = request_irq(irq, req->Handler, type,
p_dev->devname, req->Instance); p_dev->devname, req->Instance);
if (ret) if (ret) {
dev_printk(KERN_INFO, &s->dev,
"request_irq() failed\n");
return ret; return ret;
}
} }
/* Make sure the fact the request type was overridden is passed back */ /* 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,8 +804,10 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h
u_long align; u_long align;
int w; int w;
if (!(s->state & SOCKET_PRESENT)) if (!(s->state & SOCKET_PRESENT)) {
dev_dbg(&s->dev, "No card present\n");
return -ENODEV; return -ENODEV;
}
if (req->Attributes & (WIN_PAGED | WIN_SHARED)) { if (req->Attributes & (WIN_PAGED | WIN_SHARED)) {
dev_dbg(&s->dev, "bad attribute setting for iomem region\n"); dev_dbg(&s->dev, "bad attribute setting for iomem region\n");
return -EINVAL; return -EINVAL;
...@@ -1020,7 +1046,8 @@ static int pcmcia_do_get_tuple(struct pcmcia_device *p_dev, tuple_t *tuple, ...@@ -1020,7 +1046,8 @@ static int pcmcia_do_get_tuple(struct pcmcia_device *p_dev, tuple_t *tuple,
if (*get->buf) { if (*get->buf) {
get->len = tuple->TupleDataLen; get->len = tuple->TupleDataLen;
memcpy(*get->buf, tuple->TupleData, tuple->TupleDataLen); memcpy(*get->buf, tuple->TupleData, tuple->TupleDataLen);
} } else
dev_dbg(&p_dev->dev, "do_get_tuple: out of memory\n");
return 0; return 0;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment