History

nubus: Clean up whitespace

Finn Thain committed 9 years ago

Commit f42e5551 parent 71ae40e1 file · +148 −162Browse files

Unified · Split

drivers/nubus/nubus.c+148−162
@@ -44,8 +44,8 @@ extern void oss_nubus_init(void); · 43 unmodified lines
4444
4545 /* Globals */
4646
47−struct nubus_dev* nubus_devices;
48−struct nubus_board* nubus_boards;
47+struct nubus_dev *nubus_devices;
48+struct nubus_board *nubus_boards;
4949
5050 /* Meaning of "bytelanes":
5151
@@ -69,26 +69,26 @@ struct nubus_board* nubus_boards; · 17 unmodified lines
6969
7070 Etcetera, etcetera. Hopefully this clears up some confusion over
7171 what the following code actually does. */
72−
72+
7373 static inline int not_useful(void *p, int map)
7474 {
75− unsigned long pv=(unsigned long)p;
75+ unsigned long pv = (unsigned long)p;
76+
7677 pv &= 3;
77− if(map & (1<<pv))
78+ if (map & (1 << pv))
7879 return 0;
7980 return 1;
8081 }
81−
82+
8283 static unsigned long nubus_get_rom(unsigned char **ptr, int len, int map)
8384 {
8485 /* This will hold the result */
8586 unsigned long v = 0;
8687 unsigned char *p = *ptr;
8788
88− while(len)
89− {
89+ while (len) {
9090 v <<= 8;
91− while(not_useful(p,map))
91+ while (not_useful(p, map))
9292 p++;
9393 v |= *p++;
9494 len--;
@@ -99,31 +99,28 @@ static unsigned long nubus_get_rom(unsigned char **ptr, int len, int map) · 4 unmodified lines
9999
100100 static void nubus_rewind(unsigned char **ptr, int len, int map)
101101 {
102− unsigned char *p=*ptr;
102+ unsigned char *p = *ptr;
103103
104104 /* Sanity check */
105− if(len > 65536)
105+ if (len > 65536)
106106 pr_err("rewind of 0x%08x!\n", len);
107− while(len)
108− {
109− do
110− {
107+ while (len) {
108+ do {
111109 p--;
112− }
113− while(not_useful(p, map));
110+ } while (not_useful(p, map));
114111 len--;
115112 }
116− *ptr=p;
113+ *ptr = p;
117114 }
118115
119116 static void nubus_advance(unsigned char **ptr, int len, int map)
120117 {
121118 unsigned char *p = *ptr;
122− if(len>65536)
119+
120+ if (len > 65536)
123121 pr_err("advance of 0x%08x!\n", len);
124− while(len)
125− {
126− while(not_useful(p,map))
122+ while (len) {
123+ while (not_useful(p, map))
127124 p++;
128125 p++;
129126 len--;
@@ -133,9 +130,9 @@ static void nubus_advance(unsigned char **ptr, int len, int map) · 3 unmodified lines
133130
134131 static void nubus_move(unsigned char **ptr, int len, int map)
135132 {
136− if(len > 0)
133+ if (len > 0)
137134 nubus_advance(ptr, len, map);
138− else if(len < 0)
135+ else if (len < 0)
139136 nubus_rewind(ptr, -len, map);
140137 }
141138
@@ -148,23 +145,24 @@ static void nubus_move(unsigned char **ptr, int len, int map) · 6 unmodified lines
148145
149146 static inline long nubus_expand32(long foo)
150147 {
151− if(foo & 0x00800000) /* 24bit negative */
148+ if (foo & 0x00800000) /* 24bit negative */
152149 foo |= 0xFF000000;
153150 return foo;
154151 }
155152
156153 static inline void *nubus_rom_addr(int slot)
157−{
154+{
158155 /*
159156 * Returns the first byte after the card. We then walk
160157 * backwards to get the lane register and the config
161158 */
162− return (void *)(0xF1000000+(slot<<24));
159+ return (void *)(0xF1000000 + (slot << 24));
163160 }
164161
165162 static unsigned char *nubus_dirptr(const struct nubus_dirent *nd)
166163 {
167164 unsigned char *p = nd->base;
165+
168166 /* Essentially, just step over the bytelanes using whatever
169167 offset we might have found */
170168 nubus_move(&p, nubus_expand32(nd->data), nd->mask);
@@ -175,36 +173,36 @@ static unsigned char *nubus_dirptr(const struct nubus_dirent *nd) · 4 unmodified lines
175173 /* These two are for pulling resource data blocks (i.e. stuff that's
176174 pointed to with offsets) out of the card ROM. */
177175
178−void nubus_get_rsrc_mem(void *dest, const struct nubus_dirent* dirent,
176+void nubus_get_rsrc_mem(void *dest, const struct nubus_dirent *dirent,
179177 int len)
180178 {
181179 unsigned char *t = (unsigned char *)dest;
182180 unsigned char *p = nubus_dirptr(dirent);
183− while(len)
184− {
181+
182+ while (len) {
185183 *t++ = nubus_get_rom(&p, 1, dirent->mask);
186184 len--;
187185 }
188186 }
189187 EXPORT_SYMBOL(nubus_get_rsrc_mem);
190188
191−void nubus_get_rsrc_str(void *dest, const struct nubus_dirent* dirent,
189+void nubus_get_rsrc_str(void *dest, const struct nubus_dirent *dirent,
192190 int len)
193191 {
194− unsigned char *t=(unsigned char *)dest;
192+ unsigned char *t = (unsigned char *)dest;
195193 unsigned char *p = nubus_dirptr(dirent);
196− while(len)
197− {
194+
195+ while (len) {
198196 *t = nubus_get_rom(&p, 1, dirent->mask);
199− if(!*t++)
197+ if (!*t++)
200198 break;
201199 len--;
202200 }
203201 }
204202 EXPORT_SYMBOL(nubus_get_rsrc_str);
205203
206−int nubus_get_root_dir(const struct nubus_board* board,
207− struct nubus_dir* dir)
204+int nubus_get_root_dir(const struct nubus_board *board,
205+ struct nubus_dir *dir)
208206 {
209207 dir->ptr = dir->base = board->directory;
210208 dir->done = 0;
@@ -214,8 +212,8 @@ int nubus_get_root_dir(const struct nubus_board* board, · 3 unmodified lines
214212 EXPORT_SYMBOL(nubus_get_root_dir);
215213
216214 /* This is a slyly renamed version of the above */
217−int nubus_get_func_dir(const struct nubus_dev* dev,
218− struct nubus_dir* dir)
215+int nubus_get_func_dir(const struct nubus_dev *dev,
216+ struct nubus_dir *dir)
219217 {
220218 dir->ptr = dir->base = dev->directory;
221219 dir->done = 0;
@@ -224,11 +222,11 @@ int nubus_get_func_dir(const struct nubus_dev* dev, · 2 unmodified lines
224222 }
225223 EXPORT_SYMBOL(nubus_get_func_dir);
226224
227−int nubus_get_board_dir(const struct nubus_board* board,
228− struct nubus_dir* dir)
225+int nubus_get_board_dir(const struct nubus_board *board,
226+ struct nubus_dir *dir)
229227 {
230228 struct nubus_dirent ent;
231−
229+
232230 dir->ptr = dir->base = board->directory;
233231 dir->done = 0;
234232 dir->mask = board->lanes;
@@ -256,6 +254,7 @@ EXPORT_SYMBOL(nubus_get_subdir); · 21 unmodified lines
256254 int nubus_readdir(struct nubus_dir *nd, struct nubus_dirent *ent)
257255 {
258256 u32 resid;
257+
259258 if (nd->done)
260259 return -1;
261260
@@ -266,27 +265,25 @@ int nubus_readdir(struct nubus_dir *nd, struct nubus_dirent *ent) · 4 unmodified lines
266265 resid = nubus_get_rom(&nd->ptr, 4, nd->mask);
267266
268267 /* EOL marker, as per the Apple docs */
269− if((resid&0xff000000) == 0xff000000)
270− {
268+ if ((resid & 0xff000000) == 0xff000000) {
271269 /* Mark it as done */
272270 nd->done = 1;
273271 return -1;
274272 }
275273
276274 /* First byte is the resource ID */
277− ent->type = resid >> 24;
275+ ent->type = resid >> 24;
278276 /* Low 3 bytes might contain data (or might not) */
279277 ent->data = resid & 0xffffff;
280− ent->mask = nd->mask;
278+ ent->mask = nd->mask;
281279 return 0;
282280 }
283281 EXPORT_SYMBOL(nubus_readdir);
284282
285−int nubus_rewinddir(struct nubus_dir* dir)
283+int nubus_rewinddir(struct nubus_dir *dir)
286284 {
287285 dir->ptr = dir->base;
288286 dir->done = 0;
289−
290287 return 0;
291288 }
292289 EXPORT_SYMBOL(nubus_rewinddir);
@@ -294,20 +291,15 @@ EXPORT_SYMBOL(nubus_rewinddir); · 1 unmodified line
294291 /* Driver interface functions, more or less like in pci.c */
295292
296293 struct nubus_dev*
297−nubus_find_device(unsigned short category,
298− unsigned short type,
299− unsigned short dr_hw,
300− unsigned short dr_sw,
301− const struct nubus_dev* from)
294+nubus_find_device(unsigned short category, unsigned short type,
295+ unsigned short dr_hw, unsigned short dr_sw,
296+ const struct nubus_dev *from)
302297 {
303− struct nubus_dev* itor =
304− from ? from->next : nubus_devices;
298+ struct nubus_dev *itor = from ? from->next : nubus_devices;
305299
306300 while (itor) {
307− if (itor->category == category
308− && itor->type == type
309− && itor->dr_hw == dr_hw
310− && itor->dr_sw == dr_sw)
301+ if (itor->category == category && itor->type == type &&
302+ itor->dr_hw == dr_hw && itor->dr_sw == dr_sw)
311303 return itor;
312304 itor = itor->next;
313305 }
@@ -316,16 +308,13 @@ nubus_find_device(unsigned short category, · 2 unmodified lines
316308 EXPORT_SYMBOL(nubus_find_device);
317309
318310 struct nubus_dev*
319−nubus_find_type(unsigned short category,
320− unsigned short type,
321− const struct nubus_dev* from)
311+nubus_find_type(unsigned short category, unsigned short type,
312+ const struct nubus_dev *from)
322313 {
323− struct nubus_dev* itor =
324− from ? from->next : nubus_devices;
314+ struct nubus_dev *itor = from ? from->next : nubus_devices;
325315
326316 while (itor) {
327− if (itor->category == category
328− && itor->type == type)
317+ if (itor->category == category && itor->type == type)
329318 return itor;
330319 itor = itor->next;
331320 }
@@ -334,12 +323,10 @@ nubus_find_type(unsigned short category, · 2 unmodified lines
334323 EXPORT_SYMBOL(nubus_find_type);
335324
336325 struct nubus_dev*
337−nubus_find_slot(unsigned int slot,
338− const struct nubus_dev* from)
326+nubus_find_slot(unsigned int slot, const struct nubus_dev *from)
339327 {
340− struct nubus_dev* itor =
341− from ? from->next : nubus_devices;
342−
328+ struct nubus_dev *itor = from ? from->next : nubus_devices;
329+
343330 while (itor) {
344331 if (itor->board->slot == slot)
345332 return itor;
@@ -350,13 +337,13 @@ nubus_find_slot(unsigned int slot, · 4 unmodified lines
350337 EXPORT_SYMBOL(nubus_find_slot);
351338
352339 int
353−nubus_find_rsrc(struct nubus_dir* dir, unsigned char rsrc_type,
354− struct nubus_dirent* ent)
340+nubus_find_rsrc(struct nubus_dir *dir, unsigned char rsrc_type,
341+ struct nubus_dirent *ent)
355342 {
356343 while (nubus_readdir(dir, ent) != -1) {
357344 if (ent->type == rsrc_type)
358345 return 0;
359− }
346+ }
360347 return -1;
361348 }
362349 EXPORT_SYMBOL(nubus_find_rsrc);
@@ -370,8 +357,8 @@ EXPORT_SYMBOL(nubus_find_rsrc); · 7 unmodified lines
370357 among other things. The rest of it should go in the /proc code.
371358 For now, we just use it to give verbose boot logs. */
372359
373−static int __init nubus_show_display_resource(struct nubus_dev* dev,
374− const struct nubus_dirent* ent)
360+static int __init nubus_show_display_resource(struct nubus_dev *dev,
361+ const struct nubus_dirent *ent)
375362 {
376363 switch (ent->type) {
377364 case NUBUS_RESID_GAMMADIR:
@@ -388,14 +375,14 @@ static int __init nubus_show_display_resource(struct nubus_dev* dev, · 10 unmodified lines
388375 return 0;
389376 }
390377
391−static int __init nubus_show_network_resource(struct nubus_dev* dev,
392− const struct nubus_dirent* ent)
378+static int __init nubus_show_network_resource(struct nubus_dev *dev,
379+ const struct nubus_dirent *ent)
393380 {
394381 switch (ent->type) {
395382 case NUBUS_RESID_MAC_ADDRESS:
396383 {
397384 char addr[6];
398−
385+
399386 nubus_get_rsrc_mem(addr, ent, 6);
400387 pr_info(" MAC address: %pM\n", addr);
401388 break;
@@ -407,13 +394,14 @@ static int __init nubus_show_network_resource(struct nubus_dev* dev, · 5 unmodified lines
407394 return 0;
408395 }
409396
410−static int __init nubus_show_cpu_resource(struct nubus_dev* dev,
411− const struct nubus_dirent* ent)
397+static int __init nubus_show_cpu_resource(struct nubus_dev *dev,
398+ const struct nubus_dirent *ent)
412399 {
413400 switch (ent->type) {
414401 case NUBUS_RESID_MEMINFO:
415402 {
416403 unsigned long meminfo[2];
404+
417405 nubus_get_rsrc_mem(&meminfo, ent, 8);
418406 pr_info(" memory: [ 0x%08lx 0x%08lx ]\n",
419407 meminfo[0], meminfo[1]);
@@ -422,6 +410,7 @@ static int __init nubus_show_cpu_resource(struct nubus_dev* dev, · 2 unmodified lines
422410 case NUBUS_RESID_ROMINFO:
423411 {
424412 unsigned long rominfo[2];
413+
425414 nubus_get_rsrc_mem(&rominfo, ent, 8);
426415 pr_info(" ROM: [ 0x%08lx 0x%08lx ]\n",
427416 rominfo[0], rominfo[1]);
@@ -434,8 +423,8 @@ static int __init nubus_show_cpu_resource(struct nubus_dev* dev, · 6 unmodified lines
434423 return 0;
435424 }
436425
437−static int __init nubus_show_private_resource(struct nubus_dev* dev,
438− const struct nubus_dirent* ent)
426+static int __init nubus_show_private_resource(struct nubus_dev *dev,
427+ const struct nubus_dirent *ent)
439428 {
440429 switch (dev->category) {
441430 case NUBUS_CAT_DISPLAY:
@@ -454,39 +443,37 @@ static int __init nubus_show_private_resource(struct nubus_dev* dev, · 12 unmodified lines
454443 return 0;
455444 }
456445
457−static struct nubus_dev* __init
458− nubus_get_functional_resource(struct nubus_board* board,
459− int slot,
460− const struct nubus_dirent* parent)
446+static struct nubus_dev * __init
447+nubus_get_functional_resource(struct nubus_board *board, int slot,
448+ const struct nubus_dirent *parent)
461449 {
462− struct nubus_dir dir;
450+ struct nubus_dir dir;
463451 struct nubus_dirent ent;
464− struct nubus_dev* dev;
465−
452+ struct nubus_dev *dev;
453+
466454 pr_info(" Function 0x%02x:\n", parent->type);
467455 nubus_get_subdir(parent, &dir);
468456
469457 /* Apple seems to have botched the ROM on the IIx */
470458 if (slot == 0 && (unsigned long)dir.base % 2)
471459 dir.base += 1;
472−
460+
473461 pr_debug("%s: parent is 0x%p, dir is 0x%p\n",
474462 __func__, parent->base, dir.base);
475463
476464 /* Actually we should probably panic if this fails */
477465 if ((dev = kzalloc(sizeof(*dev), GFP_ATOMIC)) == NULL)
478− return NULL;
466+ return NULL;
479467 dev->resid = parent->type;
480468 dev->directory = dir.base;
481469 dev->board = board;
482−
483− while (nubus_readdir(&dir, &ent) != -1)
484− {
485− switch(ent.type)
486− {
470+
471+ while (nubus_readdir(&dir, &ent) != -1) {
472+ switch (ent.type) {
487473 case NUBUS_RESID_TYPE:
488474 {
489475 unsigned short nbtdata[4];
476+
490477 nubus_get_rsrc_mem(nbtdata, &ent, 8);
491478 dev->category = nbtdata[0];
492479 dev->type = nbtdata[1];
@@ -508,6 +495,7 @@ static struct nubus_dev* __init · 15 unmodified lines
508495 use this :-) */
509496 struct nubus_dir drvr_dir;
510497 struct nubus_dirent drvr_ent;
498+
511499 nubus_get_subdir(&ent, &drvr_dir);
512500 nubus_readdir(&drvr_dir, &drvr_ent);
513501 dev->driver = nubus_dirptr(&drvr_ent);
@@ -525,7 +513,7 @@ static struct nubus_dev* __init · 11 unmodified lines
525513 /* Ditto */
526514 nubus_get_rsrc_mem(&dev->iosize, &ent, 4);
527515 pr_info(" memory length: 0x%08lx\n", dev->iosize);
528− break;
516+ break;
529517 case NUBUS_RESID_FLAGS:
530518 dev->flags = ent.data;
531519 pr_info(" flags: 0x%06x\n", dev->flags);
@@ -540,16 +528,17 @@ static struct nubus_dev* __init · 8 unmodified lines
540528 nubus_show_private_resource(dev, &ent);
541529 }
542530 }
543−
531+
544532 return dev;
545533 }
546534
547535 /* This is cool. */
548−static int __init nubus_get_vidnames(struct nubus_board* board,
549− const struct nubus_dirent* parent)
536+static int __init nubus_get_vidnames(struct nubus_board *board,
537+ const struct nubus_dirent *parent)
550538 {
551− struct nubus_dir dir;
539+ struct nubus_dir dir;
552540 struct nubus_dirent ent;
541+
553542 /* FIXME: obviously we want to put this in a header file soon */
554543 struct vidmode {
555544 u32 size;
@@ -564,14 +553,13 @@ static int __init nubus_get_vidnames(struct nubus_board* board, · 8 unmodified lines
564553 pr_debug("%s: parent is 0x%p, dir is 0x%p\n",
565554 __func__, parent->base, dir.base);
566555
567− while(nubus_readdir(&dir, &ent) != -1)
568− {
556+ while (nubus_readdir(&dir, &ent) != -1) {
569557 struct vidmode mode;
570558 u32 size;
571559
572560 /* First get the length */
573561 nubus_get_rsrc_mem(&size, &ent, 4);
574−
562+
575563 /* Now clobber the whole thing */
576564 if (size > sizeof(mode) - 1)
577565 size = sizeof(mode) - 1;
@@ -584,13 +572,13 @@ static int __init nubus_get_vidnames(struct nubus_board* board, · 6 unmodified lines
584572 }
585573
586574 /* This is *really* cool. */
587−static int __init nubus_get_icon(struct nubus_board* board,
588− const struct nubus_dirent* ent)
575+static int __init nubus_get_icon(struct nubus_board *board,
576+ const struct nubus_dirent *ent)
589577 {
590578 /* Should be 32x32 if my memory serves me correctly */
591579 unsigned char icon[128];
592580 int x, y;
593−
581+
594582 nubus_get_rsrc_mem(&icon, ent, 128);
595583 pr_info(" icon:\n");
596584
@@ -600,8 +588,7 @@ static int __init nubus_get_icon(struct nubus_board* board, · 3 unmodified lines
600588 for (y = 0; y < 32; y++) {
601589 pr_info(" ");
602590 for (x = 0; x < 32; x++) {
603− if (icon[y*4 + x/8]
604− & (0x80 >> (x%8)))
591+ if (icon[y * 4 + x / 8] & (0x80 >> (x % 8)))
605592 pr_cont("*");
606593 else
607594 pr_cont(" ");
@@ -611,23 +598,22 @@ static int __init nubus_get_icon(struct nubus_board* board, · 3 unmodified lines
611598 return 0;
612599 }
613600
614−static int __init nubus_get_vendorinfo(struct nubus_board* board,
615− const struct nubus_dirent* parent)
601+static int __init nubus_get_vendorinfo(struct nubus_board *board,
602+ const struct nubus_dirent *parent)
616603 {
617− struct nubus_dir dir;
604+ struct nubus_dir dir;
618605 struct nubus_dirent ent;
619− static char* vendor_fields[6] = {"ID", "serial", "revision",
620− "part", "date", "unknown field"};
606+ static char *vendor_fields[6] = { "ID", "serial", "revision",
607+ "part", "date", "unknown field" };
621608
622609 pr_info(" vendor info:\n");
623610 nubus_get_subdir(parent, &dir);
624611 pr_debug("%s: parent is 0x%p, dir is 0x%p\n",
625612 __func__, parent->base, dir.base);
626613
627− while(nubus_readdir(&dir, &ent) != -1)
628− {
614+ while (nubus_readdir(&dir, &ent) != -1) {
629615 char name[64];
630−
616+
631617 /* These are all strings, we think */
632618 nubus_get_rsrc_str(name, &ent, 64);
633619 if (ent.type > 5)
@@ -637,18 +623,17 @@ static int __init nubus_get_vendorinfo(struct nubus_board* board, · 3 unmodified lines
637623 return 0;
638624 }
639625
640−static int __init nubus_get_board_resource(struct nubus_board* board, int slot,
641− const struct nubus_dirent* parent)
626+static int __init nubus_get_board_resource(struct nubus_board *board, int slot,
627+ const struct nubus_dirent *parent)
642628 {
643− struct nubus_dir dir;
629+ struct nubus_dir dir;
644630 struct nubus_dirent ent;
645−
631+
646632 nubus_get_subdir(parent, &dir);
647633 pr_debug("%s: parent is 0x%p, dir is 0x%p\n",
648634 __func__, parent->base, dir.base);
649635
650− while(nubus_readdir(&dir, &ent) != -1)
651− {
636+ while (nubus_readdir(&dir, &ent) != -1) {
652637 switch (ent.type) {
653638 case NUBUS_RESID_TYPE:
654639 {
@@ -689,7 +674,7 @@ static int __init nubus_get_board_resource(struct nubus_board* board, int slot, · 34 unmodified lines
689674 case NUBUS_RESID_SECONDINIT:
690675 pr_info(" secondary init offset: 0x%06x\n", ent.data);
691676 break;
692− /* WTF isn't this in the functional resources? */
677+ /* WTF isn't this in the functional resources? */
693678 case NUBUS_RESID_VIDNAMES:
694679 nubus_get_vidnames(board, &ent);
695680 break;
@@ -697,7 +682,7 @@ static int __init nubus_get_board_resource(struct nubus_board* board, int slot, · 1 unmodified line
697682 case NUBUS_RESID_VIDMODES:
698683 pr_info(" video mode parameter directory offset: 0x%06x\n",
699684 ent.data);
700− break;
685+ break;
701686 default:
702687 pr_info(" unknown resource %02X, data 0x%06x\n",
703688 ent.type, ent.data);
@@ -710,8 +695,8 @@ static int __init nubus_get_board_resource(struct nubus_board* board, int slot, · 6 unmodified lines
710695 sResources in the motherboard ROM */
711696 static void __init nubus_find_rom_dir(struct nubus_board* board)
712697 {
713− unsigned char* rp;
714− unsigned char* romdir;
698+ unsigned char *rp;
699+ unsigned char *romdir;
715700 struct nubus_dir dir;
716701 struct nubus_dirent ent;
717702
@@ -744,14 +729,14 @@ static void __init nubus_find_rom_dir(struct nubus_board* board) · 26 unmodified lines
744729 if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG)
745730 printk(KERN_INFO "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data);
746731 /* This one takes us to where we want to go. */
747− if (nubus_readdir(&dir, &ent) == -1)
732+ if (nubus_readdir(&dir, &ent) == -1)
748733 goto badrom;
749734 if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG)
750735 printk(KERN_DEBUG "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data);
751736 nubus_get_subdir(&ent, &dir);
752737
753738 /* Resource ID 01, also an "Unknown Macintosh" */
754− if (nubus_readdir(&dir, &ent) == -1)
739+ if (nubus_readdir(&dir, &ent) == -1)
755740 goto badrom;
756741 if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG)
757742 printk(KERN_DEBUG "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data);
@@ -770,12 +755,12 @@ static void __init nubus_find_rom_dir(struct nubus_board* board) · 12 unmodified lines
770755 goto badrom;
771756 if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG)
772757 printk(KERN_DEBUG "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data);
773−
758+
774759 /* Bwahahahaha... */
775760 nubus_get_subdir(&ent, &dir);
776761 board->directory = dir.base;
777762 return;
778−
763+
779764 /* Even more evil laughter... */
780765 badrom:
781766 board->directory = board->fblock;
@@ -784,23 +769,22 @@ static void __init nubus_find_rom_dir(struct nubus_board* board) · 2 unmodified lines
784769 }
785770
786771 /* Add a board (might be many devices) to the list */
787−static struct nubus_board* __init nubus_add_board(int slot, int bytelanes)
772+static struct nubus_board * __init nubus_add_board(int slot, int bytelanes)
788773 {
789− struct nubus_board* board;
790− struct nubus_board** boardp;
791−
774+ struct nubus_board *board;
775+ struct nubus_board **boardp;
792776 unsigned char *rp;
793777 unsigned long dpat;
794778 struct nubus_dir dir;
795779 struct nubus_dirent ent;
796780
797781 /* Move to the start of the format block */
798− rp = nubus_rom_addr(slot);
782+ rp = nubus_rom_addr(slot);
799783 nubus_rewind(&rp, FORMAT_BLOCK_SIZE, bytelanes);
800784
801785 /* Actually we should probably panic if this fails */
802786 if ((board = kzalloc(sizeof(*board), GFP_ATOMIC)) == NULL)
803− return NULL;
787+ return NULL;
804788 board->fblock = rp;
805789
806790 /* Dump the format block for debugging purposes */
@@ -816,7 +800,7 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes) · 9 unmodified lines
816800 rp = board->fblock;
817801
818802 board->slot = slot;
819− board->slot_addr = (unsigned long) nubus_slot_addr(slot);
803+ board->slot_addr = (unsigned long)nubus_slot_addr(slot);
820804 board->doffset = nubus_get_rom(&rp, 4, bytelanes);
821805 /* rom_length is *supposed* to be the total length of the
822806 * ROM. In practice it is the "amount of ROM used to compute
@@ -827,16 +811,16 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes) · 4 unmodified lines
827811 board->rom_length = nubus_get_rom(&rp, 4, bytelanes);
828812 board->crc = nubus_get_rom(&rp, 4, bytelanes);
829813 board->rev = nubus_get_rom(&rp, 1, bytelanes);
830− board->format = nubus_get_rom(&rp,1, bytelanes);
814+ board->format = nubus_get_rom(&rp, 1, bytelanes);
831815 board->lanes = bytelanes;
832816
833817 /* Directory offset should be small and negative... */
834− if(!(board->doffset & 0x00FF0000))
818+ if (!(board->doffset & 0x00FF0000))
835819 pr_warn("Dodgy doffset!\n");
836820 dpat = nubus_get_rom(&rp, 4, bytelanes);
837− if(dpat != NUBUS_TEST_PATTERN)
821+ if (dpat != NUBUS_TEST_PATTERN)
838822 pr_warn("Wrong test pattern %08lx!\n", dpat);
839−
823+
840824 /*
841825 * I wonder how the CRC is meant to work -
842826 * any takers ?
@@ -846,7 +830,7 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes) · 3 unmodified lines
846830
847831 /* Attempt to work around slot zero weirdness */
848832 nubus_find_rom_dir(board);
849− nubus_get_root_dir(board, &dir);
833+ nubus_get_root_dir(board, &dir);
850834
851835 /* We're ready to rock */
852836 pr_info("Slot %X:\n", slot);
@@ -869,8 +853,9 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes) · 16 unmodified lines
869853 resources. I have no idea WTF to do about this. */
870854
871855 while (nubus_readdir(&dir, &ent) != -1) {
872− struct nubus_dev* dev;
873− struct nubus_dev** devp;
856+ struct nubus_dev *dev;
857+ struct nubus_dev **devp;
858+
874859 dev = nubus_get_functional_resource(board, slot, &ent);
875860 if (dev == NULL)
876861 continue;
@@ -878,32 +863,33 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes) · 1 unmodified line
878863 /* We zeroed this out above */
879864 if (board->first_dev == NULL)
880865 board->first_dev = dev;
881−
866+
882867 /* Put it on the global NuBus device chain. Keep entries in order. */
883− for (devp=&nubus_devices; *devp!=NULL; devp=&((*devp)->next))
868+ for (devp = &nubus_devices; *devp != NULL;
869+ devp = &((*devp)->next))
884870 /* spin */;
885871 *devp = dev;
886− dev->next = NULL;
872+ dev->next = NULL;
887873 }
888874
889875 /* Put it on the global NuBus board chain. Keep entries in order. */
890− for (boardp=&nubus_boards; *boardp!=NULL; boardp=&((*boardp)->next))
876+ for (boardp = &nubus_boards; *boardp != NULL;
877+ boardp = &((*boardp)->next))
891878 /* spin */;
892879 *boardp = board;
893880 board->next = NULL;
894−
881+
895882 return board;
896883 }
897884
898885 void __init nubus_probe_slot(int slot)
899886 {
900887 unsigned char dp;
901− unsigned char* rp;
888+ unsigned char *rp;
902889 int i;
903890
904− rp = nubus_rom_addr(slot);
905− for(i = 4; i; i--)
906− {
891+ rp = nubus_rom_addr(slot);
892+ for (i = 4; i; i--) {
907893 int card_present;
908894
909895 rp--;
@@ -918,11 +904,11 @@ void __init nubus_probe_slot(int slot) · 8 unmodified lines
918904 /* The last byte of the format block consists of two
919905 nybbles which are "mirror images" of each other.
920906 These show us the valid bytelanes */
921− if ((((dp>>4) ^ dp) & 0x0F) != 0x0F)
907+ if ((((dp >> 4) ^ dp) & 0x0F) != 0x0F)
922908 continue;
923909 /* Check that this value is actually *on* one of the
924910 bytelanes it claims are valid! */
925− if ((dp & 0x0F) >= (1<<i))
911+ if ((dp & 0x0F) >= (1 << i))
926912 continue;
927913
928914 /* Looks promising. Let's put it on the list. */
@@ -935,19 +921,19 @@ void __init nubus_probe_slot(int slot) · 6 unmodified lines
935921 void __init nubus_scan_bus(void)
936922 {
937923 int slot;
924+
938925 /* This might not work on your machine */
939926 #ifdef I_WANT_TO_PROBE_SLOT_ZERO
940927 nubus_probe_slot(0);
941928 #endif
942− for(slot = 9; slot < 15; slot++)
943− {
929+ for (slot = 9; slot < 15; slot++) {
944930 nubus_probe_slot(slot);
945931 }
946932 }
947933
948934 static int __init nubus_init(void)
949935 {
950− if (!MACH_IS_MAC)
936+ if (!MACH_IS_MAC)
951937 return 0;
952938
953939 /* Initialize the NuBus interrupts */
@@ -963,11 +949,11 @@ static int __init nubus_init(void) · 9 unmodified lines
963949 gurus can fix the real cause of the problem. */
964950 mdelay(1000);
965951 #endif
966−
952+
967953 /* And probe */
968954 pr_info("NuBus: Scanning NuBus slots.\n");
969955 nubus_devices = NULL;
970− nubus_boards = NULL;
956+ nubus_boards = NULL;
971957 nubus_scan_bus();
972958 nubus_proc_init();
973959 return 0;