diff options
Diffstat (limited to 'drivers/s390/char/tape_block.c')
-rw-r--r-- | drivers/s390/char/tape_block.c | 60 |
1 files changed, 11 insertions, 49 deletions
diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c index 0c0705b91c28..097da8ce6be6 100644 --- a/drivers/s390/char/tape_block.c +++ b/drivers/s390/char/tape_block.c | |||
@@ -11,6 +11,7 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #define KMSG_COMPONENT "tape" | 13 | #define KMSG_COMPONENT "tape" |
14 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt | ||
14 | 15 | ||
15 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
16 | #include <linux/module.h> | 17 | #include <linux/module.h> |
@@ -45,8 +46,6 @@ | |||
45 | */ | 46 | */ |
46 | static int tapeblock_open(struct block_device *, fmode_t); | 47 | static int tapeblock_open(struct block_device *, fmode_t); |
47 | static int tapeblock_release(struct gendisk *, fmode_t); | 48 | static int tapeblock_release(struct gendisk *, fmode_t); |
48 | static int tapeblock_ioctl(struct block_device *, fmode_t, unsigned int, | ||
49 | unsigned long); | ||
50 | static int tapeblock_medium_changed(struct gendisk *); | 49 | static int tapeblock_medium_changed(struct gendisk *); |
51 | static int tapeblock_revalidate_disk(struct gendisk *); | 50 | static int tapeblock_revalidate_disk(struct gendisk *); |
52 | 51 | ||
@@ -54,7 +53,6 @@ static const struct block_device_operations tapeblock_fops = { | |||
54 | .owner = THIS_MODULE, | 53 | .owner = THIS_MODULE, |
55 | .open = tapeblock_open, | 54 | .open = tapeblock_open, |
56 | .release = tapeblock_release, | 55 | .release = tapeblock_release, |
57 | .locked_ioctl = tapeblock_ioctl, | ||
58 | .media_changed = tapeblock_medium_changed, | 56 | .media_changed = tapeblock_medium_changed, |
59 | .revalidate_disk = tapeblock_revalidate_disk, | 57 | .revalidate_disk = tapeblock_revalidate_disk, |
60 | }; | 58 | }; |
@@ -224,9 +222,8 @@ tapeblock_setup_device(struct tape_device * device) | |||
224 | goto cleanup_queue; | 222 | goto cleanup_queue; |
225 | 223 | ||
226 | blk_queue_logical_block_size(blkdat->request_queue, TAPEBLOCK_HSEC_SIZE); | 224 | blk_queue_logical_block_size(blkdat->request_queue, TAPEBLOCK_HSEC_SIZE); |
227 | blk_queue_max_sectors(blkdat->request_queue, TAPEBLOCK_MAX_SEC); | 225 | blk_queue_max_hw_sectors(blkdat->request_queue, TAPEBLOCK_MAX_SEC); |
228 | blk_queue_max_phys_segments(blkdat->request_queue, -1L); | 226 | blk_queue_max_segments(blkdat->request_queue, -1L); |
229 | blk_queue_max_hw_segments(blkdat->request_queue, -1L); | ||
230 | blk_queue_max_segment_size(blkdat->request_queue, -1L); | 227 | blk_queue_max_segment_size(blkdat->request_queue, -1L); |
231 | blk_queue_segment_boundary(blkdat->request_queue, -1L); | 228 | blk_queue_segment_boundary(blkdat->request_queue, -1L); |
232 | 229 | ||
@@ -239,7 +236,7 @@ tapeblock_setup_device(struct tape_device * device) | |||
239 | disk->major = tapeblock_major; | 236 | disk->major = tapeblock_major; |
240 | disk->first_minor = device->first_minor; | 237 | disk->first_minor = device->first_minor; |
241 | disk->fops = &tapeblock_fops; | 238 | disk->fops = &tapeblock_fops; |
242 | disk->private_data = tape_get_device_reference(device); | 239 | disk->private_data = tape_get_device(device); |
243 | disk->queue = blkdat->request_queue; | 240 | disk->queue = blkdat->request_queue; |
244 | set_capacity(disk, 0); | 241 | set_capacity(disk, 0); |
245 | sprintf(disk->disk_name, "btibm%d", | 242 | sprintf(disk->disk_name, "btibm%d", |
@@ -247,11 +244,11 @@ tapeblock_setup_device(struct tape_device * device) | |||
247 | 244 | ||
248 | blkdat->disk = disk; | 245 | blkdat->disk = disk; |
249 | blkdat->medium_changed = 1; | 246 | blkdat->medium_changed = 1; |
250 | blkdat->request_queue->queuedata = tape_get_device_reference(device); | 247 | blkdat->request_queue->queuedata = tape_get_device(device); |
251 | 248 | ||
252 | add_disk(disk); | 249 | add_disk(disk); |
253 | 250 | ||
254 | tape_get_device_reference(device); | 251 | tape_get_device(device); |
255 | INIT_WORK(&blkdat->requeue_task, tapeblock_requeue); | 252 | INIT_WORK(&blkdat->requeue_task, tapeblock_requeue); |
256 | 253 | ||
257 | return 0; | 254 | return 0; |
@@ -274,13 +271,14 @@ tapeblock_cleanup_device(struct tape_device *device) | |||
274 | } | 271 | } |
275 | 272 | ||
276 | del_gendisk(device->blk_data.disk); | 273 | del_gendisk(device->blk_data.disk); |
277 | device->blk_data.disk->private_data = | 274 | device->blk_data.disk->private_data = NULL; |
278 | tape_put_device(device->blk_data.disk->private_data); | 275 | tape_put_device(device); |
279 | put_disk(device->blk_data.disk); | 276 | put_disk(device->blk_data.disk); |
280 | 277 | ||
281 | device->blk_data.disk = NULL; | 278 | device->blk_data.disk = NULL; |
282 | cleanup_queue: | 279 | cleanup_queue: |
283 | device->blk_data.request_queue->queuedata = tape_put_device(device); | 280 | device->blk_data.request_queue->queuedata = NULL; |
281 | tape_put_device(device); | ||
284 | 282 | ||
285 | blk_cleanup_queue(device->blk_data.request_queue); | 283 | blk_cleanup_queue(device->blk_data.request_queue); |
286 | device->blk_data.request_queue = NULL; | 284 | device->blk_data.request_queue = NULL; |
@@ -363,7 +361,7 @@ tapeblock_open(struct block_device *bdev, fmode_t mode) | |||
363 | struct tape_device * device; | 361 | struct tape_device * device; |
364 | int rc; | 362 | int rc; |
365 | 363 | ||
366 | device = tape_get_device_reference(disk->private_data); | 364 | device = tape_get_device(disk->private_data); |
367 | 365 | ||
368 | if (device->required_tapemarks) { | 366 | if (device->required_tapemarks) { |
369 | DBF_EVENT(2, "TBLOCK: missing tapemarks\n"); | 367 | DBF_EVENT(2, "TBLOCK: missing tapemarks\n"); |
@@ -414,42 +412,6 @@ tapeblock_release(struct gendisk *disk, fmode_t mode) | |||
414 | } | 412 | } |
415 | 413 | ||
416 | /* | 414 | /* |
417 | * Support of some generic block device IOCTLs. | ||
418 | */ | ||
419 | static int | ||
420 | tapeblock_ioctl( | ||
421 | struct block_device * bdev, | ||
422 | fmode_t mode, | ||
423 | unsigned int command, | ||
424 | unsigned long arg | ||
425 | ) { | ||
426 | int rc; | ||
427 | int minor; | ||
428 | struct gendisk *disk = bdev->bd_disk; | ||
429 | struct tape_device *device; | ||
430 | |||
431 | rc = 0; | ||
432 | BUG_ON(!disk); | ||
433 | device = disk->private_data; | ||
434 | BUG_ON(!device); | ||
435 | minor = MINOR(bdev->bd_dev); | ||
436 | |||
437 | DBF_LH(6, "tapeblock_ioctl(0x%0x)\n", command); | ||
438 | DBF_LH(6, "device = %d:%d\n", tapeblock_major, minor); | ||
439 | |||
440 | switch (command) { | ||
441 | /* Refuse some IOCTL calls without complaining (mount). */ | ||
442 | case 0x5310: /* CDROMMULTISESSION */ | ||
443 | rc = -EINVAL; | ||
444 | break; | ||
445 | default: | ||
446 | rc = -EINVAL; | ||
447 | } | ||
448 | |||
449 | return rc; | ||
450 | } | ||
451 | |||
452 | /* | ||
453 | * Initialize block device frontend. | 415 | * Initialize block device frontend. |
454 | */ | 416 | */ |
455 | int | 417 | int |