aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2009-10-24 09:55:39 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2009-11-09 02:30:05 -0500
commit9b44de2015ff4a2ed1d56efedfcc72b917d356a6 (patch)
tree63460e0cf95d4bbea0111d153247c3298ac4ff3d
parent7c5af6ffd69bb2bb3c86b374153627529d67598c (diff)
pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (misc drivers)
Convert PCMCIA drivers to use the dynamic debug infrastructure, instead of requiring manual settings of PCMCIA_DEBUG. 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-mtd@lists.infradead.org CC: linux-usb@vger.kernel.org Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
-rw-r--r--drivers/mtd/maps/pcmciamtd.c14
-rw-r--r--drivers/parport/parport_cs.c37
-rw-r--r--drivers/telephony/ixj_pcmcia.c36
-rw-r--r--drivers/usb/host/sl811_cs.c46
4 files changed, 41 insertions, 92 deletions
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c
index 5c3546ef29dc..b698dbaaf9e6 100644
--- a/drivers/mtd/maps/pcmciamtd.c
+++ b/drivers/mtd/maps/pcmciamtd.c
@@ -119,10 +119,8 @@ static caddr_t remap_window(struct map_info *map, unsigned long to)
119 dev->offset, mrq.CardOffset); 119 dev->offset, mrq.CardOffset);
120 mrq.Page = 0; 120 mrq.Page = 0;
121 ret = pcmcia_map_mem_page(win, &mrq); 121 ret = pcmcia_map_mem_page(win, &mrq);
122 if (ret != 0) { 122 if (ret != 0)
123 cs_error(dev->p_dev, MapMemPage, ret);
124 return NULL; 123 return NULL;
125 }
126 dev->offset = mrq.CardOffset; 124 dev->offset = mrq.CardOffset;
127 } 125 }
128 return dev->win_base + (to & (dev->win_size-1)); 126 return dev->win_base + (to & (dev->win_size-1));
@@ -327,8 +325,6 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on)
327 325
328 DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp); 326 DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp);
329 ret = pcmcia_modify_configuration(link, &mod); 327 ret = pcmcia_modify_configuration(link, &mod);
330 if (ret != 0)
331 cs_error(link, ModifyConfiguration, ret);
332} 328}
333 329
334 330
@@ -490,16 +486,12 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link,
490 * MTD device available to the system. 486 * MTD device available to the system.
491 */ 487 */
492 488
493#define CS_CHECK(fn, ret) \
494do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
495
496static int pcmciamtd_config(struct pcmcia_device *link) 489static int pcmciamtd_config(struct pcmcia_device *link)
497{ 490{
498 struct pcmciamtd_dev *dev = link->priv; 491 struct pcmciamtd_dev *dev = link->priv;
499 struct mtd_info *mtd = NULL; 492 struct mtd_info *mtd = NULL;
500 cs_status_t status; 493 cs_status_t status;
501 win_req_t req; 494 win_req_t req;
502 int last_ret = 0, last_fn = 0;
503 int ret; 495 int ret;
504 int i; 496 int i;
505 static char *probes[] = { "jedec_probe", "cfi_probe" }; 497 static char *probes[] = { "jedec_probe", "cfi_probe" };
@@ -586,7 +578,6 @@ static int pcmciamtd_config(struct pcmcia_device *link)
586 DEBUG(2, "Setting Configuration"); 578 DEBUG(2, "Setting Configuration");
587 ret = pcmcia_request_configuration(link, &link->conf); 579 ret = pcmcia_request_configuration(link, &link->conf);
588 if (ret != 0) { 580 if (ret != 0) {
589 cs_error(link, RequestConfiguration, ret);
590 if (dev->win_base) { 581 if (dev->win_base) {
591 iounmap(dev->win_base); 582 iounmap(dev->win_base);
592 dev->win_base = NULL; 583 dev->win_base = NULL;
@@ -661,8 +652,7 @@ static int pcmciamtd_config(struct pcmcia_device *link)
661 link->dev_node = &dev->node; 652 link->dev_node = &dev->node;
662 return 0; 653 return 0;
663 654
664 cs_failed: 655 failed:
665 cs_error(link, last_fn, last_ret);
666 err("CS Error, exiting"); 656 err("CS Error, exiting");
667 pcmciamtd_release(link); 657 pcmciamtd_release(link);
668 return -ENODEV; 658 return -ENODEV;
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c
index 8fdfa4f537a6..e56a4dea6717 100644
--- a/drivers/parport/parport_cs.c
+++ b/drivers/parport/parport_cs.c
@@ -67,14 +67,6 @@ MODULE_LICENSE("Dual MPL/GPL");
67 67
68INT_MODULE_PARM(epp_mode, 1); 68INT_MODULE_PARM(epp_mode, 1);
69 69
70#ifdef PCMCIA_DEBUG
71INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
72#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
73static char *version =
74"parport_cs.c 1.29 2002/10/11 06:57:41 (David Hinds)";
75#else
76#define DEBUG(n, args...)
77#endif
78 70
79/*====================================================================*/ 71/*====================================================================*/
80 72
@@ -103,7 +95,7 @@ static int parport_probe(struct pcmcia_device *link)
103{ 95{
104 parport_info_t *info; 96 parport_info_t *info;
105 97
106 DEBUG(0, "parport_attach()\n"); 98 dev_dbg(&link->dev, "parport_attach()\n");
107 99
108 /* Create new parport device */ 100 /* Create new parport device */
109 info = kzalloc(sizeof(*info), GFP_KERNEL); 101 info = kzalloc(sizeof(*info), GFP_KERNEL);
@@ -132,7 +124,7 @@ static int parport_probe(struct pcmcia_device *link)
132 124
133static void parport_detach(struct pcmcia_device *link) 125static void parport_detach(struct pcmcia_device *link)
134{ 126{
135 DEBUG(0, "parport_detach(0x%p)\n", link); 127 dev_dbg(&link->dev, "parport_detach\n");
136 128
137 parport_cs_release(link); 129 parport_cs_release(link);
138 130
@@ -147,9 +139,6 @@ static void parport_detach(struct pcmcia_device *link)
147 139
148======================================================================*/ 140======================================================================*/
149 141
150#define CS_CHECK(fn, ret) \
151do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
152
153static int parport_config_check(struct pcmcia_device *p_dev, 142static int parport_config_check(struct pcmcia_device *p_dev,
154 cistpl_cftable_entry_t *cfg, 143 cistpl_cftable_entry_t *cfg,
155 cistpl_cftable_entry_t *dflt, 144 cistpl_cftable_entry_t *dflt,
@@ -178,18 +167,20 @@ static int parport_config(struct pcmcia_device *link)
178{ 167{
179 parport_info_t *info = link->priv; 168 parport_info_t *info = link->priv;
180 struct parport *p; 169 struct parport *p;
181 int last_ret, last_fn; 170 int ret;
182 171
183 DEBUG(0, "parport_config(0x%p)\n", link); 172 dev_dbg(&link->dev, "parport_config\n");
184 173
185 last_ret = pcmcia_loop_config(link, parport_config_check, NULL); 174 ret = pcmcia_loop_config(link, parport_config_check, NULL);
186 if (last_ret) { 175 if (ret)
187 cs_error(link, RequestIO, last_ret);
188 goto failed; 176 goto failed;
189 }
190 177
191 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 178 ret = pcmcia_request_irq(link, &link->irq);
192 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 179 if (ret)
180 goto failed;
181 ret = pcmcia_request_configuration(link, &link->conf);
182 if (ret)
183 goto failed;
193 184
194 p = parport_pc_probe_port(link->io.BasePort1, link->io.BasePort2, 185 p = parport_pc_probe_port(link->io.BasePort1, link->io.BasePort2,
195 link->irq.AssignedIRQ, PARPORT_DMA_NONE, 186 link->irq.AssignedIRQ, PARPORT_DMA_NONE,
@@ -213,8 +204,6 @@ static int parport_config(struct pcmcia_device *link)
213 204
214 return 0; 205 return 0;
215 206
216cs_failed:
217 cs_error(link, last_fn, last_ret);
218failed: 207failed:
219 parport_cs_release(link); 208 parport_cs_release(link);
220 return -ENODEV; 209 return -ENODEV;
@@ -232,7 +221,7 @@ static void parport_cs_release(struct pcmcia_device *link)
232{ 221{
233 parport_info_t *info = link->priv; 222 parport_info_t *info = link->priv;
234 223
235 DEBUG(0, "parport_release(0x%p)\n", link); 224 dev_dbg(&link->dev, "parport_release\n");
236 225
237 if (info->ndev) { 226 if (info->ndev) {
238 struct parport *p = info->port; 227 struct parport *p = info->port;
diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c
index 347c3ed1d9f1..d442fd35620a 100644
--- a/drivers/telephony/ixj_pcmcia.c
+++ b/drivers/telephony/ixj_pcmcia.c
@@ -19,13 +19,6 @@
19 * PCMCIA service support for Quicknet cards 19 * PCMCIA service support for Quicknet cards
20 */ 20 */
21 21
22#ifdef PCMCIA_DEBUG
23static int pc_debug = PCMCIA_DEBUG;
24module_param(pc_debug, int, 0644);
25#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
26#else
27#define DEBUG(n, args...)
28#endif
29 22
30typedef struct ixj_info_t { 23typedef struct ixj_info_t {
31 int ndev; 24 int ndev;
@@ -39,7 +32,7 @@ static void ixj_cs_release(struct pcmcia_device * link);
39 32
40static int ixj_probe(struct pcmcia_device *p_dev) 33static int ixj_probe(struct pcmcia_device *p_dev)
41{ 34{
42 DEBUG(0, "ixj_attach()\n"); 35 dev_dbg(&p_dev->dev, "ixj_attach()\n");
43 /* Create new ixj device */ 36 /* Create new ixj device */
44 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 37 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
45 p_dev->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 38 p_dev->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
@@ -55,33 +48,30 @@ static int ixj_probe(struct pcmcia_device *p_dev)
55 48
56static void ixj_detach(struct pcmcia_device *link) 49static void ixj_detach(struct pcmcia_device *link)
57{ 50{
58 DEBUG(0, "ixj_detach(0x%p)\n", link); 51 dev_dbg(&link->dev, "ixj_detach\n");
59 52
60 ixj_cs_release(link); 53 ixj_cs_release(link);
61 54
62 kfree(link->priv); 55 kfree(link->priv);
63} 56}
64 57
65#define CS_CHECK(fn, ret) \
66do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
67
68static void ixj_get_serial(struct pcmcia_device * link, IXJ * j) 58static void ixj_get_serial(struct pcmcia_device * link, IXJ * j)
69{ 59{
70 char *str; 60 char *str;
71 int i, place; 61 int i, place;
72 DEBUG(0, "ixj_get_serial(0x%p)\n", link); 62 dev_dbg(&link->dev, "ixj_get_serial\n");
73 63
74 str = link->prod_id[0]; 64 str = link->prod_id[0];
75 if (!str) 65 if (!str)
76 goto cs_failed; 66 goto failed;
77 printk("%s", str); 67 printk("%s", str);
78 str = link->prod_id[1]; 68 str = link->prod_id[1];
79 if (!str) 69 if (!str)
80 goto cs_failed; 70 goto failed;
81 printk(" %s", str); 71 printk(" %s", str);
82 str = link->prod_id[2]; 72 str = link->prod_id[2];
83 if (!str) 73 if (!str)
84 goto cs_failed; 74 goto failed;
85 place = 1; 75 place = 1;
86 for (i = strlen(str) - 1; i >= 0; i--) { 76 for (i = strlen(str) - 1; i >= 0; i--) {
87 switch (str[i]) { 77 switch (str[i]) {
@@ -118,9 +108,9 @@ static void ixj_get_serial(struct pcmcia_device * link, IXJ * j)
118 } 108 }
119 str = link->prod_id[3]; 109 str = link->prod_id[3];
120 if (!str) 110 if (!str)
121 goto cs_failed; 111 goto failed;
122 printk(" version %s\n", str); 112 printk(" version %s\n", str);
123 cs_failed: 113failed:
124 return; 114 return;
125} 115}
126 116
@@ -151,13 +141,13 @@ static int ixj_config(struct pcmcia_device * link)
151 cistpl_cftable_entry_t dflt = { 0 }; 141 cistpl_cftable_entry_t dflt = { 0 };
152 142
153 info = link->priv; 143 info = link->priv;
154 DEBUG(0, "ixj_config(0x%p)\n", link); 144 dev_dbg(&link->dev, "ixj_config\n");
155 145
156 if (pcmcia_loop_config(link, ixj_config_check, &dflt)) 146 if (pcmcia_loop_config(link, ixj_config_check, &dflt))
157 goto cs_failed; 147 goto failed;
158 148
159 if (pcmcia_request_configuration(link, &link->conf)) 149 if (pcmcia_request_configuration(link, &link->conf))
160 goto cs_failed; 150 goto failed;
161 151
162 /* 152 /*
163 * Register the card with the core. 153 * Register the card with the core.
@@ -170,7 +160,7 @@ static int ixj_config(struct pcmcia_device * link)
170 ixj_get_serial(link, j); 160 ixj_get_serial(link, j);
171 return 0; 161 return 0;
172 162
173 cs_failed: 163failed:
174 ixj_cs_release(link); 164 ixj_cs_release(link);
175 return -ENODEV; 165 return -ENODEV;
176} 166}
@@ -178,7 +168,7 @@ static int ixj_config(struct pcmcia_device * link)
178static void ixj_cs_release(struct pcmcia_device *link) 168static void ixj_cs_release(struct pcmcia_device *link)
179{ 169{
180 ixj_info_t *info = link->priv; 170 ixj_info_t *info = link->priv;
181 DEBUG(0, "ixj_cs_release(0x%p)\n", link); 171 dev_dbg(&link->dev, "ixj_cs_release\n");
182 info->ndev = 0; 172 info->ndev = 0;
183 pcmcia_disable_device(link); 173 pcmcia_disable_device(link);
184} 174}
diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c
index 516848dd9b48..46077420dea5 100644
--- a/drivers/usb/host/sl811_cs.c
+++ b/drivers/usb/host/sl811_cs.c
@@ -37,28 +37,8 @@ MODULE_LICENSE("GPL");
37/* MACROS */ 37/* MACROS */
38/*====================================================================*/ 38/*====================================================================*/
39 39
40#if defined(DEBUG) || defined(PCMCIA_DEBUG)
41
42static int pc_debug = 0;
43module_param(pc_debug, int, 0644);
44
45#define DBG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG "sl811_cs: " args)
46
47#else
48#define DBG(n, args...) do{}while(0)
49#endif /* no debugging */
50
51#define INFO(args...) printk(KERN_INFO "sl811_cs: " args) 40#define INFO(args...) printk(KERN_INFO "sl811_cs: " args)
52 41
53#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0444)
54
55#define CS_CHECK(fn, ret) \
56 do { \
57 last_fn = (fn); \
58 if ((last_ret = (ret)) != 0) \
59 goto cs_failed; \
60 } while (0)
61
62/*====================================================================*/ 42/*====================================================================*/
63/* VARIABLES */ 43/* VARIABLES */
64/*====================================================================*/ 44/*====================================================================*/
@@ -76,7 +56,7 @@ static void sl811_cs_release(struct pcmcia_device * link);
76 56
77static void release_platform_dev(struct device * dev) 57static void release_platform_dev(struct device * dev)
78{ 58{
79 DBG(0, "sl811_cs platform_dev release\n"); 59 dev_dbg(dev, "sl811_cs platform_dev release\n");
80 dev->parent = NULL; 60 dev->parent = NULL;
81} 61}
82 62
@@ -140,7 +120,7 @@ static int sl811_hc_init(struct device *parent, resource_size_t base_addr,
140 120
141static void sl811_cs_detach(struct pcmcia_device *link) 121static void sl811_cs_detach(struct pcmcia_device *link)
142{ 122{
143 DBG(0, "sl811_cs_detach(0x%p)\n", link); 123 dev_dbg(&link->dev, "sl811_cs_detach\n");
144 124
145 sl811_cs_release(link); 125 sl811_cs_release(link);
146 126
@@ -150,7 +130,7 @@ static void sl811_cs_detach(struct pcmcia_device *link)
150 130
151static void sl811_cs_release(struct pcmcia_device * link) 131static void sl811_cs_release(struct pcmcia_device * link)
152{ 132{
153 DBG(0, "sl811_cs_release(0x%p)\n", link); 133 dev_dbg(&link->dev, "sl811_cs_release\n");
154 134
155 pcmcia_disable_device(link); 135 pcmcia_disable_device(link);
156 platform_device_unregister(&platform_dev); 136 platform_device_unregister(&platform_dev);
@@ -207,9 +187,9 @@ static int sl811_cs_config(struct pcmcia_device *link)
207{ 187{
208 struct device *parent = &handle_to_dev(link); 188 struct device *parent = &handle_to_dev(link);
209 local_info_t *dev = link->priv; 189 local_info_t *dev = link->priv;
210 int last_fn, last_ret; 190 int ret;
211 191
212 DBG(0, "sl811_cs_config(0x%p)\n", link); 192 dev_dbg(&link->dev, "sl811_cs_config\n");
213 193
214 if (pcmcia_loop_config(link, sl811_cs_config_check, NULL)) 194 if (pcmcia_loop_config(link, sl811_cs_config_check, NULL))
215 goto failed; 195 goto failed;
@@ -217,14 +197,16 @@ static int sl811_cs_config(struct pcmcia_device *link)
217 /* require an IRQ and two registers */ 197 /* require an IRQ and two registers */
218 if (!link->io.NumPorts1 || link->io.NumPorts1 < 2) 198 if (!link->io.NumPorts1 || link->io.NumPorts1 < 2)
219 goto failed; 199 goto failed;
220 if (link->conf.Attributes & CONF_ENABLE_IRQ) 200 if (link->conf.Attributes & CONF_ENABLE_IRQ) {
221 CS_CHECK(RequestIRQ, 201 ret = pcmcia_request_irq(link, &link->irq);
222 pcmcia_request_irq(link, &link->irq)); 202 if (ret)
223 else 203 goto failed;
204 } else
224 goto failed; 205 goto failed;
225 206
226 CS_CHECK(RequestConfiguration, 207 ret = pcmcia_request_configuration(link, &link->conf);
227 pcmcia_request_configuration(link, &link->conf)); 208 if (ret)
209 goto failed;
228 210
229 sprintf(dev->node.dev_name, driver_name); 211 sprintf(dev->node.dev_name, driver_name);
230 dev->node.major = dev->node.minor = 0; 212 dev->node.major = dev->node.minor = 0;
@@ -241,8 +223,6 @@ static int sl811_cs_config(struct pcmcia_device *link)
241 223
242 if (sl811_hc_init(parent, link->io.BasePort1, link->irq.AssignedIRQ) 224 if (sl811_hc_init(parent, link->io.BasePort1, link->irq.AssignedIRQ)
243 < 0) { 225 < 0) {
244cs_failed:
245 cs_error(link, last_fn, last_ret);
246failed: 226failed:
247 printk(KERN_WARNING "sl811_cs_config failed\n"); 227 printk(KERN_WARNING "sl811_cs_config failed\n");
248 sl811_cs_release(link); 228 sl811_cs_release(link);