aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/pcmcia_resource.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-09-13 10:51:36 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2010-09-15 11:57:09 -0400
commiteb838fe109b8f51ba590802761753a2631c3f7f0 (patch)
treef55b03e4c7e6ffb9e24f515b66fda8e4e914bb62 /drivers/pcmcia/pcmcia_resource.c
parentc494bc6c534c78fac2d308ad38073b9226448b0d (diff)
pcmcia: per-device, not per-socket debug messages
As the iomem / ioport setup differs per device, it is much better to print out the device instead of the socket. Tested-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/pcmcia_resource.c')
-rw-r--r--drivers/pcmcia/pcmcia_resource.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index 54aa1c238cb3..a5c176598d95 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -163,7 +163,7 @@ static int pcmcia_access_config(struct pcmcia_device *p_dev,
163 c = p_dev->function_config; 163 c = p_dev->function_config;
164 164
165 if (!(c->state & CONFIG_LOCKED)) { 165 if (!(c->state & CONFIG_LOCKED)) {
166 dev_dbg(&s->dev, "Configuration isnt't locked\n"); 166 dev_dbg(&p_dev->dev, "Configuration isnt't locked\n");
167 mutex_unlock(&s->ops_mutex); 167 mutex_unlock(&s->ops_mutex);
168 return -EACCES; 168 return -EACCES;
169 } 169 }
@@ -220,7 +220,7 @@ int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh,
220 s->win[w].card_start = offset; 220 s->win[w].card_start = offset;
221 ret = s->ops->set_mem_map(s, &s->win[w]); 221 ret = s->ops->set_mem_map(s, &s->win[w]);
222 if (ret) 222 if (ret)
223 dev_warn(&s->dev, "failed to set_mem_map\n"); 223 dev_warn(&p_dev->dev, "failed to set_mem_map\n");
224 mutex_unlock(&s->ops_mutex); 224 mutex_unlock(&s->ops_mutex);
225 return ret; 225 return ret;
226} /* pcmcia_map_mem_page */ 226} /* pcmcia_map_mem_page */
@@ -244,18 +244,18 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev,
244 c = p_dev->function_config; 244 c = p_dev->function_config;
245 245
246 if (!(s->state & SOCKET_PRESENT)) { 246 if (!(s->state & SOCKET_PRESENT)) {
247 dev_dbg(&s->dev, "No card present\n"); 247 dev_dbg(&p_dev->dev, "No card present\n");
248 ret = -ENODEV; 248 ret = -ENODEV;
249 goto unlock; 249 goto unlock;
250 } 250 }
251 if (!(c->state & CONFIG_LOCKED)) { 251 if (!(c->state & CONFIG_LOCKED)) {
252 dev_dbg(&s->dev, "Configuration isnt't locked\n"); 252 dev_dbg(&p_dev->dev, "Configuration isnt't locked\n");
253 ret = -EACCES; 253 ret = -EACCES;
254 goto unlock; 254 goto unlock;
255 } 255 }
256 256
257 if (mod->Attributes & (CONF_IRQ_CHANGE_VALID | CONF_VCC_CHANGE_VALID)) { 257 if (mod->Attributes & (CONF_IRQ_CHANGE_VALID | CONF_VCC_CHANGE_VALID)) {
258 dev_dbg(&s->dev, 258 dev_dbg(&p_dev->dev,
259 "changing Vcc or IRQ is not allowed at this time\n"); 259 "changing Vcc or IRQ is not allowed at this time\n");
260 ret = -EINVAL; 260 ret = -EINVAL;
261 goto unlock; 261 goto unlock;
@@ -265,20 +265,22 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev,
265 if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) && 265 if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) &&
266 (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { 266 (mod->Attributes & CONF_VPP2_CHANGE_VALID)) {
267 if (mod->Vpp1 != mod->Vpp2) { 267 if (mod->Vpp1 != mod->Vpp2) {
268 dev_dbg(&s->dev, "Vpp1 and Vpp2 must be the same\n"); 268 dev_dbg(&p_dev->dev,
269 "Vpp1 and Vpp2 must be the same\n");
269 ret = -EINVAL; 270 ret = -EINVAL;
270 goto unlock; 271 goto unlock;
271 } 272 }
272 s->socket.Vpp = mod->Vpp1; 273 s->socket.Vpp = mod->Vpp1;
273 if (s->ops->set_socket(s, &s->socket)) { 274 if (s->ops->set_socket(s, &s->socket)) {
274 dev_printk(KERN_WARNING, &s->dev, 275 dev_printk(KERN_WARNING, &p_dev->dev,
275 "Unable to set VPP\n"); 276 "Unable to set VPP\n");
276 ret = -EIO; 277 ret = -EIO;
277 goto unlock; 278 goto unlock;
278 } 279 }
279 } else if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) || 280 } else if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) ||
280 (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { 281 (mod->Attributes & CONF_VPP2_CHANGE_VALID)) {
281 dev_dbg(&s->dev, "changing Vcc is not allowed at this time\n"); 282 dev_dbg(&p_dev->dev,
283 "changing Vcc is not allowed at this time\n");
282 ret = -EINVAL; 284 ret = -EINVAL;
283 goto unlock; 285 goto unlock;
284 } 286 }
@@ -401,7 +403,7 @@ int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res)
401 win = &s->win[w]; 403 win = &s->win[w];
402 404
403 if (!(p_dev->_win & CLIENT_WIN_REQ(w))) { 405 if (!(p_dev->_win & CLIENT_WIN_REQ(w))) {
404 dev_dbg(&s->dev, "not releasing unknown window\n"); 406 dev_dbg(&p_dev->dev, "not releasing unknown window\n");
405 mutex_unlock(&s->ops_mutex); 407 mutex_unlock(&s->ops_mutex);
406 return -EINVAL; 408 return -EINVAL;
407 } 409 }
@@ -439,7 +441,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
439 return -ENODEV; 441 return -ENODEV;
440 442
441 if (req->IntType & INT_CARDBUS) { 443 if (req->IntType & INT_CARDBUS) {
442 dev_dbg(&s->dev, "IntType may not be INT_CARDBUS\n"); 444 dev_dbg(&p_dev->dev, "IntType may not be INT_CARDBUS\n");
443 return -EINVAL; 445 return -EINVAL;
444 } 446 }
445 447
@@ -447,7 +449,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
447 c = p_dev->function_config; 449 c = p_dev->function_config;
448 if (c->state & CONFIG_LOCKED) { 450 if (c->state & CONFIG_LOCKED) {
449 mutex_unlock(&s->ops_mutex); 451 mutex_unlock(&s->ops_mutex);
450 dev_dbg(&s->dev, "Configuration is locked\n"); 452 dev_dbg(&p_dev->dev, "Configuration is locked\n");
451 return -EACCES; 453 return -EACCES;
452 } 454 }
453 455
@@ -455,7 +457,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
455 s->socket.Vpp = req->Vpp; 457 s->socket.Vpp = req->Vpp;
456 if (s->ops->set_socket(s, &s->socket)) { 458 if (s->ops->set_socket(s, &s->socket)) {
457 mutex_unlock(&s->ops_mutex); 459 mutex_unlock(&s->ops_mutex);
458 dev_printk(KERN_WARNING, &s->dev, 460 dev_printk(KERN_WARNING, &p_dev->dev,
459 "Unable to set socket state\n"); 461 "Unable to set socket state\n");
460 return -EINVAL; 462 return -EINVAL;
461 } 463 }
@@ -569,19 +571,20 @@ int pcmcia_request_io(struct pcmcia_device *p_dev)
569 int ret = -EINVAL; 571 int ret = -EINVAL;
570 572
571 mutex_lock(&s->ops_mutex); 573 mutex_lock(&s->ops_mutex);
572 dev_dbg(&s->dev, "pcmcia_request_io: %pR , %pR", &c->io[0], &c->io[1]); 574 dev_dbg(&p_dev->dev, "pcmcia_request_io: %pR , %pR",
575 &c->io[0], &c->io[1]);
573 576
574 if (!(s->state & SOCKET_PRESENT)) { 577 if (!(s->state & SOCKET_PRESENT)) {
575 dev_dbg(&s->dev, "pcmcia_request_io: No card present\n"); 578 dev_dbg(&p_dev->dev, "pcmcia_request_io: No card present\n");
576 goto out; 579 goto out;
577 } 580 }
578 581
579 if (c->state & CONFIG_LOCKED) { 582 if (c->state & CONFIG_LOCKED) {
580 dev_dbg(&s->dev, "Configuration is locked\n"); 583 dev_dbg(&p_dev->dev, "Configuration is locked\n");
581 goto out; 584 goto out;
582 } 585 }
583 if (c->state & CONFIG_IO_REQ) { 586 if (c->state & CONFIG_IO_REQ) {
584 dev_dbg(&s->dev, "IO already configured\n"); 587 dev_dbg(&p_dev->dev, "IO already configured\n");
585 goto out; 588 goto out;
586 } 589 }
587 590
@@ -601,7 +604,7 @@ int pcmcia_request_io(struct pcmcia_device *p_dev)
601 c->state |= CONFIG_IO_REQ; 604 c->state |= CONFIG_IO_REQ;
602 p_dev->_io = 1; 605 p_dev->_io = 1;
603 606
604 dev_dbg(&s->dev, "pcmcia_request_io succeeded: %pR , %pR", 607 dev_dbg(&p_dev->dev, "pcmcia_request_io succeeded: %pR , %pR",
605 &c->io[0], &c->io[1]); 608 &c->io[0], &c->io[1]);
606out: 609out:
607 mutex_unlock(&s->ops_mutex); 610 mutex_unlock(&s->ops_mutex);
@@ -800,7 +803,7 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha
800 int w; 803 int w;
801 804
802 if (!(s->state & SOCKET_PRESENT)) { 805 if (!(s->state & SOCKET_PRESENT)) {
803 dev_dbg(&s->dev, "No card present\n"); 806 dev_dbg(&p_dev->dev, "No card present\n");
804 return -ENODEV; 807 return -ENODEV;
805 } 808 }
806 809
@@ -809,12 +812,12 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha
809 req->Size = s->map_size; 812 req->Size = s->map_size;
810 align = (s->features & SS_CAP_MEM_ALIGN) ? req->Size : s->map_size; 813 align = (s->features & SS_CAP_MEM_ALIGN) ? req->Size : s->map_size;
811 if (req->Size & (s->map_size-1)) { 814 if (req->Size & (s->map_size-1)) {
812 dev_dbg(&s->dev, "invalid map size\n"); 815 dev_dbg(&p_dev->dev, "invalid map size\n");
813 return -EINVAL; 816 return -EINVAL;
814 } 817 }
815 if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) || 818 if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) ||
816 (req->Base & (align-1))) { 819 (req->Base & (align-1))) {
817 dev_dbg(&s->dev, "invalid base address\n"); 820 dev_dbg(&p_dev->dev, "invalid base address\n");
818 return -EINVAL; 821 return -EINVAL;
819 } 822 }
820 if (req->Base) 823 if (req->Base)
@@ -826,7 +829,7 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha
826 if (!(s->state & SOCKET_WIN_REQ(w))) 829 if (!(s->state & SOCKET_WIN_REQ(w)))
827 break; 830 break;
828 if (w == MAX_WIN) { 831 if (w == MAX_WIN) {
829 dev_dbg(&s->dev, "all windows are used already\n"); 832 dev_dbg(&p_dev->dev, "all windows are used already\n");
830 mutex_unlock(&s->ops_mutex); 833 mutex_unlock(&s->ops_mutex);
831 return -EINVAL; 834 return -EINVAL;
832 } 835 }
@@ -837,7 +840,7 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha
837 win->res = pcmcia_find_mem_region(req->Base, req->Size, align, 840 win->res = pcmcia_find_mem_region(req->Base, req->Size, align,
838 0, s); 841 0, s);
839 if (!win->res) { 842 if (!win->res) {
840 dev_dbg(&s->dev, "allocating mem region failed\n"); 843 dev_dbg(&p_dev->dev, "allocating mem region failed\n");
841 mutex_unlock(&s->ops_mutex); 844 mutex_unlock(&s->ops_mutex);
842 return -EINVAL; 845 return -EINVAL;
843 } 846 }
@@ -851,7 +854,7 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha
851 win->card_start = 0; 854 win->card_start = 0;
852 855
853 if (s->ops->set_mem_map(s, win) != 0) { 856 if (s->ops->set_mem_map(s, win) != 0) {
854 dev_dbg(&s->dev, "failed to set memory mapping\n"); 857 dev_dbg(&p_dev->dev, "failed to set memory mapping\n");
855 mutex_unlock(&s->ops_mutex); 858 mutex_unlock(&s->ops_mutex);
856 return -EIO; 859 return -EIO;
857 } 860 }
@@ -874,7 +877,7 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha
874 if (win->res) 877 if (win->res)
875 request_resource(&iomem_resource, res); 878 request_resource(&iomem_resource, res);
876 879
877 dev_dbg(&s->dev, "request_window results in %pR\n", res); 880 dev_dbg(&p_dev->dev, "request_window results in %pR\n", res);
878 881
879 mutex_unlock(&s->ops_mutex); 882 mutex_unlock(&s->ops_mutex);
880 *wh = res; 883 *wh = res;