diff options
Diffstat (limited to 'drivers/ide/ide-disk.c')
-rw-r--r-- | drivers/ide/ide-disk.c | 48 |
1 files changed, 8 insertions, 40 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 6eb9fea32a56..995d448109eb 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -45,21 +45,12 @@ | |||
45 | #define IDE_DISK_MINORS 0 | 45 | #define IDE_DISK_MINORS 0 |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | struct ide_disk_obj { | 48 | #include "ide-disk.h" |
49 | ide_drive_t *drive; | ||
50 | ide_driver_t *driver; | ||
51 | struct gendisk *disk; | ||
52 | struct kref kref; | ||
53 | unsigned int openers; /* protected by BKL for now */ | ||
54 | }; | ||
55 | 49 | ||
56 | static DEFINE_MUTEX(idedisk_ref_mutex); | 50 | static DEFINE_MUTEX(idedisk_ref_mutex); |
57 | 51 | ||
58 | #define to_ide_disk(obj) container_of(obj, struct ide_disk_obj, kref) | 52 | #define to_ide_disk(obj) container_of(obj, struct ide_disk_obj, kref) |
59 | 53 | ||
60 | #define ide_disk_g(disk) \ | ||
61 | container_of((disk)->private_data, struct ide_disk_obj, driver) | ||
62 | |||
63 | static void ide_disk_release(struct kref *); | 54 | static void ide_disk_release(struct kref *); |
64 | 55 | ||
65 | static struct ide_disk_obj *ide_disk_get(struct gendisk *disk) | 56 | static struct ide_disk_obj *ide_disk_get(struct gendisk *disk) |
@@ -722,12 +713,12 @@ static int set_addressing(ide_drive_t *drive, int arg) | |||
722 | return 0; | 713 | return 0; |
723 | } | 714 | } |
724 | 715 | ||
725 | ide_devset_rw(acoustic, acoustic); | 716 | ide_ext_devset_rw(acoustic, acoustic); |
726 | ide_devset_rw(address, addressing); | 717 | ide_ext_devset_rw(address, addressing); |
727 | ide_devset_rw(multcount, multcount); | 718 | ide_ext_devset_rw(multcount, multcount); |
728 | ide_devset_rw(wcache, wcache); | 719 | ide_ext_devset_rw(wcache, wcache); |
729 | 720 | ||
730 | ide_devset_rw_sync(nowerr, nowerr); | 721 | ide_ext_devset_rw_sync(nowerr, nowerr); |
731 | 722 | ||
732 | #ifdef CONFIG_IDE_PROC_FS | 723 | #ifdef CONFIG_IDE_PROC_FS |
733 | ide_devset_rw_field(bios_cyl, bios_cyl); | 724 | ide_devset_rw_field(bios_cyl, bios_cyl); |
@@ -1025,30 +1016,6 @@ static int idedisk_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
1025 | return 0; | 1016 | return 0; |
1026 | } | 1017 | } |
1027 | 1018 | ||
1028 | static const struct ide_ioctl_devset ide_disk_ioctl_settings[] = { | ||
1029 | { HDIO_GET_ADDRESS, HDIO_SET_ADDRESS, &ide_devset_address }, | ||
1030 | { HDIO_GET_MULTCOUNT, HDIO_SET_MULTCOUNT, &ide_devset_multcount }, | ||
1031 | { HDIO_GET_NOWERR, HDIO_SET_NOWERR, &ide_devset_nowerr }, | ||
1032 | { HDIO_GET_WCACHE, HDIO_SET_WCACHE, &ide_devset_wcache }, | ||
1033 | { HDIO_GET_ACOUSTIC, HDIO_SET_ACOUSTIC, &ide_devset_acoustic }, | ||
1034 | { 0 } | ||
1035 | }; | ||
1036 | |||
1037 | static int idedisk_ioctl(struct inode *inode, struct file *file, | ||
1038 | unsigned int cmd, unsigned long arg) | ||
1039 | { | ||
1040 | struct block_device *bdev = inode->i_bdev; | ||
1041 | struct ide_disk_obj *idkp = ide_disk_g(bdev->bd_disk); | ||
1042 | ide_drive_t *drive = idkp->drive; | ||
1043 | int err; | ||
1044 | |||
1045 | err = ide_setting_ioctl(drive, bdev, cmd, arg, ide_disk_ioctl_settings); | ||
1046 | if (err != -EOPNOTSUPP) | ||
1047 | return err; | ||
1048 | |||
1049 | return generic_ide_ioctl(drive, file, bdev, cmd, arg); | ||
1050 | } | ||
1051 | |||
1052 | static int idedisk_media_changed(struct gendisk *disk) | 1019 | static int idedisk_media_changed(struct gendisk *disk) |
1053 | { | 1020 | { |
1054 | struct ide_disk_obj *idkp = ide_disk_g(disk); | 1021 | struct ide_disk_obj *idkp = ide_disk_g(disk); |
@@ -1075,7 +1042,7 @@ static struct block_device_operations idedisk_ops = { | |||
1075 | .owner = THIS_MODULE, | 1042 | .owner = THIS_MODULE, |
1076 | .open = idedisk_open, | 1043 | .open = idedisk_open, |
1077 | .release = idedisk_release, | 1044 | .release = idedisk_release, |
1078 | .ioctl = idedisk_ioctl, | 1045 | .ioctl = ide_disk_ioctl, |
1079 | .getgeo = idedisk_getgeo, | 1046 | .getgeo = idedisk_getgeo, |
1080 | .media_changed = idedisk_media_changed, | 1047 | .media_changed = idedisk_media_changed, |
1081 | .revalidate_disk = idedisk_revalidate_disk | 1048 | .revalidate_disk = idedisk_revalidate_disk |
@@ -1151,6 +1118,7 @@ static int __init idedisk_init(void) | |||
1151 | } | 1118 | } |
1152 | 1119 | ||
1153 | MODULE_ALIAS("ide:*m-disk*"); | 1120 | MODULE_ALIAS("ide:*m-disk*"); |
1121 | MODULE_ALIAS("ide-disk"); | ||
1154 | module_init(idedisk_init); | 1122 | module_init(idedisk_init); |
1155 | module_exit(idedisk_exit); | 1123 | module_exit(idedisk_exit); |
1156 | MODULE_LICENSE("GPL"); | 1124 | MODULE_LICENSE("GPL"); |