aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2009-10-23 06:55:28 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2009-11-08 12:23:14 -0500
commit444486a5f9d2737b50e53dc140292899b9497808 (patch)
treebb3122dc35202b2b6de008706baf370441ef6a53
parent6d9a299f675b176e2f81e1f6d5a361a1173971ea (diff)
pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (ide)
ide-cs.c is the only PCMCIA device driver making use of CONFIG_PCMCIA_DEBUG, so convert it to use the dynamic debug infrastructure. Also, remove all usages of the CS_CHECK macro and replace them with proper Linux style calling and return value checking. The extra error reporting may be dropped, as the PCMCIA core already complains about any (non-driver-author) errors. CC: linux-ide@vger.kernel.org Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
-rw-r--r--drivers/ata/pata_pcmcia.c16
-rw-r--r--drivers/ide/ide-cs.c32
2 files changed, 19 insertions, 29 deletions
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c
index dc99e26f8e5b..5f94e214e17d 100644
--- a/drivers/ata/pata_pcmcia.c
+++ b/drivers/ata/pata_pcmcia.c
@@ -177,9 +177,6 @@ static struct ata_port_operations pcmcia_8bit_port_ops = {
177 .drain_fifo = pcmcia_8bit_drain_fifo, 177 .drain_fifo = pcmcia_8bit_drain_fifo,
178}; 178};
179 179
180#define CS_CHECK(fn, ret) \
181do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
182
183 180
184struct pcmcia_config_check { 181struct pcmcia_config_check {
185 unsigned long ctl_base; 182 unsigned long ctl_base;
@@ -252,7 +249,7 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
252 struct ata_port *ap; 249 struct ata_port *ap;
253 struct ata_pcmcia_info *info; 250 struct ata_pcmcia_info *info;
254 struct pcmcia_config_check *stk = NULL; 251 struct pcmcia_config_check *stk = NULL;
255 int last_ret = 0, last_fn = 0, is_kme = 0, ret = -ENOMEM, p; 252 int is_kme = 0, ret = -ENOMEM, p;
256 unsigned long io_base, ctl_base; 253 unsigned long io_base, ctl_base;
257 void __iomem *io_addr, *ctl_addr; 254 void __iomem *io_addr, *ctl_addr;
258 int n_ports = 1; 255 int n_ports = 1;
@@ -296,8 +293,13 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
296 } 293 }
297 io_base = pdev->io.BasePort1; 294 io_base = pdev->io.BasePort1;
298 ctl_base = stk->ctl_base; 295 ctl_base = stk->ctl_base;
299 CS_CHECK(RequestIRQ, pcmcia_request_irq(pdev, &pdev->irq)); 296 ret = pcmcia_request_irq(pdev, &pdev->irq);
300 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(pdev, &pdev->conf)); 297 if (ret)
298 goto failed;
299
300 ret = pcmcia_request_configuration(pdev, &pdev->conf);
301 if (ret)
302 goto failed;
301 303
302 /* iomap */ 304 /* iomap */
303 ret = -ENOMEM; 305 ret = -ENOMEM;
@@ -351,8 +353,6 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
351 kfree(stk); 353 kfree(stk);
352 return 0; 354 return 0;
353 355
354cs_failed:
355 cs_error(pdev, last_fn, last_ret);
356failed: 356failed:
357 kfree(stk); 357 kfree(stk);
358 info->ndev = 0; 358 info->ndev = 0;
diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c
index 063b933d864a..6cee6c8d0782 100644
--- a/drivers/ide/ide-cs.c
+++ b/drivers/ide/ide-cs.c
@@ -60,15 +60,6 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
60MODULE_DESCRIPTION("PCMCIA ATA/IDE card driver"); 60MODULE_DESCRIPTION("PCMCIA ATA/IDE card driver");
61MODULE_LICENSE("Dual MPL/GPL"); 61MODULE_LICENSE("Dual MPL/GPL");
62 62
63#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0)
64
65#ifdef CONFIG_PCMCIA_DEBUG
66INT_MODULE_PARM(pc_debug, 0);
67#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
68#else
69#define DEBUG(n, args...)
70#endif
71
72/*====================================================================*/ 63/*====================================================================*/
73 64
74typedef struct ide_info_t { 65typedef struct ide_info_t {
@@ -98,7 +89,7 @@ static int ide_probe(struct pcmcia_device *link)
98{ 89{
99 ide_info_t *info; 90 ide_info_t *info;
100 91
101 DEBUG(0, "ide_attach()\n"); 92 dev_dbg(&link->dev, "ide_attach()\n");
102 93
103 /* Create new ide device */ 94 /* Create new ide device */
104 info = kzalloc(sizeof(*info), GFP_KERNEL); 95 info = kzalloc(sizeof(*info), GFP_KERNEL);
@@ -134,7 +125,7 @@ static void ide_detach(struct pcmcia_device *link)
134 ide_hwif_t *hwif = info->host->ports[0]; 125 ide_hwif_t *hwif = info->host->ports[0];
135 unsigned long data_addr, ctl_addr; 126 unsigned long data_addr, ctl_addr;
136 127
137 DEBUG(0, "ide_detach(0x%p)\n", link); 128 dev_dbg(&link->dev, "ide_detach(0x%p)\n", link);
138 129
139 data_addr = hwif->io_ports.data_addr; 130 data_addr = hwif->io_ports.data_addr;
140 ctl_addr = hwif->io_ports.ctl_addr; 131 ctl_addr = hwif->io_ports.ctl_addr;
@@ -217,9 +208,6 @@ out_release:
217 208
218======================================================================*/ 209======================================================================*/
219 210
220#define CS_CHECK(fn, ret) \
221do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
222
223struct pcmcia_config_check { 211struct pcmcia_config_check {
224 unsigned long ctl_base; 212 unsigned long ctl_base;
225 int skip_vcc; 213 int skip_vcc;
@@ -282,11 +270,11 @@ static int ide_config(struct pcmcia_device *link)
282{ 270{
283 ide_info_t *info = link->priv; 271 ide_info_t *info = link->priv;
284 struct pcmcia_config_check *stk = NULL; 272 struct pcmcia_config_check *stk = NULL;
285 int last_ret = 0, last_fn = 0, is_kme = 0; 273 int ret = 0, is_kme = 0;
286 unsigned long io_base, ctl_base; 274 unsigned long io_base, ctl_base;
287 struct ide_host *host; 275 struct ide_host *host;
288 276
289 DEBUG(0, "ide_config(0x%p)\n", link); 277 dev_dbg(&link->dev, "ide_config(0x%p)\n", link);
290 278
291 is_kme = ((link->manf_id == MANFID_KME) && 279 is_kme = ((link->manf_id == MANFID_KME) &&
292 ((link->card_id == PRODID_KME_KXLC005_A) || 280 ((link->card_id == PRODID_KME_KXLC005_A) ||
@@ -306,8 +294,12 @@ static int ide_config(struct pcmcia_device *link)
306 io_base = link->io.BasePort1; 294 io_base = link->io.BasePort1;
307 ctl_base = stk->ctl_base; 295 ctl_base = stk->ctl_base;
308 296
309 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 297 ret = pcmcia_request_irq(link, &link->irq);
310 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 298 if (ret)
299 goto failed;
300 ret = pcmcia_request_configuration(link, &link->conf);
301 if (ret)
302 goto failed;
311 303
312 /* disable drive interrupts during IDE probe */ 304 /* disable drive interrupts during IDE probe */
313 outb(0x02, ctl_base); 305 outb(0x02, ctl_base);
@@ -342,8 +334,6 @@ err_mem:
342 printk(KERN_NOTICE "ide-cs: ide_config failed memory allocation\n"); 334 printk(KERN_NOTICE "ide-cs: ide_config failed memory allocation\n");
343 goto failed; 335 goto failed;
344 336
345cs_failed:
346 cs_error(link, last_fn, last_ret);
347failed: 337failed:
348 kfree(stk); 338 kfree(stk);
349 ide_release(link); 339 ide_release(link);
@@ -363,7 +353,7 @@ static void ide_release(struct pcmcia_device *link)
363 ide_info_t *info = link->priv; 353 ide_info_t *info = link->priv;
364 struct ide_host *host = info->host; 354 struct ide_host *host = info->host;
365 355
366 DEBUG(0, "ide_release(0x%p)\n", link); 356 dev_dbg(&link->dev, "ide_release(0x%p)\n", link);
367 357
368 if (info->ndev) 358 if (info->ndev)
369 /* FIXME: if this fails we need to queue the cleanup somehow 359 /* FIXME: if this fails we need to queue the cleanup somehow