aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-cd.c
diff options
context:
space:
mode:
authorBorislav Petkov <petkovbb@googlemail.com>2008-10-13 15:39:34 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-13 15:39:34 -0400
commit5aeddf907f149cae7e19b7c23ccea3823d00698c (patch)
treec3507ed9a078f94bb091ed6557f570927b34f255 /drivers/ide/ide-cd.c
parent91ddc9988efeaed487eb7dd81d2557e1b1d501ef (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-cd.c')
-rw-r--r--drivers/ide/ide-cd.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 465a92ca0179..8650ad43b324 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -52,11 +52,6 @@
52 52
53static DEFINE_MUTEX(idecd_ref_mutex); 53static DEFINE_MUTEX(idecd_ref_mutex);
54 54
55#define to_ide_cd(obj) container_of(obj, struct cdrom_info, kref)
56
57#define ide_cd_g(disk) \
58 container_of((disk)->private_data, struct cdrom_info, driver)
59
60static void ide_cd_release(struct kref *); 55static void ide_cd_release(struct kref *);
61 56
62static struct cdrom_info *ide_cd_get(struct gendisk *disk) 57static struct cdrom_info *ide_cd_get(struct gendisk *disk)
@@ -64,7 +59,7 @@ static struct cdrom_info *ide_cd_get(struct gendisk *disk)
64 struct cdrom_info *cd = NULL; 59 struct cdrom_info *cd = NULL;
65 60
66 mutex_lock(&idecd_ref_mutex); 61 mutex_lock(&idecd_ref_mutex);
67 cd = ide_cd_g(disk); 62 cd = ide_drv_g(disk, cdrom_info);
68 if (cd) { 63 if (cd) {
69 if (ide_device_get(cd->drive)) 64 if (ide_device_get(cd->drive))
70 cd = NULL; 65 cd = NULL;
@@ -1941,7 +1936,7 @@ static void ide_cd_remove(ide_drive_t *drive)
1941 1936
1942static void ide_cd_release(struct kref *kref) 1937static void ide_cd_release(struct kref *kref)
1943{ 1938{
1944 struct cdrom_info *info = to_ide_cd(kref); 1939 struct cdrom_info *info = to_ide_drv(kref, cdrom_info);
1945 struct cdrom_device_info *devinfo = &info->devinfo; 1940 struct cdrom_device_info *devinfo = &info->devinfo;
1946 ide_drive_t *drive = info->drive; 1941 ide_drive_t *drive = info->drive;
1947 struct gendisk *g = info->disk; 1942 struct gendisk *g = info->disk;
@@ -1999,7 +1994,7 @@ static int idecd_open(struct inode *inode, struct file *file)
1999static int idecd_release(struct inode *inode, struct file *file) 1994static int idecd_release(struct inode *inode, struct file *file)
2000{ 1995{
2001 struct gendisk *disk = inode->i_bdev->bd_disk; 1996 struct gendisk *disk = inode->i_bdev->bd_disk;
2002 struct cdrom_info *info = ide_cd_g(disk); 1997 struct cdrom_info *info = ide_drv_g(disk, cdrom_info);
2003 1998
2004 cdrom_release(&info->devinfo, file); 1999 cdrom_release(&info->devinfo, file);
2005 2000
@@ -2051,7 +2046,7 @@ static int idecd_ioctl(struct inode *inode, struct file *file,
2051 unsigned int cmd, unsigned long arg) 2046 unsigned int cmd, unsigned long arg)
2052{ 2047{
2053 struct block_device *bdev = inode->i_bdev; 2048 struct block_device *bdev = inode->i_bdev;
2054 struct cdrom_info *info = ide_cd_g(bdev->bd_disk); 2049 struct cdrom_info *info = ide_drv_g(bdev->bd_disk, cdrom_info);
2055 int err; 2050 int err;
2056 2051
2057 switch (cmd) { 2052 switch (cmd) {
@@ -2072,13 +2067,13 @@ static int idecd_ioctl(struct inode *inode, struct file *file,
2072 2067
2073static int idecd_media_changed(struct gendisk *disk) 2068static int idecd_media_changed(struct gendisk *disk)
2074{ 2069{
2075 struct cdrom_info *info = ide_cd_g(disk); 2070 struct cdrom_info *info = ide_drv_g(disk, cdrom_info);
2076 return cdrom_media_changed(&info->devinfo); 2071 return cdrom_media_changed(&info->devinfo);
2077} 2072}
2078 2073
2079static int idecd_revalidate_disk(struct gendisk *disk) 2074static int idecd_revalidate_disk(struct gendisk *disk)
2080{ 2075{
2081 struct cdrom_info *info = ide_cd_g(disk); 2076 struct cdrom_info *info = ide_drv_g(disk, cdrom_info);
2082 struct request_sense sense; 2077 struct request_sense sense;
2083 2078
2084 ide_cd_read_toc(info->drive, &sense); 2079 ide_cd_read_toc(info->drive, &sense);