aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2009-10-24 09:54:14 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2009-11-09 02:30:03 -0500
commit3e7166178a83fef690dcbfcdaeda192f7282a9a4 (patch)
tree3bf45f6d67858964d303e6848ef1cd326625d2b7 /drivers
parent2caff14713d53abba273e6095495788e2720f756 (diff)
pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (scsi)
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-scsi@vger.kernel.org Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/pcmcia/aha152x_stub.c41
-rw-r--r--drivers/scsi/pcmcia/fdomain_stub.c43
-rw-r--r--drivers/scsi/pcmcia/qlogic_stub.c44
-rw-r--r--drivers/scsi/pcmcia/sym53c500_cs.c41
4 files changed, 60 insertions, 109 deletions
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
index 67cde0138061..4329e4e5043d 100644
--- a/drivers/scsi/pcmcia/aha152x_stub.c
+++ b/drivers/scsi/pcmcia/aha152x_stub.c
@@ -54,15 +54,6 @@
54#include <pcmcia/cistpl.h> 54#include <pcmcia/cistpl.h>
55#include <pcmcia/ds.h> 55#include <pcmcia/ds.h>
56 56
57#ifdef PCMCIA_DEBUG
58static int pc_debug = PCMCIA_DEBUG;
59module_param(pc_debug, int, 0644);
60#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
61static char *version =
62"aha152x_cs.c 1.54 2000/06/12 21:27:25 (David Hinds)";
63#else
64#define DEBUG(n, args...)
65#endif
66 57
67/*====================================================================*/ 58/*====================================================================*/
68 59
@@ -103,7 +94,7 @@ static int aha152x_probe(struct pcmcia_device *link)
103{ 94{
104 scsi_info_t *info; 95 scsi_info_t *info;
105 96
106 DEBUG(0, "aha152x_attach()\n"); 97 dev_dbg(&link->dev, "aha152x_attach()\n");
107 98
108 /* Create new SCSI device */ 99 /* Create new SCSI device */
109 info = kzalloc(sizeof(*info), GFP_KERNEL); 100 info = kzalloc(sizeof(*info), GFP_KERNEL);
@@ -127,7 +118,7 @@ static int aha152x_probe(struct pcmcia_device *link)
127 118
128static void aha152x_detach(struct pcmcia_device *link) 119static void aha152x_detach(struct pcmcia_device *link)
129{ 120{
130 DEBUG(0, "aha152x_detach(0x%p)\n", link); 121 dev_dbg(&link->dev, "aha152x_detach\n");
131 122
132 aha152x_release_cs(link); 123 aha152x_release_cs(link);
133 124
@@ -137,9 +128,6 @@ static void aha152x_detach(struct pcmcia_device *link)
137 128
138/*====================================================================*/ 129/*====================================================================*/
139 130
140#define CS_CHECK(fn, ret) \
141do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
142
143static int aha152x_config_check(struct pcmcia_device *p_dev, 131static int aha152x_config_check(struct pcmcia_device *p_dev,
144 cistpl_cftable_entry_t *cfg, 132 cistpl_cftable_entry_t *cfg,
145 cistpl_cftable_entry_t *dflt, 133 cistpl_cftable_entry_t *dflt,
@@ -164,19 +152,22 @@ static int aha152x_config_cs(struct pcmcia_device *link)
164{ 152{
165 scsi_info_t *info = link->priv; 153 scsi_info_t *info = link->priv;
166 struct aha152x_setup s; 154 struct aha152x_setup s;
167 int last_ret, last_fn; 155 int ret;
168 struct Scsi_Host *host; 156 struct Scsi_Host *host;
169 157
170 DEBUG(0, "aha152x_config(0x%p)\n", link); 158 dev_dbg(&link->dev, "aha152x_config\n");
171 159
172 last_ret = pcmcia_loop_config(link, aha152x_config_check, NULL); 160 ret = pcmcia_loop_config(link, aha152x_config_check, NULL);
173 if (last_ret) { 161 if (ret)
174 cs_error(link, RequestIO, last_ret); 162 goto failed;
175 goto failed;
176 }
177 163
178 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 164 ret = pcmcia_request_irq(link, &link->irq);
179 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 165 if (ret)
166 goto failed;
167
168 ret = pcmcia_request_configuration(link, &link->conf);
169 if (ret)
170 goto failed;
180 171
181 /* Set configuration options for the aha152x driver */ 172 /* Set configuration options for the aha152x driver */
182 memset(&s, 0, sizeof(s)); 173 memset(&s, 0, sizeof(s));
@@ -194,7 +185,7 @@ static int aha152x_config_cs(struct pcmcia_device *link)
194 host = aha152x_probe_one(&s); 185 host = aha152x_probe_one(&s);
195 if (host == NULL) { 186 if (host == NULL) {
196 printk(KERN_INFO "aha152x_cs: no SCSI devices found\n"); 187 printk(KERN_INFO "aha152x_cs: no SCSI devices found\n");
197 goto cs_failed; 188 goto failed;
198 } 189 }
199 190
200 sprintf(info->node.dev_name, "scsi%d", host->host_no); 191 sprintf(info->node.dev_name, "scsi%d", host->host_no);
@@ -203,8 +194,6 @@ static int aha152x_config_cs(struct pcmcia_device *link)
203 194
204 return 0; 195 return 0;
205 196
206cs_failed:
207 cs_error(link, last_fn, last_ret);
208failed: 197failed:
209 aha152x_release_cs(link); 198 aha152x_release_cs(link);
210 return -ENODEV; 199 return -ENODEV;
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c
index 06254f46a0dd..5792b55c9d3c 100644
--- a/drivers/scsi/pcmcia/fdomain_stub.c
+++ b/drivers/scsi/pcmcia/fdomain_stub.c
@@ -59,16 +59,6 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
59MODULE_DESCRIPTION("Future Domain PCMCIA SCSI driver"); 59MODULE_DESCRIPTION("Future Domain PCMCIA SCSI driver");
60MODULE_LICENSE("Dual MPL/GPL"); 60MODULE_LICENSE("Dual MPL/GPL");
61 61
62#ifdef PCMCIA_DEBUG
63static int pc_debug = PCMCIA_DEBUG;
64module_param(pc_debug, int, 0);
65#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
66static char *version =
67"fdomain_cs.c 1.47 2001/10/13 00:08:52 (David Hinds)";
68#else
69#define DEBUG(n, args...)
70#endif
71
72/*====================================================================*/ 62/*====================================================================*/
73 63
74typedef struct scsi_info_t { 64typedef struct scsi_info_t {
@@ -86,7 +76,7 @@ static int fdomain_probe(struct pcmcia_device *link)
86{ 76{
87 scsi_info_t *info; 77 scsi_info_t *info;
88 78
89 DEBUG(0, "fdomain_attach()\n"); 79 dev_dbg(&link->dev, "fdomain_attach()\n");
90 80
91 /* Create new SCSI device */ 81 /* Create new SCSI device */
92 info = kzalloc(sizeof(*info), GFP_KERNEL); 82 info = kzalloc(sizeof(*info), GFP_KERNEL);
@@ -111,7 +101,7 @@ static int fdomain_probe(struct pcmcia_device *link)
111 101
112static void fdomain_detach(struct pcmcia_device *link) 102static void fdomain_detach(struct pcmcia_device *link)
113{ 103{
114 DEBUG(0, "fdomain_detach(0x%p)\n", link); 104 dev_dbg(&link->dev, "fdomain_detach\n");
115 105
116 fdomain_release(link); 106 fdomain_release(link);
117 107
@@ -120,9 +110,6 @@ static void fdomain_detach(struct pcmcia_device *link)
120 110
121/*====================================================================*/ 111/*====================================================================*/
122 112
123#define CS_CHECK(fn, ret) \
124do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
125
126static int fdomain_config_check(struct pcmcia_device *p_dev, 113static int fdomain_config_check(struct pcmcia_device *p_dev,
127 cistpl_cftable_entry_t *cfg, 114 cistpl_cftable_entry_t *cfg,
128 cistpl_cftable_entry_t *dflt, 115 cistpl_cftable_entry_t *dflt,
@@ -137,20 +124,22 @@ static int fdomain_config_check(struct pcmcia_device *p_dev,
137static int fdomain_config(struct pcmcia_device *link) 124static int fdomain_config(struct pcmcia_device *link)
138{ 125{
139 scsi_info_t *info = link->priv; 126 scsi_info_t *info = link->priv;
140 int last_ret, last_fn; 127 int ret;
141 char str[22]; 128 char str[22];
142 struct Scsi_Host *host; 129 struct Scsi_Host *host;
143 130
144 DEBUG(0, "fdomain_config(0x%p)\n", link); 131 dev_dbg(&link->dev, "fdomain_config\n");
145 132
146 last_ret = pcmcia_loop_config(link, fdomain_config_check, NULL); 133 ret = pcmcia_loop_config(link, fdomain_config_check, NULL);
147 if (last_ret) { 134 if (ret)
148 cs_error(link, RequestIO, last_ret);
149 goto failed; 135 goto failed;
150 }
151 136
152 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 137 ret = pcmcia_request_irq(link, &link->irq);
153 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 138 if (ret)
139 goto failed;
140 ret = pcmcia_request_configuration(link, &link->conf);
141 if (ret)
142 goto failed;
154 143
155 /* A bad hack... */ 144 /* A bad hack... */
156 release_region(link->io.BasePort1, link->io.NumPorts1); 145 release_region(link->io.BasePort1, link->io.NumPorts1);
@@ -162,11 +151,11 @@ static int fdomain_config(struct pcmcia_device *link)
162 host = __fdomain_16x0_detect(&fdomain_driver_template); 151 host = __fdomain_16x0_detect(&fdomain_driver_template);
163 if (!host) { 152 if (!host) {
164 printk(KERN_INFO "fdomain_cs: no SCSI devices found\n"); 153 printk(KERN_INFO "fdomain_cs: no SCSI devices found\n");
165 goto cs_failed; 154 goto failed;
166 } 155 }
167 156
168 if (scsi_add_host(host, NULL)) 157 if (scsi_add_host(host, NULL))
169 goto cs_failed; 158 goto failed;
170 scsi_scan_host(host); 159 scsi_scan_host(host);
171 160
172 sprintf(info->node.dev_name, "scsi%d", host->host_no); 161 sprintf(info->node.dev_name, "scsi%d", host->host_no);
@@ -175,8 +164,6 @@ static int fdomain_config(struct pcmcia_device *link)
175 164
176 return 0; 165 return 0;
177 166
178cs_failed:
179 cs_error(link, last_fn, last_ret);
180failed: 167failed:
181 fdomain_release(link); 168 fdomain_release(link);
182 return -ENODEV; 169 return -ENODEV;
@@ -188,7 +175,7 @@ static void fdomain_release(struct pcmcia_device *link)
188{ 175{
189 scsi_info_t *info = link->priv; 176 scsi_info_t *info = link->priv;
190 177
191 DEBUG(0, "fdomain_release(0x%p)\n", link); 178 dev_dbg(&link->dev, "fdomain_release\n");
192 179
193 scsi_remove_host(info->host); 180 scsi_remove_host(info->host);
194 pcmcia_disable_device(link); 181 pcmcia_disable_device(link);
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c
index 20c3e5e6d88a..65d7ad58433f 100644
--- a/drivers/scsi/pcmcia/qlogic_stub.c
+++ b/drivers/scsi/pcmcia/qlogic_stub.c
@@ -62,15 +62,6 @@
62 62
63static char qlogic_name[] = "qlogic_cs"; 63static char qlogic_name[] = "qlogic_cs";
64 64
65#ifdef PCMCIA_DEBUG
66static int pc_debug = PCMCIA_DEBUG;
67module_param(pc_debug, int, 0644);
68#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
69static char *version = "qlogic_cs.c 1.79-ac 2002/10/26 (David Hinds)";
70#else
71#define DEBUG(n, args...)
72#endif
73
74static struct scsi_host_template qlogicfas_driver_template = { 65static struct scsi_host_template qlogicfas_driver_template = {
75 .module = THIS_MODULE, 66 .module = THIS_MODULE,
76 .name = qlogic_name, 67 .name = qlogic_name,
@@ -159,7 +150,7 @@ static int qlogic_probe(struct pcmcia_device *link)
159{ 150{
160 scsi_info_t *info; 151 scsi_info_t *info;
161 152
162 DEBUG(0, "qlogic_attach()\n"); 153 dev_dbg(&link->dev, "qlogic_attach()\n");
163 154
164 /* Create new SCSI device */ 155 /* Create new SCSI device */
165 info = kzalloc(sizeof(*info), GFP_KERNEL); 156 info = kzalloc(sizeof(*info), GFP_KERNEL);
@@ -183,7 +174,7 @@ static int qlogic_probe(struct pcmcia_device *link)
183 174
184static void qlogic_detach(struct pcmcia_device *link) 175static void qlogic_detach(struct pcmcia_device *link)
185{ 176{
186 DEBUG(0, "qlogic_detach(0x%p)\n", link); 177 dev_dbg(&link->dev, "qlogic_detach\n");
187 178
188 qlogic_release(link); 179 qlogic_release(link);
189 kfree(link->priv); 180 kfree(link->priv);
@@ -192,9 +183,6 @@ static void qlogic_detach(struct pcmcia_device *link)
192 183
193/*====================================================================*/ 184/*====================================================================*/
194 185
195#define CS_CHECK(fn, ret) \
196do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
197
198static int qlogic_config_check(struct pcmcia_device *p_dev, 186static int qlogic_config_check(struct pcmcia_device *p_dev,
199 cistpl_cftable_entry_t *cfg, 187 cistpl_cftable_entry_t *cfg,
200 cistpl_cftable_entry_t *dflt, 188 cistpl_cftable_entry_t *dflt,
@@ -213,19 +201,22 @@ static int qlogic_config_check(struct pcmcia_device *p_dev,
213static int qlogic_config(struct pcmcia_device * link) 201static int qlogic_config(struct pcmcia_device * link)
214{ 202{
215 scsi_info_t *info = link->priv; 203 scsi_info_t *info = link->priv;
216 int last_ret, last_fn; 204 int ret;
217 struct Scsi_Host *host; 205 struct Scsi_Host *host;
218 206
219 DEBUG(0, "qlogic_config(0x%p)\n", link); 207 dev_dbg(&link->dev, "qlogic_config\n");
220 208
221 last_ret = pcmcia_loop_config(link, qlogic_config_check, NULL); 209 ret = pcmcia_loop_config(link, qlogic_config_check, NULL);
222 if (last_ret) { 210 if (ret)
223 cs_error(link, RequestIO, last_ret); 211 goto failed;
212
213 ret = pcmcia_request_irq(link, &link->irq);
214 if (ret)
224 goto failed; 215 goto failed;
225 }
226 216
227 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 217 ret = pcmcia_request_configuration(link, &link->conf);
228 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 218 if (ret)
219 goto failed;
229 220
230 if ((info->manf_id == MANFID_MACNICA) || (info->manf_id == MANFID_PIONEER) || (info->manf_id == 0x0098)) { 221 if ((info->manf_id == MANFID_MACNICA) || (info->manf_id == MANFID_PIONEER) || (info->manf_id == 0x0098)) {
231 /* set ATAcmd */ 222 /* set ATAcmd */
@@ -244,7 +235,7 @@ static int qlogic_config(struct pcmcia_device * link)
244 235
245 if (!host) { 236 if (!host) {
246 printk(KERN_INFO "%s: no SCSI devices found\n", qlogic_name); 237 printk(KERN_INFO "%s: no SCSI devices found\n", qlogic_name);
247 goto cs_failed; 238 goto failed;
248 } 239 }
249 240
250 sprintf(info->node.dev_name, "scsi%d", host->host_no); 241 sprintf(info->node.dev_name, "scsi%d", host->host_no);
@@ -253,12 +244,9 @@ static int qlogic_config(struct pcmcia_device * link)
253 244
254 return 0; 245 return 0;
255 246
256cs_failed:
257 cs_error(link, last_fn, last_ret);
258 pcmcia_disable_device(link);
259failed: 247failed:
248 pcmcia_disable_device(link);
260 return -ENODEV; 249 return -ENODEV;
261
262} /* qlogic_config */ 250} /* qlogic_config */
263 251
264/*====================================================================*/ 252/*====================================================================*/
@@ -267,7 +255,7 @@ static void qlogic_release(struct pcmcia_device *link)
267{ 255{
268 scsi_info_t *info = link->priv; 256 scsi_info_t *info = link->priv;
269 257
270 DEBUG(0, "qlogic_release(0x%p)\n", link); 258 dev_dbg(&link->dev, "qlogic_release\n");
271 259
272 scsi_remove_host(info->host); 260 scsi_remove_host(info->host);
273 261
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c
index b330c11a1752..851a41ce4f06 100644
--- a/drivers/scsi/pcmcia/sym53c500_cs.c
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c
@@ -77,17 +77,6 @@
77#include <pcmcia/ds.h> 77#include <pcmcia/ds.h>
78#include <pcmcia/ciscode.h> 78#include <pcmcia/ciscode.h>
79 79
80/* ================================================================== */
81
82#ifdef PCMCIA_DEBUG
83static int pc_debug = PCMCIA_DEBUG;
84module_param(pc_debug, int, 0);
85#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
86static char *version =
87"sym53c500_cs.c 0.9c 2004/10/27 (Bob Tracy)";
88#else
89#define DEBUG(n, args...)
90#endif
91 80
92/* ================================================================== */ 81/* ================================================================== */
93 82
@@ -525,7 +514,7 @@ SYM53C500_release(struct pcmcia_device *link)
525 struct scsi_info_t *info = link->priv; 514 struct scsi_info_t *info = link->priv;
526 struct Scsi_Host *shost = info->host; 515 struct Scsi_Host *shost = info->host;
527 516
528 DEBUG(0, "SYM53C500_release(0x%p)\n", link); 517 dev_dbg(&link->dev, "SYM53C500_release\n");
529 518
530 /* 519 /*
531 * Do this before releasing/freeing resources. 520 * Do this before releasing/freeing resources.
@@ -697,9 +686,6 @@ static struct scsi_host_template sym53c500_driver_template = {
697 .shost_attrs = SYM53C500_shost_attrs 686 .shost_attrs = SYM53C500_shost_attrs
698}; 687};
699 688
700#define CS_CHECK(fn, ret) \
701do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
702
703static int SYM53C500_config_check(struct pcmcia_device *p_dev, 689static int SYM53C500_config_check(struct pcmcia_device *p_dev,
704 cistpl_cftable_entry_t *cfg, 690 cistpl_cftable_entry_t *cfg,
705 cistpl_cftable_entry_t *dflt, 691 cistpl_cftable_entry_t *dflt,
@@ -719,24 +705,27 @@ static int
719SYM53C500_config(struct pcmcia_device *link) 705SYM53C500_config(struct pcmcia_device *link)
720{ 706{
721 struct scsi_info_t *info = link->priv; 707 struct scsi_info_t *info = link->priv;
722 int last_ret, last_fn; 708 int ret;
723 int irq_level, port_base; 709 int irq_level, port_base;
724 struct Scsi_Host *host; 710 struct Scsi_Host *host;
725 struct scsi_host_template *tpnt = &sym53c500_driver_template; 711 struct scsi_host_template *tpnt = &sym53c500_driver_template;
726 struct sym53c500_data *data; 712 struct sym53c500_data *data;
727 713
728 DEBUG(0, "SYM53C500_config(0x%p)\n", link); 714 dev_dbg(&link->dev, "SYM53C500_config\n");
729 715
730 info->manf_id = link->manf_id; 716 info->manf_id = link->manf_id;
731 717
732 last_ret = pcmcia_loop_config(link, SYM53C500_config_check, NULL); 718 ret = pcmcia_loop_config(link, SYM53C500_config_check, NULL);
733 if (last_ret) { 719 if (ret)
734 cs_error(link, RequestIO, last_ret); 720 goto failed;
721
722 ret = pcmcia_request_irq(link, &link->irq);
723 if (ret)
735 goto failed; 724 goto failed;
736 }
737 725
738 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 726 ret = pcmcia_request_configuration(link, &link->conf);
739 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 727 if (ret)
728 goto failed;
740 729
741 /* 730 /*
742 * That's the trouble with copying liberally from another driver. 731 * That's the trouble with copying liberally from another driver.
@@ -824,8 +813,6 @@ err_release:
824 printk(KERN_INFO "sym53c500_cs: no SCSI devices found\n"); 813 printk(KERN_INFO "sym53c500_cs: no SCSI devices found\n");
825 return -ENODEV; 814 return -ENODEV;
826 815
827cs_failed:
828 cs_error(link, last_fn, last_ret);
829failed: 816failed:
830 SYM53C500_release(link); 817 SYM53C500_release(link);
831 return -ENODEV; 818 return -ENODEV;
@@ -855,7 +842,7 @@ static int sym53c500_resume(struct pcmcia_device *link)
855static void 842static void
856SYM53C500_detach(struct pcmcia_device *link) 843SYM53C500_detach(struct pcmcia_device *link)
857{ 844{
858 DEBUG(0, "SYM53C500_detach(0x%p)\n", link); 845 dev_dbg(&link->dev, "SYM53C500_detach\n");
859 846
860 SYM53C500_release(link); 847 SYM53C500_release(link);
861 848
@@ -868,7 +855,7 @@ SYM53C500_probe(struct pcmcia_device *link)
868{ 855{
869 struct scsi_info_t *info; 856 struct scsi_info_t *info;
870 857
871 DEBUG(0, "SYM53C500_attach()\n"); 858 dev_dbg(&link->dev, "SYM53C500_attach()\n");
872 859
873 /* Create new SCSI device */ 860 /* Create new SCSI device */
874 info = kzalloc(sizeof(*info), GFP_KERNEL); 861 info = kzalloc(sizeof(*info), GFP_KERNEL);