aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2006-12-06 23:36:21 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 11:39:33 -0500
commitb4178ab58aa81f4ed3c75c48940682fe3b45d880 (patch)
treed9bd5827ee1f9a36bf9958a56760f6206272cc2f
parentf4330002d11f032559954cbff68a5cad95b6d27f (diff)
[PATCH] paride_register(): shuffle return values
paride_register() returns 1 on success, 0 on failure and module init code looks like static int __init foo_init(void) { return paride_register(&foo) - 1; } which is not what one get used to. Converted to usual 0/-E convention. In case of kbic driver, unwind registration. It was just return (paride_register(&k951)||paride_register(&k971))-1; Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/block/paride/aten.c2
-rw-r--r--drivers/block/paride/bpck.c2
-rw-r--r--drivers/block/paride/bpck6.c2
-rw-r--r--drivers/block/paride/comm.c2
-rw-r--r--drivers/block/paride/dstr.c2
-rw-r--r--drivers/block/paride/epat.c2
-rw-r--r--drivers/block/paride/epia.c2
-rw-r--r--drivers/block/paride/fit2.c2
-rw-r--r--drivers/block/paride/fit3.c2
-rw-r--r--drivers/block/paride/friq.c2
-rw-r--r--drivers/block/paride/frpw.c2
-rw-r--r--drivers/block/paride/kbic.c10
-rw-r--r--drivers/block/paride/ktti.c2
-rw-r--r--drivers/block/paride/on20.c2
-rw-r--r--drivers/block/paride/on26.c2
-rw-r--r--drivers/block/paride/paride.c6
16 files changed, 26 insertions, 18 deletions
diff --git a/drivers/block/paride/aten.c b/drivers/block/paride/aten.c
index 3539099a7fae..2695465568ad 100644
--- a/drivers/block/paride/aten.c
+++ b/drivers/block/paride/aten.c
@@ -149,7 +149,7 @@ static struct pi_protocol aten = {
149 149
150static int __init aten_init(void) 150static int __init aten_init(void)
151{ 151{
152 return paride_register(&aten)-1; 152 return paride_register(&aten);
153} 153}
154 154
155static void __exit aten_exit(void) 155static void __exit aten_exit(void)
diff --git a/drivers/block/paride/bpck.c b/drivers/block/paride/bpck.c
index b0df16dfd194..4f27e7392e38 100644
--- a/drivers/block/paride/bpck.c
+++ b/drivers/block/paride/bpck.c
@@ -464,7 +464,7 @@ static struct pi_protocol bpck = {
464 464
465static int __init bpck_init(void) 465static int __init bpck_init(void)
466{ 466{
467 return paride_register(&bpck)-1; 467 return paride_register(&bpck);
468} 468}
469 469
470static void __exit bpck_exit(void) 470static void __exit bpck_exit(void)
diff --git a/drivers/block/paride/bpck6.c b/drivers/block/paride/bpck6.c
index 7c04f74f9d75..da6b5d27badb 100644
--- a/drivers/block/paride/bpck6.c
+++ b/drivers/block/paride/bpck6.c
@@ -265,7 +265,7 @@ static int __init bpck6_init(void)
265 printk(KERN_INFO "bpck6: Copyright 2001 by Micro Solutions, Inc., DeKalb IL. USA\n"); 265 printk(KERN_INFO "bpck6: Copyright 2001 by Micro Solutions, Inc., DeKalb IL. USA\n");
266 if(verbose) 266 if(verbose)
267 printk(KERN_DEBUG "bpck6: verbose debug enabled.\n"); 267 printk(KERN_DEBUG "bpck6: verbose debug enabled.\n");
268 return paride_register(&bpck6) - 1; 268 return paride_register(&bpck6);
269} 269}
270 270
271static void __exit bpck6_exit(void) 271static void __exit bpck6_exit(void)
diff --git a/drivers/block/paride/comm.c b/drivers/block/paride/comm.c
index c3d4076e8c0e..9bcd35495323 100644
--- a/drivers/block/paride/comm.c
+++ b/drivers/block/paride/comm.c
@@ -205,7 +205,7 @@ static struct pi_protocol comm = {
205 205
206static int __init comm_init(void) 206static int __init comm_init(void)
207{ 207{
208 return paride_register(&comm)-1; 208 return paride_register(&comm);
209} 209}
210 210
211static void __exit comm_exit(void) 211static void __exit comm_exit(void)
diff --git a/drivers/block/paride/dstr.c b/drivers/block/paride/dstr.c
index 2e4219eac528..accc5c777cbb 100644
--- a/drivers/block/paride/dstr.c
+++ b/drivers/block/paride/dstr.c
@@ -220,7 +220,7 @@ static struct pi_protocol dstr = {
220 220
221static int __init dstr_init(void) 221static int __init dstr_init(void)
222{ 222{
223 return paride_register(&dstr)-1; 223 return paride_register(&dstr);
224} 224}
225 225
226static void __exit dstr_exit(void) 226static void __exit dstr_exit(void)
diff --git a/drivers/block/paride/epat.c b/drivers/block/paride/epat.c
index 5ed4fc1a00bf..1bcdff77322e 100644
--- a/drivers/block/paride/epat.c
+++ b/drivers/block/paride/epat.c
@@ -327,7 +327,7 @@ static int __init epat_init(void)
327#ifdef CONFIG_PARIDE_EPATC8 327#ifdef CONFIG_PARIDE_EPATC8
328 epatc8 = 1; 328 epatc8 = 1;
329#endif 329#endif
330 return paride_register(&epat)-1; 330 return paride_register(&epat);
331} 331}
332 332
333static void __exit epat_exit(void) 333static void __exit epat_exit(void)
diff --git a/drivers/block/paride/epia.c b/drivers/block/paride/epia.c
index 649766c14902..fb0e782d055e 100644
--- a/drivers/block/paride/epia.c
+++ b/drivers/block/paride/epia.c
@@ -303,7 +303,7 @@ static struct pi_protocol epia = {
303 303
304static int __init epia_init(void) 304static int __init epia_init(void)
305{ 305{
306 return paride_register(&epia)-1; 306 return paride_register(&epia);
307} 307}
308 308
309static void __exit epia_exit(void) 309static void __exit epia_exit(void)
diff --git a/drivers/block/paride/fit2.c b/drivers/block/paride/fit2.c
index 7a1624967038..381283753ae4 100644
--- a/drivers/block/paride/fit2.c
+++ b/drivers/block/paride/fit2.c
@@ -138,7 +138,7 @@ static struct pi_protocol fit2 = {
138 138
139static int __init fit2_init(void) 139static int __init fit2_init(void)
140{ 140{
141 return paride_register(&fit2)-1; 141 return paride_register(&fit2);
142} 142}
143 143
144static void __exit fit2_exit(void) 144static void __exit fit2_exit(void)
diff --git a/drivers/block/paride/fit3.c b/drivers/block/paride/fit3.c
index c701577d15aa..275d269458eb 100644
--- a/drivers/block/paride/fit3.c
+++ b/drivers/block/paride/fit3.c
@@ -198,7 +198,7 @@ static struct pi_protocol fit3 = {
198 198
199static int __init fit3_init(void) 199static int __init fit3_init(void)
200{ 200{
201 return paride_register(&fit3)-1; 201 return paride_register(&fit3);
202} 202}
203 203
204static void __exit fit3_exit(void) 204static void __exit fit3_exit(void)
diff --git a/drivers/block/paride/friq.c b/drivers/block/paride/friq.c
index e9edfa2e3a6c..4f2ba244689b 100644
--- a/drivers/block/paride/friq.c
+++ b/drivers/block/paride/friq.c
@@ -263,7 +263,7 @@ static struct pi_protocol friq = {
263 263
264static int __init friq_init(void) 264static int __init friq_init(void)
265{ 265{
266 return paride_register(&friq)-1; 266 return paride_register(&friq);
267} 267}
268 268
269static void __exit friq_exit(void) 269static void __exit friq_exit(void)
diff --git a/drivers/block/paride/frpw.c b/drivers/block/paride/frpw.c
index 407f821d2408..c3cde364603a 100644
--- a/drivers/block/paride/frpw.c
+++ b/drivers/block/paride/frpw.c
@@ -300,7 +300,7 @@ static struct pi_protocol frpw = {
300 300
301static int __init frpw_init(void) 301static int __init frpw_init(void)
302{ 302{
303 return paride_register(&frpw)-1; 303 return paride_register(&frpw);
304} 304}
305 305
306static void __exit frpw_exit(void) 306static void __exit frpw_exit(void)
diff --git a/drivers/block/paride/kbic.c b/drivers/block/paride/kbic.c
index a56328190276..35999c415ee3 100644
--- a/drivers/block/paride/kbic.c
+++ b/drivers/block/paride/kbic.c
@@ -283,7 +283,15 @@ static struct pi_protocol k971 = {
283 283
284static int __init kbic_init(void) 284static int __init kbic_init(void)
285{ 285{
286 return (paride_register(&k951)||paride_register(&k971))-1; 286 int rv;
287
288 rv = paride_register(&k951);
289 if (rv < 0)
290 return rv;
291 rv = paride_register(&k971);
292 if (rv < 0)
293 paride_unregister(&k951);
294 return rv;
287} 295}
288 296
289static void __exit kbic_exit(void) 297static void __exit kbic_exit(void)
diff --git a/drivers/block/paride/ktti.c b/drivers/block/paride/ktti.c
index a9d85be02031..117ab0e8ccf0 100644
--- a/drivers/block/paride/ktti.c
+++ b/drivers/block/paride/ktti.c
@@ -115,7 +115,7 @@ static struct pi_protocol ktti = {
115 115
116static int __init ktti_init(void) 116static int __init ktti_init(void)
117{ 117{
118 return paride_register(&ktti)-1; 118 return paride_register(&ktti);
119} 119}
120 120
121static void __exit ktti_exit(void) 121static void __exit ktti_exit(void)
diff --git a/drivers/block/paride/on20.c b/drivers/block/paride/on20.c
index cc7e9f591dda..0173697a1a4d 100644
--- a/drivers/block/paride/on20.c
+++ b/drivers/block/paride/on20.c
@@ -140,7 +140,7 @@ static struct pi_protocol on20 = {
140 140
141static int __init on20_init(void) 141static int __init on20_init(void)
142{ 142{
143 return paride_register(&on20)-1; 143 return paride_register(&on20);
144} 144}
145 145
146static void __exit on20_exit(void) 146static void __exit on20_exit(void)
diff --git a/drivers/block/paride/on26.c b/drivers/block/paride/on26.c
index 8755ce486937..95ba256921f2 100644
--- a/drivers/block/paride/on26.c
+++ b/drivers/block/paride/on26.c
@@ -306,7 +306,7 @@ static struct pi_protocol on26 = {
306 306
307static int __init on26_init(void) 307static int __init on26_init(void)
308{ 308{
309 return paride_register(&on26)-1; 309 return paride_register(&on26);
310} 310}
311 311
312static void __exit on26_exit(void) 312static void __exit on26_exit(void)
diff --git a/drivers/block/paride/paride.c b/drivers/block/paride/paride.c
index 55cabfb60cc5..e4c55e050126 100644
--- a/drivers/block/paride/paride.c
+++ b/drivers/block/paride/paride.c
@@ -237,19 +237,19 @@ int paride_register(PIP * pr)
237 if (protocols[k] && !strcmp(pr->name, protocols[k]->name)) { 237 if (protocols[k] && !strcmp(pr->name, protocols[k]->name)) {
238 printk("paride: %s protocol already registered\n", 238 printk("paride: %s protocol already registered\n",
239 pr->name); 239 pr->name);
240 return 0; 240 return -1;
241 } 241 }
242 k = 0; 242 k = 0;
243 while ((k < MAX_PROTOS) && (protocols[k])) 243 while ((k < MAX_PROTOS) && (protocols[k]))
244 k++; 244 k++;
245 if (k == MAX_PROTOS) { 245 if (k == MAX_PROTOS) {
246 printk("paride: protocol table full\n"); 246 printk("paride: protocol table full\n");
247 return 0; 247 return -1;
248 } 248 }
249 protocols[k] = pr; 249 protocols[k] = pr;
250 pr->index = k; 250 pr->index = k;
251 printk("paride: %s registered as protocol %d\n", pr->name, k); 251 printk("paride: %s registered as protocol %d\n", pr->name, k);
252 return 1; 252 return 0;
253} 253}
254 254
255EXPORT_SYMBOL(paride_register); 255EXPORT_SYMBOL(paride_register);