Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8fd138c3 authored by Martin Schwidefsky's avatar Martin Schwidefsky Committed by Martin Schwidefsky
Browse files

[S390] tape: cleanup reference counting



Rename tape_get_device to tape_find_device and tape_get_device_reference
to tape_get_device. The old names didn't make too much sense.

Follow the get_device()/put_device() semantic and convert tape_put_device
to a void function.

Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 1b52fff0
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -292,9 +292,9 @@ extern int tape_generic_pm_suspend(struct ccw_device *);
extern int tape_generic_probe(struct ccw_device *);
extern void tape_generic_remove(struct ccw_device *);

extern struct tape_device *tape_get_device(int devindex);
extern struct tape_device *tape_get_device_reference(struct tape_device *);
extern struct tape_device *tape_put_device(struct tape_device *);
extern struct tape_device *tape_find_device(int devindex);
extern struct tape_device *tape_get_device(struct tape_device *);
extern void tape_put_device(struct tape_device *);

/* Externals from tape_char.c */
extern int tapechar_init(void);
+4 −4
Original line number Diff line number Diff line
@@ -113,16 +113,16 @@ tape_34xx_work_handler(struct work_struct *work)
{
	struct tape_34xx_work *p =
		container_of(work, struct tape_34xx_work, work);
	struct tape_device *device = p->device;

	switch(p->op) {
		case TO_MSEN:
			tape_34xx_medium_sense(p->device);
			tape_34xx_medium_sense(device);
			break;
		default:
			DBF_EVENT(3, "T34XX: internal error: unknown work\n");
	}

	p->device = tape_put_device(p->device);
	tape_put_device(device);
	kfree(p);
}

@@ -136,7 +136,7 @@ tape_34xx_schedule_work(struct tape_device *device, enum tape_op op)

	INIT_WORK(&p->work, tape_34xx_work_handler);

	p->device = tape_get_device_reference(device);
	p->device = tape_get_device(device);
	p->op     = op;

	schedule_work(&p->work);
+1 −1
Original line number Diff line number Diff line
@@ -608,7 +608,7 @@ tape_3590_schedule_work(struct tape_device *device, enum tape_op op)

	INIT_WORK(&p->work, tape_3590_work_handler);

	p->device = tape_get_device_reference(device);
	p->device = tape_get_device(device);
	p->op = op;

	schedule_work(&p->work);
+8 −7
Original line number Diff line number Diff line
@@ -239,7 +239,7 @@ tapeblock_setup_device(struct tape_device * device)
	disk->major = tapeblock_major;
	disk->first_minor = device->first_minor;
	disk->fops = &tapeblock_fops;
	disk->private_data = tape_get_device_reference(device);
	disk->private_data = tape_get_device(device);
	disk->queue = blkdat->request_queue;
	set_capacity(disk, 0);
	sprintf(disk->disk_name, "btibm%d",
@@ -247,11 +247,11 @@ tapeblock_setup_device(struct tape_device * device)

	blkdat->disk = disk;
	blkdat->medium_changed = 1;
	blkdat->request_queue->queuedata = tape_get_device_reference(device);
	blkdat->request_queue->queuedata = tape_get_device(device);

	add_disk(disk);

	tape_get_device_reference(device);
	tape_get_device(device);
	INIT_WORK(&blkdat->requeue_task, tapeblock_requeue);

	return 0;
@@ -274,13 +274,14 @@ tapeblock_cleanup_device(struct tape_device *device)
	}

	del_gendisk(device->blk_data.disk);
	device->blk_data.disk->private_data =
		tape_put_device(device->blk_data.disk->private_data);
	device->blk_data.disk->private_data = NULL;
	tape_put_device(device);
	put_disk(device->blk_data.disk);

	device->blk_data.disk = NULL;
cleanup_queue:
	device->blk_data.request_queue->queuedata = tape_put_device(device);
	device->blk_data.request_queue->queuedata = NULL;
	tape_put_device(device);

	blk_cleanup_queue(device->blk_data.request_queue);
	device->blk_data.request_queue = NULL;
@@ -363,7 +364,7 @@ tapeblock_open(struct block_device *bdev, fmode_t mode)
	struct tape_device *	device;
	int			rc;

	device = tape_get_device_reference(disk->private_data);
	device = tape_get_device(disk->private_data);

	if (device->required_tapemarks) {
		DBF_EVENT(2, "TBLOCK: missing tapemarks\n");
+4 −3
Original line number Diff line number Diff line
@@ -286,9 +286,9 @@ tapechar_open (struct inode *inode, struct file *filp)

	lock_kernel();
	minor = iminor(filp->f_path.dentry->d_inode);
	device = tape_get_device(minor / TAPE_MINORS_PER_DEV);
	device = tape_find_device(minor / TAPE_MINORS_PER_DEV);
	if (IS_ERR(device)) {
		DBF_EVENT(3, "TCHAR:open: tape_get_device() failed\n");
		DBF_EVENT(3, "TCHAR:open: tape_find_device() failed\n");
		rc = PTR_ERR(device);
		goto out;
	}
@@ -340,7 +340,8 @@ tapechar_release(struct inode *inode, struct file *filp)
		device->char_data.idal_buf = NULL;
	}
	tape_release(device);
	filp->private_data = tape_put_device(device);
	filp->private_data = NULL;
	tape_put_device(device);

	return 0;
}
Loading