aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-tape.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-tape.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-tape.c')
-rw-r--r--drivers/ide/ide-tape.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 622d5fed2dc5..2c235401aad1 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -267,11 +267,6 @@ static DEFINE_MUTEX(idetape_ref_mutex);
267 267
268static struct class *idetape_sysfs_class; 268static struct class *idetape_sysfs_class;
269 269
270#define to_ide_tape(obj) container_of(obj, struct ide_tape_obj, kref)
271
272#define ide_tape_g(disk) \
273 container_of((disk)->private_data, struct ide_tape_obj, driver)
274
275static void ide_tape_release(struct kref *); 270static void ide_tape_release(struct kref *);
276 271
277static struct ide_tape_obj *ide_tape_get(struct gendisk *disk) 272static struct ide_tape_obj *ide_tape_get(struct gendisk *disk)
@@ -279,7 +274,7 @@ static struct ide_tape_obj *ide_tape_get(struct gendisk *disk)
279 struct ide_tape_obj *tape = NULL; 274 struct ide_tape_obj *tape = NULL;
280 275
281 mutex_lock(&idetape_ref_mutex); 276 mutex_lock(&idetape_ref_mutex);
282 tape = ide_tape_g(disk); 277 tape = ide_drv_g(disk, ide_tape_obj);
283 if (tape) { 278 if (tape) {
284 if (ide_device_get(tape->drive)) 279 if (ide_device_get(tape->drive))
285 tape = NULL; 280 tape = NULL;
@@ -306,8 +301,6 @@ static void ide_tape_put(struct ide_tape_obj *tape)
306 */ 301 */
307static struct ide_tape_obj *idetape_devs[MAX_HWIFS * MAX_DRIVES]; 302static struct ide_tape_obj *idetape_devs[MAX_HWIFS * MAX_DRIVES];
308 303
309#define ide_tape_f(file) ((file)->private_data)
310
311static struct ide_tape_obj *ide_tape_chrdev_get(unsigned int i) 304static struct ide_tape_obj *ide_tape_chrdev_get(unsigned int i)
312{ 305{
313 struct ide_tape_obj *tape = NULL; 306 struct ide_tape_obj *tape = NULL;
@@ -1542,7 +1535,7 @@ static int idetape_space_over_filemarks(ide_drive_t *drive, short mt_op,
1542static ssize_t idetape_chrdev_read(struct file *file, char __user *buf, 1535static ssize_t idetape_chrdev_read(struct file *file, char __user *buf,
1543 size_t count, loff_t *ppos) 1536 size_t count, loff_t *ppos)
1544{ 1537{
1545 struct ide_tape_obj *tape = ide_tape_f(file); 1538 struct ide_tape_obj *tape = file->private_data;
1546 ide_drive_t *drive = tape->drive; 1539 ide_drive_t *drive = tape->drive;
1547 ssize_t bytes_read, temp, actually_read = 0, rc; 1540 ssize_t bytes_read, temp, actually_read = 0, rc;
1548 ssize_t ret = 0; 1541 ssize_t ret = 0;
@@ -1604,7 +1597,7 @@ finish:
1604static ssize_t idetape_chrdev_write(struct file *file, const char __user *buf, 1597static ssize_t idetape_chrdev_write(struct file *file, const char __user *buf,
1605 size_t count, loff_t *ppos) 1598 size_t count, loff_t *ppos)
1606{ 1599{
1607 struct ide_tape_obj *tape = ide_tape_f(file); 1600 struct ide_tape_obj *tape = file->private_data;
1608 ide_drive_t *drive = tape->drive; 1601 ide_drive_t *drive = tape->drive;
1609 ssize_t actually_written = 0; 1602 ssize_t actually_written = 0;
1610 ssize_t ret = 0; 1603 ssize_t ret = 0;
@@ -1836,7 +1829,7 @@ static int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count)
1836static int idetape_chrdev_ioctl(struct inode *inode, struct file *file, 1829static int idetape_chrdev_ioctl(struct inode *inode, struct file *file,
1837 unsigned int cmd, unsigned long arg) 1830 unsigned int cmd, unsigned long arg)
1838{ 1831{
1839 struct ide_tape_obj *tape = ide_tape_f(file); 1832 struct ide_tape_obj *tape = file->private_data;
1840 ide_drive_t *drive = tape->drive; 1833 ide_drive_t *drive = tape->drive;
1841 struct mtop mtop; 1834 struct mtop mtop;
1842 struct mtget mtget; 1835 struct mtget mtget;
@@ -2013,7 +2006,7 @@ static void idetape_write_release(ide_drive_t *drive, unsigned int minor)
2013 2006
2014static int idetape_chrdev_release(struct inode *inode, struct file *filp) 2007static int idetape_chrdev_release(struct inode *inode, struct file *filp)
2015{ 2008{
2016 struct ide_tape_obj *tape = ide_tape_f(filp); 2009 struct ide_tape_obj *tape = filp->private_data;
2017 ide_drive_t *drive = tape->drive; 2010 ide_drive_t *drive = tape->drive;
2018 unsigned int minor = iminor(inode); 2011 unsigned int minor = iminor(inode);
2019 2012
@@ -2272,7 +2265,7 @@ static void ide_tape_remove(ide_drive_t *drive)
2272 2265
2273static void ide_tape_release(struct kref *kref) 2266static void ide_tape_release(struct kref *kref)
2274{ 2267{
2275 struct ide_tape_obj *tape = to_ide_tape(kref); 2268 struct ide_tape_obj *tape = to_ide_drv(kref, ide_tape_obj);
2276 ide_drive_t *drive = tape->drive; 2269 ide_drive_t *drive = tape->drive;
2277 struct gendisk *g = tape->disk; 2270 struct gendisk *g = tape->disk;
2278 2271
@@ -2355,7 +2348,7 @@ static int idetape_open(struct inode *inode, struct file *filp)
2355static int idetape_release(struct inode *inode, struct file *filp) 2348static int idetape_release(struct inode *inode, struct file *filp)
2356{ 2349{
2357 struct gendisk *disk = inode->i_bdev->bd_disk; 2350 struct gendisk *disk = inode->i_bdev->bd_disk;
2358 struct ide_tape_obj *tape = ide_tape_g(disk); 2351 struct ide_tape_obj *tape = ide_drv_g(disk, ide_tape_obj);
2359 2352
2360 ide_tape_put(tape); 2353 ide_tape_put(tape);
2361 2354
@@ -2366,7 +2359,7 @@ static int idetape_ioctl(struct inode *inode, struct file *file,
2366 unsigned int cmd, unsigned long arg) 2359 unsigned int cmd, unsigned long arg)
2367{ 2360{
2368 struct block_device *bdev = inode->i_bdev; 2361 struct block_device *bdev = inode->i_bdev;
2369 struct ide_tape_obj *tape = ide_tape_g(bdev->bd_disk); 2362 struct ide_tape_obj *tape = ide_drv_g(bdev->bd_disk, ide_tape_obj);
2370 ide_drive_t *drive = tape->drive; 2363 ide_drive_t *drive = tape->drive;
2371 int err = generic_ide_ioctl(drive, file, bdev, cmd, arg); 2364 int err = generic_ide_ioctl(drive, file, bdev, cmd, arg);
2372 if (err == -EINVAL) 2365 if (err == -EINVAL)