aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-disk.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-13 15:39:45 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-13 15:39:45 -0400
commitf87904898e91923a91b925078ac933f05076c7fd (patch)
treebd4488b5510f8b67d4b2f92bd1d8616472076eee /drivers/ide/ide-disk.c
parentb9103da463f72d03c513acdb18f1aebd7931ed1e (diff)
ide-disk: move all ioctl handling to ide-disk_ioctl.c
While at it: - idedisk_ioctl() -> ide_disk_ioctl() Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-disk.c')
-rw-r--r--drivers/ide/ide-disk.c48
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
48struct 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
56static DEFINE_MUTEX(idedisk_ref_mutex); 50static 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
63static void ide_disk_release(struct kref *); 54static void ide_disk_release(struct kref *);
64 55
65static struct ide_disk_obj *ide_disk_get(struct gendisk *disk) 56static 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
725ide_devset_rw(acoustic, acoustic); 716ide_ext_devset_rw(acoustic, acoustic);
726ide_devset_rw(address, addressing); 717ide_ext_devset_rw(address, addressing);
727ide_devset_rw(multcount, multcount); 718ide_ext_devset_rw(multcount, multcount);
728ide_devset_rw(wcache, wcache); 719ide_ext_devset_rw(wcache, wcache);
729 720
730ide_devset_rw_sync(nowerr, nowerr); 721ide_ext_devset_rw_sync(nowerr, nowerr);
731 722
732#ifdef CONFIG_IDE_PROC_FS 723#ifdef CONFIG_IDE_PROC_FS
733ide_devset_rw_field(bios_cyl, bios_cyl); 724ide_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
1028static 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
1037static 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
1052static int idedisk_media_changed(struct gendisk *disk) 1019static 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
1153MODULE_ALIAS("ide:*m-disk*"); 1120MODULE_ALIAS("ide:*m-disk*");
1121MODULE_ALIAS("ide-disk");
1154module_init(idedisk_init); 1122module_init(idedisk_init);
1155module_exit(idedisk_exit); 1123module_exit(idedisk_exit);
1156MODULE_LICENSE("GPL"); 1124MODULE_LICENSE("GPL");