diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-26 12:48:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-26 12:48:00 -0400 |
commit | 1292ebb82c00c69cf983e871faa221ce88ed3338 (patch) | |
tree | 91f624dd175c9d3e842db78789c6a0c79a78eee5 /drivers/ide/ide-disk.c | |
parent | b82287587ef9917afbea5fcbf7aa63424b6f3719 (diff) | |
parent | 784506cbddd17bcd5929f827df39b0c7014e3f1e (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (61 commits)
ide: sanitize handling of IDE_HFLAG_NO_SET_MODE host flag
sis5513: fail early for unsupported chipsets
it821x: fix kzalloc() failure handling
qd65xx: use IDE_HFLAG_SINGLE host flag
qd65xx: always use ->selectproc method
ide-cd: put proc-related functions together under single ifdef
ide-cd: Replace __FUNCTION__ with __func__
IDE: Coding Style fixes to drivers/ide/ide-cd.c
IDE: Coding Style fixes to drivers/ide/pci/cy82c693.c
IDE: Coding Style fixes to drivers/ide/pci/it8213.c
IDE: Coding Style fixes to drivers/ide/ide-floppy.c
IDE: Coding Style fixes to drivers/ide/legacy/ali14xx.c
IDE: Coding Style fixes to drivers/ide/legacy/hd.c
IDE: Coding Style fixes to drivers/ide/pci/cmd640.c
IDE: Coding Style fixes to drivers/ide/pci/opti621.c
IDE: Coding Style fixes to drivers/ide/ide-pnp.c
IDE: Coding Style fixes to drivers/ide/ide-proc.c
IDE: Coding Style fixes to drivers/ide/legacy/ide-4drives.c
IDE: Coding Style fixes to drivers/ide/legacy/umc8672.c
IDE: Coding Style fixes to drivers/ide/pci/generic.c
...
Diffstat (limited to 'drivers/ide/ide-disk.c')
-rw-r--r-- | drivers/ide/ide-disk.c | 159 |
1 files changed, 87 insertions, 72 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 39501d130256..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,54 +538,52 @@ 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_thresholds | 546 | static int proc_idedisk_read_smart(char *page, char **start, off_t off, |
544 | (char *page, char **start, off_t off, int count, int *eof, void *data) | 547 | int count, int *eof, void *data, u8 sub_cmd) |
545 | { | 548 | { |
546 | ide_drive_t *drive = (ide_drive_t *)data; | 549 | ide_drive_t *drive = (ide_drive_t *)data; |
547 | int len = 0, i = 0; | 550 | int len = 0, i = 0; |
548 | 551 | ||
549 | if (get_smart_data(drive, page, SMART_READ_THRESHOLDS) == 0) { | 552 | if (get_smart_data(drive, page, sub_cmd) == 0) { |
550 | unsigned short *val = (unsigned short *) page; | 553 | unsigned short *val = (unsigned short *) page; |
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_smart_values | 567 | static int proc_idedisk_read_sv |
563 | (char *page, char **start, off_t off, int count, int *eof, void *data) | 568 | (char *page, char **start, off_t off, int count, int *eof, void *data) |
564 | { | 569 | { |
565 | ide_drive_t *drive = (ide_drive_t *)data; | 570 | return proc_idedisk_read_smart(page, start, off, count, eof, data, |
566 | int len = 0, i = 0; | 571 | SMART_READ_VALUES); |
572 | } | ||
567 | 573 | ||
568 | if (get_smart_data(drive, page, SMART_READ_VALUES) == 0) { | 574 | static int proc_idedisk_read_st |
569 | unsigned short *val = (unsigned short *) page; | 575 | (char *page, char **start, off_t off, int count, int *eof, void *data) |
570 | char *out = ((char *)val) + (SECTOR_WORDS * 4); | 576 | { |
571 | page = out; | 577 | return proc_idedisk_read_smart(page, start, off, count, eof, data, |
572 | do { | 578 | SMART_READ_THRESHOLDS); |
573 | out += sprintf(out, "%04x%c", le16_to_cpu(*val), (++i & 7) ? ' ' : '\n'); | ||
574 | val += 1; | ||
575 | } while (i < (SECTOR_WORDS * 2)); | ||
576 | len = out - page; | ||
577 | } | ||
578 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | ||
579 | } | 579 | } |
580 | 580 | ||
581 | static ide_proc_entry_t idedisk_proc[] = { | 581 | static ide_proc_entry_t idedisk_proc[] = { |
582 | { "cache", S_IFREG|S_IRUGO, proc_idedisk_read_cache, NULL }, | 582 | { "cache", S_IFREG|S_IRUGO, proc_idedisk_read_cache, NULL }, |
583 | { "capacity", S_IFREG|S_IRUGO, proc_idedisk_read_capacity, NULL }, | 583 | { "capacity", S_IFREG|S_IRUGO, proc_idedisk_read_capacity, NULL }, |
584 | { "geometry", S_IFREG|S_IRUGO, proc_ide_read_geometry, NULL }, | 584 | { "geometry", S_IFREG|S_IRUGO, proc_ide_read_geometry, NULL }, |
585 | { "smart_values", S_IFREG|S_IRUSR, proc_idedisk_read_smart_values, NULL }, | 585 | { "smart_values", S_IFREG|S_IRUSR, proc_idedisk_read_sv, NULL }, |
586 | { "smart_thresholds", S_IFREG|S_IRUSR, proc_idedisk_read_smart_thresholds, NULL }, | 586 | { "smart_thresholds", S_IFREG|S_IRUSR, proc_idedisk_read_st, NULL }, |
587 | { NULL, 0, NULL, NULL } | 587 | { NULL, 0, NULL, NULL } |
588 | }; | 588 | }; |
589 | #endif /* CONFIG_IDE_PROC_FS */ | 589 | #endif /* CONFIG_IDE_PROC_FS */ |
@@ -625,12 +625,13 @@ static int set_multcount(ide_drive_t *drive, int arg) | |||
625 | if (drive->special.b.set_multmode) | 625 | if (drive->special.b.set_multmode) |
626 | return -EBUSY; | 626 | return -EBUSY; |
627 | 627 | ||
628 | ide_init_drive_cmd (&rq); | 628 | ide_init_drive_cmd(&rq); |
629 | rq.cmd_type = REQ_TYPE_ATA_TASKFILE; | 629 | rq.cmd_type = REQ_TYPE_ATA_TASKFILE; |
630 | 630 | ||
631 | drive->mult_req = arg; | 631 | drive->mult_req = arg; |
632 | drive->special.b.set_multmode = 1; | 632 | drive->special.b.set_multmode = 1; |
633 | (void) ide_do_drive_cmd (drive, &rq, ide_wait); | 633 | (void)ide_do_drive_cmd(drive, &rq, ide_wait); |
634 | |||
634 | return (drive->mult_count == arg) ? 0 : -EIO; | 635 | return (drive->mult_count == arg) ? 0 : -EIO; |
635 | } | 636 | } |
636 | 637 | ||
@@ -706,7 +707,7 @@ static int write_cache(ide_drive_t *drive, int arg) | |||
706 | return err; | 707 | return err; |
707 | } | 708 | } |
708 | 709 | ||
709 | static int do_idedisk_flushcache (ide_drive_t *drive) | 710 | static int do_idedisk_flushcache(ide_drive_t *drive) |
710 | { | 711 | { |
711 | ide_task_t args; | 712 | ide_task_t args; |
712 | 713 | ||
@@ -719,7 +720,7 @@ static int do_idedisk_flushcache (ide_drive_t *drive) | |||
719 | return ide_no_data_taskfile(drive, &args); | 720 | return ide_no_data_taskfile(drive, &args); |
720 | } | 721 | } |
721 | 722 | ||
722 | static int set_acoustic (ide_drive_t *drive, int arg) | 723 | static int set_acoustic(ide_drive_t *drive, int arg) |
723 | { | 724 | { |
724 | ide_task_t args; | 725 | ide_task_t args; |
725 | 726 | ||
@@ -753,7 +754,7 @@ static int set_lba_addressing(ide_drive_t *drive, int arg) | |||
753 | return 0; | 754 | return 0; |
754 | 755 | ||
755 | if (!idedisk_supports_lba48(drive->id)) | 756 | if (!idedisk_supports_lba48(drive->id)) |
756 | return -EIO; | 757 | return -EIO; |
757 | drive->addressing = arg; | 758 | drive->addressing = arg; |
758 | return 0; | 759 | return 0; |
759 | } | 760 | } |
@@ -763,23 +764,35 @@ static void idedisk_add_settings(ide_drive_t *drive) | |||
763 | { | 764 | { |
764 | struct hd_driveid *id = drive->id; | 765 | struct hd_driveid *id = drive->id; |
765 | 766 | ||
766 | 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, |
767 | ide_add_setting(drive, "bios_head", SETTING_RW, TYPE_BYTE, 0, 255, 1, 1, &drive->bios_head, NULL); | 768 | &drive->bios_cyl, NULL); |
768 | 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, |
769 | ide_add_setting(drive, "address", SETTING_RW, TYPE_BYTE, 0, 2, 1, 1, &drive->addressing, set_lba_addressing); | 770 | &drive->bios_head, NULL); |
770 | 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, |
771 | ide_add_setting(drive, "nowerr", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->nowerr, set_nowerr); | 772 | &drive->bios_sect, NULL); |
772 | 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, |
773 | ide_add_setting(drive, "wcache", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->wcache, write_cache); | 774 | &drive->addressing, set_lba_addressing); |
774 | 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, |
775 | 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, |
776 | 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); | ||
777 | } | 790 | } |
778 | #else | 791 | #else |
779 | static inline void idedisk_add_settings(ide_drive_t *drive) { ; } | 792 | static inline void idedisk_add_settings(ide_drive_t *drive) { ; } |
780 | #endif | 793 | #endif |
781 | 794 | ||
782 | static void idedisk_setup (ide_drive_t *drive) | 795 | static void idedisk_setup(ide_drive_t *drive) |
783 | { | 796 | { |
784 | ide_hwif_t *hwif = drive->hwif; | 797 | ide_hwif_t *hwif = drive->hwif; |
785 | struct hd_driveid *id = drive->id; | 798 | struct hd_driveid *id = drive->id; |
@@ -792,11 +805,10 @@ static void idedisk_setup (ide_drive_t *drive) | |||
792 | 805 | ||
793 | if (drive->removable) { | 806 | if (drive->removable) { |
794 | /* | 807 | /* |
795 | * Removable disks (eg. SYQUEST); ignore 'WD' drives | 808 | * Removable disks (eg. SYQUEST); ignore 'WD' drives |
796 | */ | 809 | */ |
797 | if (id->model[0] != 'W' || id->model[1] != 'D') { | 810 | if (id->model[0] != 'W' || id->model[1] != 'D') |
798 | drive->doorlocking = 1; | 811 | drive->doorlocking = 1; |
799 | } | ||
800 | } | 812 | } |
801 | 813 | ||
802 | (void)set_lba_addressing(drive, 1); | 814 | (void)set_lba_addressing(drive, 1); |
@@ -810,10 +822,11 @@ static void idedisk_setup (ide_drive_t *drive) | |||
810 | blk_queue_max_sectors(drive->queue, max_s); | 822 | blk_queue_max_sectors(drive->queue, max_s); |
811 | } | 823 | } |
812 | 824 | ||
813 | 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); | ||
814 | 827 | ||
815 | /* calculate drive capacity, and select LBA if possible */ | 828 | /* calculate drive capacity, and select LBA if possible */ |
816 | init_idedisk_capacity (drive); | 829 | init_idedisk_capacity(drive); |
817 | 830 | ||
818 | /* limit drive capacity to 137GB if LBA48 cannot be used */ | 831 | /* limit drive capacity to 137GB if LBA48 cannot be used */ |
819 | if (drive->addressing == 0 && drive->capacity64 > 1ULL << 28) { | 832 | if (drive->addressing == 0 && drive->capacity64 > 1ULL << 28) { |
@@ -826,9 +839,9 @@ static void idedisk_setup (ide_drive_t *drive) | |||
826 | 839 | ||
827 | if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && drive->addressing) { | 840 | if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && drive->addressing) { |
828 | if (drive->capacity64 > 1ULL << 28) { | 841 | if (drive->capacity64 > 1ULL << 28) { |
829 | printk(KERN_INFO "%s: cannot use LBA48 DMA - PIO mode will" | 842 | printk(KERN_INFO "%s: cannot use LBA48 DMA - PIO mode" |
830 | " be used for accessing sectors > %u\n", | 843 | " will be used for accessing sectors " |
831 | drive->name, 1 << 28); | 844 | "> %u\n", drive->name, 1 << 28); |
832 | } else | 845 | } else |
833 | drive->addressing = 0; | 846 | drive->addressing = 0; |
834 | } | 847 | } |
@@ -837,7 +850,8 @@ static void idedisk_setup (ide_drive_t *drive) | |||
837 | * if possible, give fdisk access to more of the drive, | 850 | * if possible, give fdisk access to more of the drive, |
838 | * by correcting bios_cyls: | 851 | * by correcting bios_cyls: |
839 | */ | 852 | */ |
840 | capacity = idedisk_capacity (drive); | 853 | capacity = idedisk_capacity(drive); |
854 | |||
841 | if (!drive->forced_geom) { | 855 | if (!drive->forced_geom) { |
842 | 856 | ||
843 | if (idedisk_supports_lba48(drive->id)) { | 857 | if (idedisk_supports_lba48(drive->id)) { |
@@ -993,7 +1007,8 @@ static int idedisk_open(struct inode *inode, struct file *filp) | |||
993 | struct ide_disk_obj *idkp; | 1007 | struct ide_disk_obj *idkp; |
994 | ide_drive_t *drive; | 1008 | ide_drive_t *drive; |
995 | 1009 | ||
996 | if (!(idkp = ide_disk_get(disk))) | 1010 | idkp = ide_disk_get(disk); |
1011 | if (idkp == NULL) | ||
997 | return -ENXIO; | 1012 | return -ENXIO; |
998 | 1013 | ||
999 | drive = idkp->drive; | 1014 | drive = idkp->drive; |
@@ -1115,13 +1130,13 @@ static int idedisk_revalidate_disk(struct gendisk *disk) | |||
1115 | } | 1130 | } |
1116 | 1131 | ||
1117 | static struct block_device_operations idedisk_ops = { | 1132 | static struct block_device_operations idedisk_ops = { |
1118 | .owner = THIS_MODULE, | 1133 | .owner = THIS_MODULE, |
1119 | .open = idedisk_open, | 1134 | .open = idedisk_open, |
1120 | .release = idedisk_release, | 1135 | .release = idedisk_release, |
1121 | .ioctl = idedisk_ioctl, | 1136 | .ioctl = idedisk_ioctl, |
1122 | .getgeo = idedisk_getgeo, | 1137 | .getgeo = idedisk_getgeo, |
1123 | .media_changed = idedisk_media_changed, | 1138 | .media_changed = idedisk_media_changed, |
1124 | .revalidate_disk= idedisk_revalidate_disk | 1139 | .revalidate_disk = idedisk_revalidate_disk |
1125 | }; | 1140 | }; |
1126 | 1141 | ||
1127 | MODULE_DESCRIPTION("ATA DISK Driver"); | 1142 | MODULE_DESCRIPTION("ATA DISK Driver"); |
@@ -1184,7 +1199,7 @@ failed: | |||
1184 | return -ENODEV; | 1199 | return -ENODEV; |
1185 | } | 1200 | } |
1186 | 1201 | ||
1187 | static void __exit idedisk_exit (void) | 1202 | static void __exit idedisk_exit(void) |
1188 | { | 1203 | { |
1189 | driver_unregister(&idedisk_driver.gen_driver); | 1204 | driver_unregister(&idedisk_driver.gen_driver); |
1190 | } | 1205 | } |