diff options
author | Borislav Petkov <petkovbb@googlemail.com> | 2008-10-13 15:39:34 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-13 15:39:34 -0400 |
commit | 5aeddf907f149cae7e19b7c23ccea3823d00698c (patch) | |
tree | c3507ed9a078f94bb091ed6557f570927b34f255 /drivers/ide/ide-floppy.c | |
parent | 91ddc9988efeaed487eb7dd81d2557e1b1d501ef (diff) |
ide: unify conversion macros
Introduce to_ide_drv() and ide_drv_g() macros and replace the respective
definitions of similar ones in each driver.
There should be no functionality change resulting from this patch.
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-floppy.c')
-rw-r--r-- | drivers/ide/ide-floppy.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 2a34f1ad2284..2a54a25090cb 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -84,11 +84,6 @@ | |||
84 | 84 | ||
85 | static DEFINE_MUTEX(idefloppy_ref_mutex); | 85 | static DEFINE_MUTEX(idefloppy_ref_mutex); |
86 | 86 | ||
87 | #define to_ide_floppy(obj) container_of(obj, struct ide_floppy_obj, kref) | ||
88 | |||
89 | #define ide_floppy_g(disk) \ | ||
90 | container_of((disk)->private_data, struct ide_floppy_obj, driver) | ||
91 | |||
92 | static void idefloppy_cleanup_obj(struct kref *); | 87 | static void idefloppy_cleanup_obj(struct kref *); |
93 | 88 | ||
94 | static struct ide_floppy_obj *ide_floppy_get(struct gendisk *disk) | 89 | static struct ide_floppy_obj *ide_floppy_get(struct gendisk *disk) |
@@ -96,7 +91,7 @@ static struct ide_floppy_obj *ide_floppy_get(struct gendisk *disk) | |||
96 | struct ide_floppy_obj *floppy = NULL; | 91 | struct ide_floppy_obj *floppy = NULL; |
97 | 92 | ||
98 | mutex_lock(&idefloppy_ref_mutex); | 93 | mutex_lock(&idefloppy_ref_mutex); |
99 | floppy = ide_floppy_g(disk); | 94 | floppy = ide_drv_g(disk, ide_floppy_obj); |
100 | if (floppy) { | 95 | if (floppy) { |
101 | if (ide_device_get(floppy->drive)) | 96 | if (ide_device_get(floppy->drive)) |
102 | floppy = NULL; | 97 | floppy = NULL; |
@@ -625,7 +620,7 @@ static void ide_floppy_remove(ide_drive_t *drive) | |||
625 | 620 | ||
626 | static void idefloppy_cleanup_obj(struct kref *kref) | 621 | static void idefloppy_cleanup_obj(struct kref *kref) |
627 | { | 622 | { |
628 | struct ide_floppy_obj *floppy = to_ide_floppy(kref); | 623 | struct ide_floppy_obj *floppy = to_ide_drv(kref, ide_floppy_obj); |
629 | ide_drive_t *drive = floppy->drive; | 624 | ide_drive_t *drive = floppy->drive; |
630 | struct gendisk *g = floppy->disk; | 625 | struct gendisk *g = floppy->disk; |
631 | 626 | ||
@@ -733,7 +728,7 @@ out_put_floppy: | |||
733 | static int idefloppy_release(struct inode *inode, struct file *filp) | 728 | static int idefloppy_release(struct inode *inode, struct file *filp) |
734 | { | 729 | { |
735 | struct gendisk *disk = inode->i_bdev->bd_disk; | 730 | struct gendisk *disk = inode->i_bdev->bd_disk; |
736 | struct ide_floppy_obj *floppy = ide_floppy_g(disk); | 731 | struct ide_floppy_obj *floppy = ide_drv_g(disk, ide_floppy_obj); |
737 | ide_drive_t *drive = floppy->drive; | 732 | ide_drive_t *drive = floppy->drive; |
738 | 733 | ||
739 | debug_log("Reached %s\n", __func__); | 734 | debug_log("Reached %s\n", __func__); |
@@ -752,7 +747,8 @@ static int idefloppy_release(struct inode *inode, struct file *filp) | |||
752 | 747 | ||
753 | static int idefloppy_getgeo(struct block_device *bdev, struct hd_geometry *geo) | 748 | static int idefloppy_getgeo(struct block_device *bdev, struct hd_geometry *geo) |
754 | { | 749 | { |
755 | struct ide_floppy_obj *floppy = ide_floppy_g(bdev->bd_disk); | 750 | struct ide_floppy_obj *floppy = ide_drv_g(bdev->bd_disk, |
751 | ide_floppy_obj); | ||
756 | ide_drive_t *drive = floppy->drive; | 752 | ide_drive_t *drive = floppy->drive; |
757 | 753 | ||
758 | geo->heads = drive->bios_head; | 754 | geo->heads = drive->bios_head; |
@@ -783,7 +779,8 @@ static int idefloppy_ioctl(struct inode *inode, struct file *file, | |||
783 | unsigned int cmd, unsigned long arg) | 779 | unsigned int cmd, unsigned long arg) |
784 | { | 780 | { |
785 | struct block_device *bdev = inode->i_bdev; | 781 | struct block_device *bdev = inode->i_bdev; |
786 | struct ide_floppy_obj *floppy = ide_floppy_g(bdev->bd_disk); | 782 | struct ide_floppy_obj *floppy = ide_drv_g(bdev->bd_disk, |
783 | ide_floppy_obj); | ||
787 | ide_drive_t *drive = floppy->drive; | 784 | ide_drive_t *drive = floppy->drive; |
788 | struct ide_atapi_pc pc; | 785 | struct ide_atapi_pc pc; |
789 | void __user *argp = (void __user *)arg; | 786 | void __user *argp = (void __user *)arg; |
@@ -812,7 +809,7 @@ static int idefloppy_ioctl(struct inode *inode, struct file *file, | |||
812 | 809 | ||
813 | static int idefloppy_media_changed(struct gendisk *disk) | 810 | static int idefloppy_media_changed(struct gendisk *disk) |
814 | { | 811 | { |
815 | struct ide_floppy_obj *floppy = ide_floppy_g(disk); | 812 | struct ide_floppy_obj *floppy = ide_drv_g(disk, ide_floppy_obj); |
816 | ide_drive_t *drive = floppy->drive; | 813 | ide_drive_t *drive = floppy->drive; |
817 | int ret; | 814 | int ret; |
818 | 815 | ||
@@ -828,7 +825,7 @@ static int idefloppy_media_changed(struct gendisk *disk) | |||
828 | 825 | ||
829 | static int idefloppy_revalidate_disk(struct gendisk *disk) | 826 | static int idefloppy_revalidate_disk(struct gendisk *disk) |
830 | { | 827 | { |
831 | struct ide_floppy_obj *floppy = ide_floppy_g(disk); | 828 | struct ide_floppy_obj *floppy = ide_drv_g(disk, ide_floppy_obj); |
832 | set_capacity(disk, idefloppy_capacity(floppy->drive)); | 829 | set_capacity(disk, idefloppy_capacity(floppy->drive)); |
833 | return 0; | 830 | return 0; |
834 | } | 831 | } |