diff options
| author | Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com> | 2008-04-26 11:36:41 -0400 |
|---|---|---|
| committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 11:36:41 -0400 |
| commit | ec29782ba3fe6bd72668af8e0f7f18cd14a3dbcd (patch) | |
| tree | 57bb33366e894e87662295d91c122590c328d0c1 | |
| parent | 4752b5e7761a75bfc41ba3d9f4f8986643f22259 (diff) | |
IDE: Coding Style fixes to drivers/ide/legacy/hd.c
Fix a lot of errors and warnings.
Compile tested.
[bart: some fixes, md5sum checked]
Signed-off-by: Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
| -rw-r--r-- | drivers/ide/legacy/hd.c | 78 |
1 files changed, 40 insertions, 38 deletions
diff --git a/drivers/ide/legacy/hd.c b/drivers/ide/legacy/hd.c index 0b0d86731927..abdedf56643e 100644 --- a/drivers/ide/legacy/hd.c +++ b/drivers/ide/legacy/hd.c | |||
| @@ -122,12 +122,12 @@ static int hd_error; | |||
| 122 | * This struct defines the HD's and their types. | 122 | * This struct defines the HD's and their types. |
| 123 | */ | 123 | */ |
| 124 | struct hd_i_struct { | 124 | struct hd_i_struct { |
| 125 | unsigned int head,sect,cyl,wpcom,lzone,ctl; | 125 | unsigned int head, sect, cyl, wpcom, lzone, ctl; |
| 126 | int unit; | 126 | int unit; |
| 127 | int recalibrate; | 127 | int recalibrate; |
| 128 | int special_op; | 128 | int special_op; |
| 129 | }; | 129 | }; |
| 130 | 130 | ||
| 131 | #ifdef HD_TYPE | 131 | #ifdef HD_TYPE |
| 132 | static struct hd_i_struct hd_info[] = { HD_TYPE }; | 132 | static struct hd_i_struct hd_info[] = { HD_TYPE }; |
| 133 | static int NR_HD = ARRAY_SIZE(hd_info); | 133 | static int NR_HD = ARRAY_SIZE(hd_info); |
| @@ -168,7 +168,7 @@ unsigned long read_timer(void) | |||
| 168 | 168 | ||
| 169 | spin_lock_irqsave(&i8253_lock, flags); | 169 | spin_lock_irqsave(&i8253_lock, flags); |
| 170 | t = jiffies * 11932; | 170 | t = jiffies * 11932; |
| 171 | outb_p(0, 0x43); | 171 | outb_p(0, 0x43); |
| 172 | i = inb_p(0x40); | 172 | i = inb_p(0x40); |
| 173 | i |= inb(0x40) << 8; | 173 | i |= inb(0x40) << 8; |
| 174 | spin_unlock_irqrestore(&i8253_lock, flags); | 174 | spin_unlock_irqrestore(&i8253_lock, flags); |
| @@ -183,7 +183,7 @@ static void __init hd_setup(char *str, int *ints) | |||
| 183 | if (ints[0] != 3) | 183 | if (ints[0] != 3) |
| 184 | return; | 184 | return; |
| 185 | if (hd_info[0].head != 0) | 185 | if (hd_info[0].head != 0) |
| 186 | hdind=1; | 186 | hdind = 1; |
| 187 | hd_info[hdind].head = ints[2]; | 187 | hd_info[hdind].head = ints[2]; |
| 188 | hd_info[hdind].sect = ints[3]; | 188 | hd_info[hdind].sect = ints[3]; |
| 189 | hd_info[hdind].cyl = ints[1]; | 189 | hd_info[hdind].cyl = ints[1]; |
| @@ -193,7 +193,7 @@ static void __init hd_setup(char *str, int *ints) | |||
| 193 | NR_HD = hdind+1; | 193 | NR_HD = hdind+1; |
| 194 | } | 194 | } |
| 195 | 195 | ||
| 196 | static void dump_status (const char *msg, unsigned int stat) | 196 | static void dump_status(const char *msg, unsigned int stat) |
| 197 | { | 197 | { |
| 198 | char *name = "hd?"; | 198 | char *name = "hd?"; |
| 199 | if (CURRENT) | 199 | if (CURRENT) |
| @@ -291,7 +291,6 @@ static int controller_ready(unsigned int drive, unsigned int head) | |||
| 291 | return 0; | 291 | return 0; |
| 292 | } | 292 | } |
| 293 | 293 | ||
| 294 | |||
| 295 | static void hd_out(struct hd_i_struct *disk, | 294 | static void hd_out(struct hd_i_struct *disk, |
| 296 | unsigned int nsect, | 295 | unsigned int nsect, |
| 297 | unsigned int sect, | 296 | unsigned int sect, |
| @@ -313,15 +312,15 @@ static void hd_out(struct hd_i_struct *disk, | |||
| 313 | return; | 312 | return; |
| 314 | } | 313 | } |
| 315 | SET_HANDLER(intr_addr); | 314 | SET_HANDLER(intr_addr); |
| 316 | outb_p(disk->ctl,HD_CMD); | 315 | outb_p(disk->ctl, HD_CMD); |
| 317 | port=HD_DATA; | 316 | port = HD_DATA; |
| 318 | outb_p(disk->wpcom>>2,++port); | 317 | outb_p(disk->wpcom >> 2, ++port); |
| 319 | outb_p(nsect,++port); | 318 | outb_p(nsect, ++port); |
| 320 | outb_p(sect,++port); | 319 | outb_p(sect, ++port); |
| 321 | outb_p(cyl,++port); | 320 | outb_p(cyl, ++port); |
| 322 | outb_p(cyl>>8,++port); | 321 | outb_p(cyl >> 8, ++port); |
| 323 | outb_p(0xA0|(disk->unit<<4)|head,++port); | 322 | outb_p(0xA0 | (disk->unit << 4) | head, ++port); |
| 324 | outb_p(cmd,++port); | 323 | outb_p(cmd, ++port); |
| 325 | } | 324 | } |
| 326 | 325 | ||
| 327 | static void hd_request (void); | 326 | static void hd_request (void); |
| @@ -344,14 +343,14 @@ static void reset_controller(void) | |||
| 344 | { | 343 | { |
| 345 | int i; | 344 | int i; |
| 346 | 345 | ||
| 347 | outb_p(4,HD_CMD); | 346 | outb_p(4, HD_CMD); |
| 348 | for(i = 0; i < 1000; i++) barrier(); | 347 | for (i = 0; i < 1000; i++) barrier(); |
| 349 | outb_p(hd_info[0].ctl & 0x0f,HD_CMD); | 348 | outb_p(hd_info[0].ctl & 0x0f, HD_CMD); |
| 350 | for(i = 0; i < 1000; i++) barrier(); | 349 | for (i = 0; i < 1000; i++) barrier(); |
| 351 | if (drive_busy()) | 350 | if (drive_busy()) |
| 352 | printk("hd: controller still busy\n"); | 351 | printk("hd: controller still busy\n"); |
| 353 | else if ((hd_error = inb(HD_ERROR)) != 1) | 352 | else if ((hd_error = inb(HD_ERROR)) != 1) |
| 354 | printk("hd: controller reset failed: %02x\n",hd_error); | 353 | printk("hd: controller reset failed: %02x\n", hd_error); |
| 355 | } | 354 | } |
| 356 | 355 | ||
| 357 | static void reset_hd(void) | 356 | static void reset_hd(void) |
| @@ -371,8 +370,8 @@ repeat: | |||
| 371 | if (++i < NR_HD) { | 370 | if (++i < NR_HD) { |
| 372 | struct hd_i_struct *disk = &hd_info[i]; | 371 | struct hd_i_struct *disk = &hd_info[i]; |
| 373 | disk->special_op = disk->recalibrate = 1; | 372 | disk->special_op = disk->recalibrate = 1; |
| 374 | hd_out(disk,disk->sect,disk->sect,disk->head-1, | 373 | hd_out(disk, disk->sect, disk->sect, disk->head-1, |
| 375 | disk->cyl,WIN_SPECIFY,&reset_hd); | 374 | disk->cyl, WIN_SPECIFY, &reset_hd); |
| 376 | if (reset) | 375 | if (reset) |
| 377 | goto repeat; | 376 | goto repeat; |
| 378 | } else | 377 | } else |
| @@ -393,7 +392,7 @@ static void unexpected_hd_interrupt(void) | |||
| 393 | unsigned int stat = inb_p(HD_STATUS); | 392 | unsigned int stat = inb_p(HD_STATUS); |
| 394 | 393 | ||
| 395 | if (stat & (BUSY_STAT|DRQ_STAT|ECC_STAT|ERR_STAT)) { | 394 | if (stat & (BUSY_STAT|DRQ_STAT|ECC_STAT|ERR_STAT)) { |
| 396 | dump_status ("unexpected interrupt", stat); | 395 | dump_status("unexpected interrupt", stat); |
| 397 | SET_TIMER; | 396 | SET_TIMER; |
| 398 | } | 397 | } |
| 399 | } | 398 | } |
| @@ -453,7 +452,7 @@ static void read_intr(void) | |||
| 453 | return; | 452 | return; |
| 454 | ok_to_read: | 453 | ok_to_read: |
| 455 | req = CURRENT; | 454 | req = CURRENT; |
| 456 | insw(HD_DATA,req->buffer,256); | 455 | insw(HD_DATA, req->buffer, 256); |
| 457 | req->sector++; | 456 | req->sector++; |
| 458 | req->buffer += 512; | 457 | req->buffer += 512; |
| 459 | req->errors = 0; | 458 | req->errors = 0; |
| @@ -507,7 +506,7 @@ ok_to_write: | |||
| 507 | end_request(req, 1); | 506 | end_request(req, 1); |
| 508 | if (i > 0) { | 507 | if (i > 0) { |
| 509 | SET_HANDLER(&write_intr); | 508 | SET_HANDLER(&write_intr); |
| 510 | outsw(HD_DATA,req->buffer,256); | 509 | outsw(HD_DATA, req->buffer, 256); |
| 511 | local_irq_enable(); | 510 | local_irq_enable(); |
| 512 | } else { | 511 | } else { |
| 513 | #if (HD_DELAY > 0) | 512 | #if (HD_DELAY > 0) |
| @@ -560,11 +559,11 @@ static int do_special_op(struct hd_i_struct *disk, struct request *req) | |||
| 560 | { | 559 | { |
| 561 | if (disk->recalibrate) { | 560 | if (disk->recalibrate) { |
| 562 | disk->recalibrate = 0; | 561 | disk->recalibrate = 0; |
| 563 | hd_out(disk,disk->sect,0,0,0,WIN_RESTORE,&recal_intr); | 562 | hd_out(disk, disk->sect, 0, 0, 0, WIN_RESTORE, &recal_intr); |
| 564 | return reset; | 563 | return reset; |
| 565 | } | 564 | } |
| 566 | if (disk->head > 16) { | 565 | if (disk->head > 16) { |
| 567 | printk ("%s: cannot handle device with more than 16 heads - giving up\n", req->rq_disk->disk_name); | 566 | printk("%s: cannot handle device with more than 16 heads - giving up\n", req->rq_disk->disk_name); |
| 568 | end_request(req, 0); | 567 | end_request(req, 0); |
| 569 | } | 568 | } |
| 570 | disk->special_op = 0; | 569 | disk->special_op = 0; |
| @@ -633,19 +632,21 @@ repeat: | |||
| 633 | if (blk_fs_request(req)) { | 632 | if (blk_fs_request(req)) { |
| 634 | switch (rq_data_dir(req)) { | 633 | switch (rq_data_dir(req)) { |
| 635 | case READ: | 634 | case READ: |
| 636 | hd_out(disk,nsect,sec,head,cyl,WIN_READ,&read_intr); | 635 | hd_out(disk, nsect, sec, head, cyl, WIN_READ, |
| 636 | &read_intr); | ||
| 637 | if (reset) | 637 | if (reset) |
| 638 | goto repeat; | 638 | goto repeat; |
| 639 | break; | 639 | break; |
| 640 | case WRITE: | 640 | case WRITE: |
| 641 | hd_out(disk,nsect,sec,head,cyl,WIN_WRITE,&write_intr); | 641 | hd_out(disk, nsect, sec, head, cyl, WIN_WRITE, |
| 642 | &write_intr); | ||
| 642 | if (reset) | 643 | if (reset) |
| 643 | goto repeat; | 644 | goto repeat; |
| 644 | if (wait_DRQ()) { | 645 | if (wait_DRQ()) { |
| 645 | bad_rw_intr(); | 646 | bad_rw_intr(); |
| 646 | goto repeat; | 647 | goto repeat; |
| 647 | } | 648 | } |
| 648 | outsw(HD_DATA,req->buffer,256); | 649 | outsw(HD_DATA, req->buffer, 256); |
| 649 | break; | 650 | break; |
| 650 | default: | 651 | default: |
| 651 | printk("unknown hd-command\n"); | 652 | printk("unknown hd-command\n"); |
| @@ -655,7 +656,7 @@ repeat: | |||
| 655 | } | 656 | } |
| 656 | } | 657 | } |
| 657 | 658 | ||
| 658 | static void do_hd_request (struct request_queue * q) | 659 | static void do_hd_request(struct request_queue *q) |
| 659 | { | 660 | { |
| 660 | disable_irq(HD_IRQ); | 661 | disable_irq(HD_IRQ); |
| 661 | hd_request(); | 662 | hd_request(); |
| @@ -708,12 +709,12 @@ static int __init hd_init(void) | |||
| 708 | { | 709 | { |
| 709 | int drive; | 710 | int drive; |
| 710 | 711 | ||
| 711 | if (register_blkdev(MAJOR_NR,"hd")) | 712 | if (register_blkdev(MAJOR_NR, "hd")) |
| 712 | return -1; | 713 | return -1; |
| 713 | 714 | ||
| 714 | hd_queue = blk_init_queue(do_hd_request, &hd_lock); | 715 | hd_queue = blk_init_queue(do_hd_request, &hd_lock); |
| 715 | if (!hd_queue) { | 716 | if (!hd_queue) { |
| 716 | unregister_blkdev(MAJOR_NR,"hd"); | 717 | unregister_blkdev(MAJOR_NR, "hd"); |
| 717 | return -ENOMEM; | 718 | return -ENOMEM; |
| 718 | } | 719 | } |
| 719 | 720 | ||
| @@ -742,7 +743,7 @@ static int __init hd_init(void) | |||
| 742 | goto out; | 743 | goto out; |
| 743 | } | 744 | } |
| 744 | 745 | ||
| 745 | for (drive=0 ; drive < NR_HD ; drive++) { | 746 | for (drive = 0 ; drive < NR_HD ; drive++) { |
| 746 | struct gendisk *disk = alloc_disk(64); | 747 | struct gendisk *disk = alloc_disk(64); |
| 747 | struct hd_i_struct *p = &hd_info[drive]; | 748 | struct hd_i_struct *p = &hd_info[drive]; |
| 748 | if (!disk) | 749 | if (!disk) |
| @@ -756,7 +757,7 @@ static int __init hd_init(void) | |||
| 756 | disk->queue = hd_queue; | 757 | disk->queue = hd_queue; |
| 757 | p->unit = drive; | 758 | p->unit = drive; |
| 758 | hd_gendisk[drive] = disk; | 759 | hd_gendisk[drive] = disk; |
| 759 | printk ("%s: %luMB, CHS=%d/%d/%d\n", | 760 | printk("%s: %luMB, CHS=%d/%d/%d\n", |
| 760 | disk->disk_name, (unsigned long)get_capacity(disk)/2048, | 761 | disk->disk_name, (unsigned long)get_capacity(disk)/2048, |
| 761 | p->cyl, p->head, p->sect); | 762 | p->cyl, p->head, p->sect); |
| 762 | } | 763 | } |
| @@ -776,7 +777,7 @@ static int __init hd_init(void) | |||
| 776 | } | 777 | } |
| 777 | 778 | ||
| 778 | /* Let them fly */ | 779 | /* Let them fly */ |
| 779 | for(drive=0; drive < NR_HD; drive++) | 780 | for (drive = 0; drive < NR_HD; drive++) |
| 780 | add_disk(hd_gendisk[drive]); | 781 | add_disk(hd_gendisk[drive]); |
| 781 | 782 | ||
| 782 | return 0; | 783 | return 0; |
| @@ -791,7 +792,7 @@ out1: | |||
| 791 | NR_HD = 0; | 792 | NR_HD = 0; |
| 792 | out: | 793 | out: |
| 793 | del_timer(&device_timer); | 794 | del_timer(&device_timer); |
| 794 | unregister_blkdev(MAJOR_NR,"hd"); | 795 | unregister_blkdev(MAJOR_NR, "hd"); |
| 795 | blk_cleanup_queue(hd_queue); | 796 | blk_cleanup_queue(hd_queue); |
| 796 | return -1; | 797 | return -1; |
| 797 | Enomem: | 798 | Enomem: |
| @@ -800,7 +801,8 @@ Enomem: | |||
| 800 | goto out; | 801 | goto out; |
| 801 | } | 802 | } |
| 802 | 803 | ||
| 803 | static int __init parse_hd_setup (char *line) { | 804 | static int __init parse_hd_setup(char *line) |
| 805 | { | ||
| 804 | int ints[6]; | 806 | int ints[6]; |
| 805 | 807 | ||
| 806 | (void) get_options(line, ARRAY_SIZE(ints), ints); | 808 | (void) get_options(line, ARRAY_SIZE(ints), ints); |
