diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-17 12:09:09 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-17 12:09:09 -0400 |
commit | d7e747596829c1c11833ca0a1f5e64f400d20bf2 (patch) | |
tree | 3ca99d61a3e05399bea3969a588011e235ca5f7a | |
parent | 9c3ba7692bc1166c6a5d06fb7c59984f9f988a00 (diff) |
ide-disk: use to_ide_drv() and ide_drv_g()
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r-- | drivers/ide/ide-disk.c | 14 | ||||
-rw-r--r-- | drivers/ide/ide-disk.h | 3 | ||||
-rw-r--r-- | drivers/ide/ide-disk_ioctl.c | 2 |
3 files changed, 7 insertions, 12 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 2c48bd81f537..6c9c898aff62 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -49,8 +49,6 @@ | |||
49 | 49 | ||
50 | static DEFINE_MUTEX(idedisk_ref_mutex); | 50 | static DEFINE_MUTEX(idedisk_ref_mutex); |
51 | 51 | ||
52 | #define to_ide_disk(obj) container_of(obj, struct ide_disk_obj, kref) | ||
53 | |||
54 | static void ide_disk_release(struct kref *); | 52 | static void ide_disk_release(struct kref *); |
55 | 53 | ||
56 | static struct ide_disk_obj *ide_disk_get(struct gendisk *disk) | 54 | static struct ide_disk_obj *ide_disk_get(struct gendisk *disk) |
@@ -58,7 +56,7 @@ static struct ide_disk_obj *ide_disk_get(struct gendisk *disk) | |||
58 | struct ide_disk_obj *idkp = NULL; | 56 | struct ide_disk_obj *idkp = NULL; |
59 | 57 | ||
60 | mutex_lock(&idedisk_ref_mutex); | 58 | mutex_lock(&idedisk_ref_mutex); |
61 | idkp = ide_disk_g(disk); | 59 | idkp = ide_drv_g(disk, ide_disk_obj); |
62 | if (idkp) { | 60 | if (idkp) { |
63 | if (ide_device_get(idkp->drive)) | 61 | if (ide_device_get(idkp->drive)) |
64 | idkp = NULL; | 62 | idkp = NULL; |
@@ -746,7 +744,7 @@ static void ide_disk_remove(ide_drive_t *drive) | |||
746 | 744 | ||
747 | static void ide_disk_release(struct kref *kref) | 745 | static void ide_disk_release(struct kref *kref) |
748 | { | 746 | { |
749 | struct ide_disk_obj *idkp = to_ide_disk(kref); | 747 | struct ide_disk_obj *idkp = to_ide_drv(kref, ide_disk_obj); |
750 | ide_drive_t *drive = idkp->drive; | 748 | ide_drive_t *drive = idkp->drive; |
751 | struct gendisk *g = idkp->disk; | 749 | struct gendisk *g = idkp->disk; |
752 | 750 | ||
@@ -858,7 +856,7 @@ static int idedisk_open(struct inode *inode, struct file *filp) | |||
858 | static int idedisk_release(struct inode *inode, struct file *filp) | 856 | static int idedisk_release(struct inode *inode, struct file *filp) |
859 | { | 857 | { |
860 | struct gendisk *disk = inode->i_bdev->bd_disk; | 858 | struct gendisk *disk = inode->i_bdev->bd_disk; |
861 | struct ide_disk_obj *idkp = ide_disk_g(disk); | 859 | struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); |
862 | ide_drive_t *drive = idkp->drive; | 860 | ide_drive_t *drive = idkp->drive; |
863 | 861 | ||
864 | if (idkp->openers == 1) | 862 | if (idkp->openers == 1) |
@@ -879,7 +877,7 @@ static int idedisk_release(struct inode *inode, struct file *filp) | |||
879 | 877 | ||
880 | static int idedisk_getgeo(struct block_device *bdev, struct hd_geometry *geo) | 878 | static int idedisk_getgeo(struct block_device *bdev, struct hd_geometry *geo) |
881 | { | 879 | { |
882 | struct ide_disk_obj *idkp = ide_disk_g(bdev->bd_disk); | 880 | struct ide_disk_obj *idkp = ide_drv_g(bdev->bd_disk, ide_disk_obj); |
883 | ide_drive_t *drive = idkp->drive; | 881 | ide_drive_t *drive = idkp->drive; |
884 | 882 | ||
885 | geo->heads = drive->bios_head; | 883 | geo->heads = drive->bios_head; |
@@ -890,7 +888,7 @@ static int idedisk_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
890 | 888 | ||
891 | static int idedisk_media_changed(struct gendisk *disk) | 889 | static int idedisk_media_changed(struct gendisk *disk) |
892 | { | 890 | { |
893 | struct ide_disk_obj *idkp = ide_disk_g(disk); | 891 | struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); |
894 | ide_drive_t *drive = idkp->drive; | 892 | ide_drive_t *drive = idkp->drive; |
895 | 893 | ||
896 | /* do not scan partitions twice if this is a removable device */ | 894 | /* do not scan partitions twice if this is a removable device */ |
@@ -905,7 +903,7 @@ static int idedisk_media_changed(struct gendisk *disk) | |||
905 | 903 | ||
906 | static int idedisk_revalidate_disk(struct gendisk *disk) | 904 | static int idedisk_revalidate_disk(struct gendisk *disk) |
907 | { | 905 | { |
908 | struct ide_disk_obj *idkp = ide_disk_g(disk); | 906 | struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); |
909 | set_capacity(disk, ide_disk_capacity(idkp->drive)); | 907 | set_capacity(disk, ide_disk_capacity(idkp->drive)); |
910 | return 0; | 908 | return 0; |
911 | } | 909 | } |
diff --git a/drivers/ide/ide-disk.h b/drivers/ide/ide-disk.h index a82fa4355665..50d674b91c8b 100644 --- a/drivers/ide/ide-disk.h +++ b/drivers/ide/ide-disk.h | |||
@@ -9,9 +9,6 @@ struct ide_disk_obj { | |||
9 | unsigned int openers; /* protected by BKL for now */ | 9 | unsigned int openers; /* protected by BKL for now */ |
10 | }; | 10 | }; |
11 | 11 | ||
12 | #define ide_disk_g(disk) \ | ||
13 | container_of((disk)->private_data, struct ide_disk_obj, driver) | ||
14 | |||
15 | /* ide-disk.c */ | 12 | /* ide-disk.c */ |
16 | sector_t ide_disk_capacity(ide_drive_t *); | 13 | sector_t ide_disk_capacity(ide_drive_t *); |
17 | ide_decl_devset(address); | 14 | ide_decl_devset(address); |
diff --git a/drivers/ide/ide-disk_ioctl.c b/drivers/ide/ide-disk_ioctl.c index a6cf1a03a806..e6624eda9e69 100644 --- a/drivers/ide/ide-disk_ioctl.c +++ b/drivers/ide/ide-disk_ioctl.c | |||
@@ -17,7 +17,7 @@ int ide_disk_ioctl(struct inode *inode, struct file *file, | |||
17 | unsigned int cmd, unsigned long arg) | 17 | unsigned int cmd, unsigned long arg) |
18 | { | 18 | { |
19 | struct block_device *bdev = inode->i_bdev; | 19 | struct block_device *bdev = inode->i_bdev; |
20 | struct ide_disk_obj *idkp = ide_disk_g(bdev->bd_disk); | 20 | struct ide_disk_obj *idkp = ide_drv_g(bdev->bd_disk, ide_disk_obj); |
21 | ide_drive_t *drive = idkp->drive; | 21 | ide_drive_t *drive = idkp->drive; |
22 | int err; | 22 | int err; |
23 | 23 | ||