diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 11:36:37 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 11:36:37 -0400 |
commit | 9841654949f0a3f1289b6b95b2ab56cd99fb5360 (patch) | |
tree | 26cea36adac076e555a4b35a8af74890f1f28163 /drivers/ide/ide-disk.c | |
parent | 799ee57ac83f019f035024614d95067ce583bc2b (diff) |
ide-disk: fix issues found by checkpatch.pl
There are no changes to the resulting drivers/ide/ide-disk.o binary file
(md5sum-s after and before the patch match).
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-disk.c')
-rw-r--r-- | drivers/ide/ide-disk.c | 120 |
1 files changed, 70 insertions, 50 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 4fb5715eb5d5..8e08d083fce9 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -16,8 +16,6 @@ | |||
16 | 16 | ||
17 | #define IDEDISK_VERSION "1.18" | 17 | #define IDEDISK_VERSION "1.18" |
18 | 18 | ||
19 | //#define DEBUG | ||
20 | |||
21 | #include <linux/module.h> | 19 | #include <linux/module.h> |
22 | #include <linux/types.h> | 20 | #include <linux/types.h> |
23 | #include <linux/string.h> | 21 | #include <linux/string.h> |
@@ -88,7 +86,7 @@ static void ide_disk_put(struct ide_disk_obj *idkp) | |||
88 | * | 86 | * |
89 | * It is called only once for each drive. | 87 | * It is called only once for each drive. |
90 | */ | 88 | */ |
91 | static int lba_capacity_is_ok (struct hd_driveid *id) | 89 | static int lba_capacity_is_ok(struct hd_driveid *id) |
92 | { | 90 | { |
93 | unsigned long lba_sects, chs_sects, head, tail; | 91 | unsigned long lba_sects, chs_sects, head, tail; |
94 | 92 | ||
@@ -176,7 +174,8 @@ static void ide_tf_set_cmd(ide_drive_t *drive, ide_task_t *task, u8 dma) | |||
176 | * __ide_do_rw_disk() issues READ and WRITE commands to a disk, | 174 | * __ide_do_rw_disk() issues READ and WRITE commands to a disk, |
177 | * using LBA if supported, or CHS otherwise, to address sectors. | 175 | * using LBA if supported, or CHS otherwise, to address sectors. |
178 | */ | 176 | */ |
179 | static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, sector_t block) | 177 | static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, |
178 | sector_t block) | ||
180 | { | 179 | { |
181 | ide_hwif_t *hwif = HWIF(drive); | 180 | ide_hwif_t *hwif = HWIF(drive); |
182 | unsigned int dma = drive->using_dma; | 181 | unsigned int dma = drive->using_dma; |
@@ -228,7 +227,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, | |||
228 | tf->device = (block >> 8) & 0xf; | 227 | tf->device = (block >> 8) & 0xf; |
229 | } | 228 | } |
230 | } else { | 229 | } else { |
231 | unsigned int sect,head,cyl,track; | 230 | unsigned int sect, head, cyl, track; |
231 | |||
232 | track = (int)block / drive->sect; | 232 | track = (int)block / drive->sect; |
233 | sect = (int)block % drive->sect + 1; | 233 | sect = (int)block % drive->sect + 1; |
234 | head = track % drive->head; | 234 | head = track % drive->head; |
@@ -271,7 +271,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, | |||
271 | * 1073741822 == 549756 MB or 48bit addressing fake drive | 271 | * 1073741822 == 549756 MB or 48bit addressing fake drive |
272 | */ | 272 | */ |
273 | 273 | ||
274 | static ide_startstop_t ide_do_rw_disk (ide_drive_t *drive, struct request *rq, sector_t block) | 274 | static ide_startstop_t ide_do_rw_disk(ide_drive_t *drive, struct request *rq, |
275 | sector_t block) | ||
275 | { | 276 | { |
276 | ide_hwif_t *hwif = HWIF(drive); | 277 | ide_hwif_t *hwif = HWIF(drive); |
277 | 278 | ||
@@ -452,7 +453,7 @@ static void idedisk_check_hpa(ide_drive_t *drive) | |||
452 | * in above order (i.e., if value of higher priority is available, | 453 | * in above order (i.e., if value of higher priority is available, |
453 | * reset will be ignored). | 454 | * reset will be ignored). |
454 | */ | 455 | */ |
455 | static void init_idedisk_capacity (ide_drive_t *drive) | 456 | static void init_idedisk_capacity(ide_drive_t *drive) |
456 | { | 457 | { |
457 | struct hd_driveid *id = drive->id; | 458 | struct hd_driveid *id = drive->id; |
458 | /* | 459 | /* |
@@ -479,7 +480,7 @@ static void init_idedisk_capacity (ide_drive_t *drive) | |||
479 | } | 480 | } |
480 | } | 481 | } |
481 | 482 | ||
482 | static sector_t idedisk_capacity (ide_drive_t *drive) | 483 | static sector_t idedisk_capacity(ide_drive_t *drive) |
483 | { | 484 | { |
484 | return drive->capacity64 - drive->sect0; | 485 | return drive->capacity64 - drive->sect0; |
485 | } | 486 | } |
@@ -524,10 +525,11 @@ static int proc_idedisk_read_cache | |||
524 | int len; | 525 | int len; |
525 | 526 | ||
526 | if (drive->id_read) | 527 | if (drive->id_read) |
527 | len = sprintf(out,"%i\n", drive->id->buf_size / 2); | 528 | len = sprintf(out, "%i\n", drive->id->buf_size / 2); |
528 | else | 529 | else |
529 | len = sprintf(out,"(none)\n"); | 530 | len = sprintf(out, "(none)\n"); |
530 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 531 | |
532 | PROC_IDE_READ_RETURN(page, start, off, count, eof, len); | ||
531 | } | 533 | } |
532 | 534 | ||
533 | static int proc_idedisk_read_capacity | 535 | static int proc_idedisk_read_capacity |
@@ -536,8 +538,9 @@ static int proc_idedisk_read_capacity | |||
536 | ide_drive_t*drive = (ide_drive_t *)data; | 538 | ide_drive_t*drive = (ide_drive_t *)data; |
537 | int len; | 539 | int len; |
538 | 540 | ||
539 | len = sprintf(page,"%llu\n", (long long)idedisk_capacity(drive)); | 541 | len = sprintf(page, "%llu\n", (long long)idedisk_capacity(drive)); |
540 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 542 | |
543 | PROC_IDE_READ_RETURN(page, start, off, count, eof, len); | ||
541 | } | 544 | } |
542 | 545 | ||
543 | static int proc_idedisk_read_smart(char *page, char **start, off_t off, | 546 | static int proc_idedisk_read_smart(char *page, char **start, off_t off, |
@@ -551,12 +554,14 @@ static int proc_idedisk_read_smart(char *page, char **start, off_t off, | |||
551 | char *out = ((char *)val) + (SECTOR_WORDS * 4); | 554 | char *out = ((char *)val) + (SECTOR_WORDS * 4); |
552 | page = out; | 555 | page = out; |
553 | do { | 556 | do { |
554 | out += sprintf(out, "%04x%c", le16_to_cpu(*val), (++i & 7) ? ' ' : '\n'); | 557 | out += sprintf(out, "%04x%c", le16_to_cpu(*val), |
558 | (++i & 7) ? ' ' : '\n'); | ||
555 | val += 1; | 559 | val += 1; |
556 | } while (i < (SECTOR_WORDS * 2)); | 560 | } while (i < (SECTOR_WORDS * 2)); |
557 | len = out - page; | 561 | len = out - page; |
558 | } | 562 | } |
559 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 563 | |
564 | PROC_IDE_READ_RETURN(page, start, off, count, eof, len); | ||
560 | } | 565 | } |
561 | 566 | ||
562 | static int proc_idedisk_read_sv | 567 | static int proc_idedisk_read_sv |
@@ -620,12 +625,13 @@ static int set_multcount(ide_drive_t *drive, int arg) | |||
620 | if (drive->special.b.set_multmode) | 625 | if (drive->special.b.set_multmode) |
621 | return -EBUSY; | 626 | return -EBUSY; |
622 | 627 | ||
623 | ide_init_drive_cmd (&rq); | 628 | ide_init_drive_cmd(&rq); |
624 | rq.cmd_type = REQ_TYPE_ATA_TASKFILE; | 629 | rq.cmd_type = REQ_TYPE_ATA_TASKFILE; |
625 | 630 | ||
626 | drive->mult_req = arg; | 631 | drive->mult_req = arg; |
627 | drive->special.b.set_multmode = 1; | 632 | drive->special.b.set_multmode = 1; |
628 | (void) ide_do_drive_cmd (drive, &rq, ide_wait); | 633 | (void)ide_do_drive_cmd(drive, &rq, ide_wait); |
634 | |||
629 | return (drive->mult_count == arg) ? 0 : -EIO; | 635 | return (drive->mult_count == arg) ? 0 : -EIO; |
630 | } | 636 | } |
631 | 637 | ||
@@ -701,7 +707,7 @@ static int write_cache(ide_drive_t *drive, int arg) | |||
701 | return err; | 707 | return err; |
702 | } | 708 | } |
703 | 709 | ||
704 | static int do_idedisk_flushcache (ide_drive_t *drive) | 710 | static int do_idedisk_flushcache(ide_drive_t *drive) |
705 | { | 711 | { |
706 | ide_task_t args; | 712 | ide_task_t args; |
707 | 713 | ||
@@ -714,7 +720,7 @@ static int do_idedisk_flushcache (ide_drive_t *drive) | |||
714 | return ide_no_data_taskfile(drive, &args); | 720 | return ide_no_data_taskfile(drive, &args); |
715 | } | 721 | } |
716 | 722 | ||
717 | static int set_acoustic (ide_drive_t *drive, int arg) | 723 | static int set_acoustic(ide_drive_t *drive, int arg) |
718 | { | 724 | { |
719 | ide_task_t args; | 725 | ide_task_t args; |
720 | 726 | ||
@@ -748,7 +754,7 @@ static int set_lba_addressing(ide_drive_t *drive, int arg) | |||
748 | return 0; | 754 | return 0; |
749 | 755 | ||
750 | if (!idedisk_supports_lba48(drive->id)) | 756 | if (!idedisk_supports_lba48(drive->id)) |
751 | return -EIO; | 757 | return -EIO; |
752 | drive->addressing = arg; | 758 | drive->addressing = arg; |
753 | return 0; | 759 | return 0; |
754 | } | 760 | } |
@@ -758,23 +764,35 @@ static void idedisk_add_settings(ide_drive_t *drive) | |||
758 | { | 764 | { |
759 | struct hd_driveid *id = drive->id; | 765 | struct hd_driveid *id = drive->id; |
760 | 766 | ||
761 | ide_add_setting(drive, "bios_cyl", SETTING_RW, TYPE_INT, 0, 65535, 1, 1, &drive->bios_cyl, NULL); | 767 | ide_add_setting(drive, "bios_cyl", SETTING_RW, TYPE_INT, 0, 65535, 1, 1, |
762 | ide_add_setting(drive, "bios_head", SETTING_RW, TYPE_BYTE, 0, 255, 1, 1, &drive->bios_head, NULL); | 768 | &drive->bios_cyl, NULL); |
763 | ide_add_setting(drive, "bios_sect", SETTING_RW, TYPE_BYTE, 0, 63, 1, 1, &drive->bios_sect, NULL); | 769 | ide_add_setting(drive, "bios_head", SETTING_RW, TYPE_BYTE, 0, 255, 1, 1, |
764 | ide_add_setting(drive, "address", SETTING_RW, TYPE_BYTE, 0, 2, 1, 1, &drive->addressing, set_lba_addressing); | 770 | &drive->bios_head, NULL); |
765 | ide_add_setting(drive, "multcount", SETTING_RW, TYPE_BYTE, 0, id->max_multsect, 1, 1, &drive->mult_count, set_multcount); | 771 | ide_add_setting(drive, "bios_sect", SETTING_RW, TYPE_BYTE, 0, 63, 1, 1, |
766 | ide_add_setting(drive, "nowerr", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->nowerr, set_nowerr); | 772 | &drive->bios_sect, NULL); |
767 | ide_add_setting(drive, "lun", SETTING_RW, TYPE_INT, 0, 7, 1, 1, &drive->lun, NULL); | 773 | ide_add_setting(drive, "address", SETTING_RW, TYPE_BYTE, 0, 2, 1, 1, |
768 | ide_add_setting(drive, "wcache", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->wcache, write_cache); | 774 | &drive->addressing, set_lba_addressing); |
769 | ide_add_setting(drive, "acoustic", SETTING_RW, TYPE_BYTE, 0, 254, 1, 1, &drive->acoustic, set_acoustic); | 775 | ide_add_setting(drive, "multcount", SETTING_RW, TYPE_BYTE, 0, |
770 | ide_add_setting(drive, "failures", SETTING_RW, TYPE_INT, 0, 65535, 1, 1, &drive->failures, NULL); | 776 | id->max_multsect, 1, 1, &drive->mult_count, |
771 | ide_add_setting(drive, "max_failures", SETTING_RW, TYPE_INT, 0, 65535, 1, 1, &drive->max_failures, NULL); | 777 | set_multcount); |
778 | ide_add_setting(drive, "nowerr", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, | ||
779 | &drive->nowerr, set_nowerr); | ||
780 | ide_add_setting(drive, "lun", SETTING_RW, TYPE_INT, 0, 7, 1, 1, | ||
781 | &drive->lun, NULL); | ||
782 | ide_add_setting(drive, "wcache", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, | ||
783 | &drive->wcache, write_cache); | ||
784 | ide_add_setting(drive, "acoustic", SETTING_RW, TYPE_BYTE, 0, 254, 1, 1, | ||
785 | &drive->acoustic, set_acoustic); | ||
786 | ide_add_setting(drive, "failures", SETTING_RW, TYPE_INT, 0, 65535, 1, 1, | ||
787 | &drive->failures, NULL); | ||
788 | ide_add_setting(drive, "max_failures", SETTING_RW, TYPE_INT, 0, 65535, | ||
789 | 1, 1, &drive->max_failures, NULL); | ||
772 | } | 790 | } |
773 | #else | 791 | #else |
774 | static inline void idedisk_add_settings(ide_drive_t *drive) { ; } | 792 | static inline void idedisk_add_settings(ide_drive_t *drive) { ; } |
775 | #endif | 793 | #endif |
776 | 794 | ||
777 | static void idedisk_setup (ide_drive_t *drive) | 795 | static void idedisk_setup(ide_drive_t *drive) |
778 | { | 796 | { |
779 | ide_hwif_t *hwif = drive->hwif; | 797 | ide_hwif_t *hwif = drive->hwif; |
780 | struct hd_driveid *id = drive->id; | 798 | struct hd_driveid *id = drive->id; |
@@ -787,11 +805,10 @@ static void idedisk_setup (ide_drive_t *drive) | |||
787 | 805 | ||
788 | if (drive->removable) { | 806 | if (drive->removable) { |
789 | /* | 807 | /* |
790 | * Removable disks (eg. SYQUEST); ignore 'WD' drives | 808 | * Removable disks (eg. SYQUEST); ignore 'WD' drives |
791 | */ | 809 | */ |
792 | if (id->model[0] != 'W' || id->model[1] != 'D') { | 810 | if (id->model[0] != 'W' || id->model[1] != 'D') |
793 | drive->doorlocking = 1; | 811 | drive->doorlocking = 1; |
794 | } | ||
795 | } | 812 | } |
796 | 813 | ||
797 | (void)set_lba_addressing(drive, 1); | 814 | (void)set_lba_addressing(drive, 1); |
@@ -805,10 +822,11 @@ static void idedisk_setup (ide_drive_t *drive) | |||
805 | blk_queue_max_sectors(drive->queue, max_s); | 822 | blk_queue_max_sectors(drive->queue, max_s); |
806 | } | 823 | } |
807 | 824 | ||
808 | printk(KERN_INFO "%s: max request size: %dKiB\n", drive->name, drive->queue->max_sectors / 2); | 825 | printk(KERN_INFO "%s: max request size: %dKiB\n", drive->name, |
826 | drive->queue->max_sectors / 2); | ||
809 | 827 | ||
810 | /* calculate drive capacity, and select LBA if possible */ | 828 | /* calculate drive capacity, and select LBA if possible */ |
811 | init_idedisk_capacity (drive); | 829 | init_idedisk_capacity(drive); |
812 | 830 | ||
813 | /* limit drive capacity to 137GB if LBA48 cannot be used */ | 831 | /* limit drive capacity to 137GB if LBA48 cannot be used */ |
814 | if (drive->addressing == 0 && drive->capacity64 > 1ULL << 28) { | 832 | if (drive->addressing == 0 && drive->capacity64 > 1ULL << 28) { |
@@ -821,9 +839,9 @@ static void idedisk_setup (ide_drive_t *drive) | |||
821 | 839 | ||
822 | if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && drive->addressing) { | 840 | if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && drive->addressing) { |
823 | if (drive->capacity64 > 1ULL << 28) { | 841 | if (drive->capacity64 > 1ULL << 28) { |
824 | printk(KERN_INFO "%s: cannot use LBA48 DMA - PIO mode will" | 842 | printk(KERN_INFO "%s: cannot use LBA48 DMA - PIO mode" |
825 | " be used for accessing sectors > %u\n", | 843 | " will be used for accessing sectors " |
826 | drive->name, 1 << 28); | 844 | "> %u\n", drive->name, 1 << 28); |
827 | } else | 845 | } else |
828 | drive->addressing = 0; | 846 | drive->addressing = 0; |
829 | } | 847 | } |
@@ -832,7 +850,8 @@ static void idedisk_setup (ide_drive_t *drive) | |||
832 | * if possible, give fdisk access to more of the drive, | 850 | * if possible, give fdisk access to more of the drive, |
833 | * by correcting bios_cyls: | 851 | * by correcting bios_cyls: |
834 | */ | 852 | */ |
835 | capacity = idedisk_capacity (drive); | 853 | capacity = idedisk_capacity(drive); |
854 | |||
836 | if (!drive->forced_geom) { | 855 | if (!drive->forced_geom) { |
837 | 856 | ||
838 | if (idedisk_supports_lba48(drive->id)) { | 857 | if (idedisk_supports_lba48(drive->id)) { |
@@ -988,7 +1007,8 @@ static int idedisk_open(struct inode *inode, struct file *filp) | |||
988 | struct ide_disk_obj *idkp; | 1007 | struct ide_disk_obj *idkp; |
989 | ide_drive_t *drive; | 1008 | ide_drive_t *drive; |
990 | 1009 | ||
991 | if (!(idkp = ide_disk_get(disk))) | 1010 | idkp = ide_disk_get(disk); |
1011 | if (idkp == NULL) | ||
992 | return -ENXIO; | 1012 | return -ENXIO; |
993 | 1013 | ||
994 | drive = idkp->drive; | 1014 | drive = idkp->drive; |
@@ -1110,13 +1130,13 @@ static int idedisk_revalidate_disk(struct gendisk *disk) | |||
1110 | } | 1130 | } |
1111 | 1131 | ||
1112 | static struct block_device_operations idedisk_ops = { | 1132 | static struct block_device_operations idedisk_ops = { |
1113 | .owner = THIS_MODULE, | 1133 | .owner = THIS_MODULE, |
1114 | .open = idedisk_open, | 1134 | .open = idedisk_open, |
1115 | .release = idedisk_release, | 1135 | .release = idedisk_release, |
1116 | .ioctl = idedisk_ioctl, | 1136 | .ioctl = idedisk_ioctl, |
1117 | .getgeo = idedisk_getgeo, | 1137 | .getgeo = idedisk_getgeo, |
1118 | .media_changed = idedisk_media_changed, | 1138 | .media_changed = idedisk_media_changed, |
1119 | .revalidate_disk= idedisk_revalidate_disk | 1139 | .revalidate_disk = idedisk_revalidate_disk |
1120 | }; | 1140 | }; |
1121 | 1141 | ||
1122 | MODULE_DESCRIPTION("ATA DISK Driver"); | 1142 | MODULE_DESCRIPTION("ATA DISK Driver"); |
@@ -1179,7 +1199,7 @@ failed: | |||
1179 | return -ENODEV; | 1199 | return -ENODEV; |
1180 | } | 1200 | } |
1181 | 1201 | ||
1182 | static void __exit idedisk_exit (void) | 1202 | static void __exit idedisk_exit(void) |
1183 | { | 1203 | { |
1184 | driver_unregister(&idedisk_driver.gen_driver); | 1204 | driver_unregister(&idedisk_driver.gen_driver); |
1185 | } | 1205 | } |