aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-17 12:09:09 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-17 12:09:09 -0400
commitd7e747596829c1c11833ca0a1f5e64f400d20bf2 (patch)
tree3ca99d61a3e05399bea3969a588011e235ca5f7a /drivers/ide
parent9c3ba7692bc1166c6a5d06fb7c59984f9f988a00 (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>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-disk.c14
-rw-r--r--drivers/ide/ide-disk.h3
-rw-r--r--drivers/ide/ide-disk_ioctl.c2
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
50static DEFINE_MUTEX(idedisk_ref_mutex); 50static DEFINE_MUTEX(idedisk_ref_mutex);
51 51
52#define to_ide_disk(obj) container_of(obj, struct ide_disk_obj, kref)
53
54static void ide_disk_release(struct kref *); 52static void ide_disk_release(struct kref *);
55 53
56static struct ide_disk_obj *ide_disk_get(struct gendisk *disk) 54static 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
747static void ide_disk_release(struct kref *kref) 745static 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)
858static int idedisk_release(struct inode *inode, struct file *filp) 856static 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
880static int idedisk_getgeo(struct block_device *bdev, struct hd_geometry *geo) 878static 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
891static int idedisk_media_changed(struct gendisk *disk) 889static 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
906static int idedisk_revalidate_disk(struct gendisk *disk) 904static 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 */
16sector_t ide_disk_capacity(ide_drive_t *); 13sector_t ide_disk_capacity(ide_drive_t *);
17ide_decl_devset(address); 14ide_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