From d7e747596829c1c11833ca0a1f5e64f400d20bf2 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 17 Oct 2008 18:09:09 +0200 Subject: [PATCH] ide-disk: use to_ide_drv() and ide_drv_g() There should be no functional changes caused by this patch. Cc: Borislav Petkov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-disk.c | 14 ++++++-------- drivers/ide/ide-disk.h | 3 --- 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 2c48bd81f53..6c9c898aff6 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -49,8 +49,6 @@ static DEFINE_MUTEX(idedisk_ref_mutex); -#define to_ide_disk(obj) container_of(obj, struct ide_disk_obj, kref) - static void ide_disk_release(struct kref *); 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) struct ide_disk_obj *idkp = NULL; mutex_lock(&idedisk_ref_mutex); - idkp = ide_disk_g(disk); + idkp = ide_drv_g(disk, ide_disk_obj); if (idkp) { if (ide_device_get(idkp->drive)) idkp = NULL; @@ -746,7 +744,7 @@ static void ide_disk_remove(ide_drive_t *drive) static void ide_disk_release(struct kref *kref) { - struct ide_disk_obj *idkp = to_ide_disk(kref); + struct ide_disk_obj *idkp = to_ide_drv(kref, ide_disk_obj); ide_drive_t *drive = idkp->drive; struct gendisk *g = idkp->disk; @@ -858,7 +856,7 @@ static int idedisk_open(struct inode *inode, struct file *filp) static int idedisk_release(struct inode *inode, struct file *filp) { struct gendisk *disk = inode->i_bdev->bd_disk; - struct ide_disk_obj *idkp = ide_disk_g(disk); + struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); ide_drive_t *drive = idkp->drive; if (idkp->openers == 1) @@ -879,7 +877,7 @@ static int idedisk_release(struct inode *inode, struct file *filp) static int idedisk_getgeo(struct block_device *bdev, struct hd_geometry *geo) { - struct ide_disk_obj *idkp = ide_disk_g(bdev->bd_disk); + struct ide_disk_obj *idkp = ide_drv_g(bdev->bd_disk, ide_disk_obj); ide_drive_t *drive = idkp->drive; geo->heads = drive->bios_head; @@ -890,7 +888,7 @@ static int idedisk_getgeo(struct block_device *bdev, struct hd_geometry *geo) static int idedisk_media_changed(struct gendisk *disk) { - struct ide_disk_obj *idkp = ide_disk_g(disk); + struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); ide_drive_t *drive = idkp->drive; /* do not scan partitions twice if this is a removable device */ @@ -905,7 +903,7 @@ static int idedisk_media_changed(struct gendisk *disk) static int idedisk_revalidate_disk(struct gendisk *disk) { - struct ide_disk_obj *idkp = ide_disk_g(disk); + struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); set_capacity(disk, ide_disk_capacity(idkp->drive)); return 0; } diff --git a/drivers/ide/ide-disk.h b/drivers/ide/ide-disk.h index a82fa435566..50d674b91c8 100644 --- a/drivers/ide/ide-disk.h +++ b/drivers/ide/ide-disk.h @@ -9,9 +9,6 @@ struct ide_disk_obj { unsigned int openers; /* protected by BKL for now */ }; -#define ide_disk_g(disk) \ - container_of((disk)->private_data, struct ide_disk_obj, driver) - /* ide-disk.c */ sector_t ide_disk_capacity(ide_drive_t *); ide_decl_devset(address); diff --git a/drivers/ide/ide-disk_ioctl.c b/drivers/ide/ide-disk_ioctl.c index a6cf1a03a80..e6624eda9e6 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, unsigned int cmd, unsigned long arg) { struct block_device *bdev = inode->i_bdev; - struct ide_disk_obj *idkp = ide_disk_g(bdev->bd_disk); + struct ide_disk_obj *idkp = ide_drv_g(bdev->bd_disk, ide_disk_obj); ide_drive_t *drive = idkp->drive; int err; -- 2.41.1