Commit ea7629c9 authored by Martin Schwidefsky's avatar Martin Schwidefsky Committed by Linus Torvalds

[PATCH] s390: tape device driver.

Bug fixes for the s390 tape device driver:
 - Remove tapechar_init() from mem.c. It is called via module_init anyway.
 - Remove unnecessary #include <version.h>
 - Make tape_block compile. Add fixme.
 - Export symbols needed by tape discipline drivers.
parent ed0db08d
...@@ -706,9 +706,6 @@ static int __init chr_dev_init(void) ...@@ -706,9 +706,6 @@ static int __init chr_dev_init(void)
misc_init(); misc_init();
#ifdef CONFIG_FTAPE #ifdef CONFIG_FTAPE
ftape_init(); ftape_init();
#endif
#if defined(CONFIG_S390_TAPE) && defined(CONFIG_S390_TAPE_CHAR)
tapechar_init();
#endif #endif
return 0; return 0;
} }
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/bio.h> #include <linux/bio.h>
...@@ -1042,7 +1041,7 @@ tape_34xx_init (void) ...@@ -1042,7 +1041,7 @@ tape_34xx_init (void)
{ {
int rc; int rc;
DBF_EVENT(3, "34xx init: $Revision: 1.7 $\n"); DBF_EVENT(3, "34xx init: $Revision: 1.8 $\n");
/* Register driver for 3480/3490 tapes. */ /* Register driver for 3480/3490 tapes. */
rc = ccw_driver_register(&tape_34xx_driver); rc = ccw_driver_register(&tape_34xx_driver);
if (rc) if (rc)
...@@ -1061,7 +1060,7 @@ tape_34xx_exit(void) ...@@ -1061,7 +1060,7 @@ tape_34xx_exit(void)
MODULE_DEVICE_TABLE(ccw, tape_34xx_ids); MODULE_DEVICE_TABLE(ccw, tape_34xx_ids);
MODULE_AUTHOR("(C) 2001-2002 IBM Deutschland Entwicklung GmbH"); MODULE_AUTHOR("(C) 2001-2002 IBM Deutschland Entwicklung GmbH");
MODULE_DESCRIPTION("Linux on zSeries channel attached 3480 tape " MODULE_DESCRIPTION("Linux on zSeries channel attached 3480 tape "
"device driver ($Revision: 1.7 $)"); "device driver ($Revision: 1.8 $)");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(tape_34xx_init); module_init(tape_34xx_init);
......
...@@ -237,14 +237,13 @@ tapeblock_setup_device(struct tape_device * device) ...@@ -237,14 +237,13 @@ tapeblock_setup_device(struct tape_device * device)
blk_queue_segment_boundary(q, -1L); blk_queue_segment_boundary(q, -1L);
disk->major = tapeblock_major; disk->major = tapeblock_major;
disk->first_minor = i; disk->first_minor = device->first_minor;
disk->fops = &tapeblock_fops; disk->fops = &tapeblock_fops;
disk->private_data = device; disk->private_data = device;
disk->queue = q; disk->queue = q;
set_capacity(disk, size); //set_capacity(disk, size);
sprintf(disk->disk_name, "tBLK%d", i); sprintf(disk->disk_name, "tBLK/%d", device->first_minor / TAPE_MINORS_PER_DEV);
sprintf(disk->disk_name, "tBLK/%d", i);
add_disk(disk); add_disk(disk);
d->disk = disk; d->disk = disk;
...@@ -302,10 +301,16 @@ static int tapeblock_mediumdetect(struct tape_device *device) ...@@ -302,10 +301,16 @@ static int tapeblock_mediumdetect(struct tape_device *device)
static int static int
tapeblock_open(struct inode *inode, struct file *filp) tapeblock_open(struct inode *inode, struct file *filp)
{ {
struct gendisk *disk = inp->i_bdev->bd_disk; struct gendisk *disk = inode->i_bdev->bd_disk;
struct tape_device *device = disk->private_data; struct tape_device *device = disk->private_data;
int rc; int rc;
/*
* FIXME: this new tapeblock_open function is from 2.5.69.
* It doesn't do tape_get_device anymore but picks the device
* pointer from disk->private_data. It is stored in
* tapeblock_setup_device but WITHOUT proper ref-counting.
*/
rc = tape_open(device); rc = tape_open(device);
if (rc) if (rc)
goto put_device; goto put_device;
...@@ -333,7 +338,7 @@ tapeblock_open(struct inode *inode, struct file *filp) ...@@ -333,7 +338,7 @@ tapeblock_open(struct inode *inode, struct file *filp)
static int static int
tapeblock_release(struct inode *inode, struct file *filp) tapeblock_release(struct inode *inode, struct file *filp)
{ {
struct gendisk *disk = inp->i_bdev->bd_disk; struct gendisk *disk = inode->i_bdev->bd_disk;
struct tape_device *device = disk->private_data; struct tape_device *device = disk->private_data;
tape_release(device); tape_release(device);
......
...@@ -37,6 +37,7 @@ static int tapechar_ioctl(struct inode *, struct file *, unsigned int, ...@@ -37,6 +37,7 @@ static int tapechar_ioctl(struct inode *, struct file *, unsigned int,
static struct file_operations tape_fops = static struct file_operations tape_fops =
{ {
.owner = THIS_MODULE,
.read = tapechar_read, .read = tapechar_read,
.write = tapechar_write, .write = tapechar_write,
.ioctl = tapechar_ioctl, .ioctl = tapechar_ioctl,
...@@ -237,13 +238,11 @@ tapechar_open (struct inode *inode, struct file *filp) ...@@ -237,13 +238,11 @@ tapechar_open (struct inode *inode, struct file *filp)
struct tape_device *device; struct tape_device *device;
int minor, rc; int minor, rc;
MOD_INC_USE_COUNT;
if (major(filp->f_dentry->d_inode->i_rdev) != tapechar_major) if (major(filp->f_dentry->d_inode->i_rdev) != tapechar_major)
return -ENODEV; return -ENODEV;
minor = minor(filp->f_dentry->d_inode->i_rdev); minor = minor(filp->f_dentry->d_inode->i_rdev);
device = tape_get_device(minor / TAPE_MINORS_PER_DEV); device = tape_get_device(minor / TAPE_MINORS_PER_DEV);
if (IS_ERR(device)) { if (IS_ERR(device)) {
MOD_DEC_USE_COUNT;
return PTR_ERR(device); return PTR_ERR(device);
} }
DBF_EVENT(6, "TCHAR:open: %x\n", minor(inode->i_rdev)); DBF_EVENT(6, "TCHAR:open: %x\n", minor(inode->i_rdev));
...@@ -257,7 +256,6 @@ tapechar_open (struct inode *inode, struct file *filp) ...@@ -257,7 +256,6 @@ tapechar_open (struct inode *inode, struct file *filp)
tape_release(device); tape_release(device);
} }
tape_put_device(device); tape_put_device(device);
MOD_DEC_USE_COUNT;
return rc; return rc;
} }
...@@ -293,7 +291,6 @@ tapechar_release(struct inode *inode, struct file *filp) ...@@ -293,7 +291,6 @@ tapechar_release(struct inode *inode, struct file *filp)
tape_release(device); tape_release(device);
tape_unassign(device); tape_unassign(device);
tape_put_device(device); tape_put_device(device);
MOD_DEC_USE_COUNT;
return 0; return 0;
} }
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> // for kernel parameters #include <linux/init.h> // for kernel parameters
#include <linux/kmod.h> // for requesting modules #include <linux/kmod.h> // for requesting modules
...@@ -904,7 +903,7 @@ tape_init (void) ...@@ -904,7 +903,7 @@ tape_init (void)
{ {
tape_dbf_area = debug_register ( "tape", 1, 2, 3*sizeof(long)); tape_dbf_area = debug_register ( "tape", 1, 2, 3*sizeof(long));
debug_register_view(tape_dbf_area, &debug_sprintf_view); debug_register_view(tape_dbf_area, &debug_sprintf_view);
DBF_EVENT(3, "tape init: ($Revision: 1.23 $)\n"); DBF_EVENT(3, "tape init: ($Revision: 1.25 $)\n");
tape_proc_init(); tape_proc_init();
tapechar_init (); tapechar_init ();
tapeblock_init (); tapeblock_init ();
...@@ -929,12 +928,17 @@ tape_exit(void) ...@@ -929,12 +928,17 @@ tape_exit(void)
MODULE_AUTHOR("(C) 2001 IBM Deutschland Entwicklung GmbH by Carsten Otte and " MODULE_AUTHOR("(C) 2001 IBM Deutschland Entwicklung GmbH by Carsten Otte and "
"Michael Holzheu (cotte@de.ibm.com,holzheu@de.ibm.com)"); "Michael Holzheu (cotte@de.ibm.com,holzheu@de.ibm.com)");
MODULE_DESCRIPTION("Linux on zSeries channel attached " MODULE_DESCRIPTION("Linux on zSeries channel attached "
"tape device driver ($Revision: 1.23 $)"); "tape device driver ($Revision: 1.25 $)");
module_init(tape_init); module_init(tape_init);
module_exit(tape_exit); module_exit(tape_exit);
EXPORT_SYMBOL(tape_dbf_area); EXPORT_SYMBOL(tape_dbf_area);
EXPORT_SYMBOL(tape_generic_remove);
EXPORT_SYMBOL(tape_disable_device);
EXPORT_SYMBOL(tape_generic_probe);
EXPORT_SYMBOL(tape_enable_device);
EXPORT_SYMBOL(tape_put_device);
EXPORT_SYMBOL(tape_state_verbose); EXPORT_SYMBOL(tape_state_verbose);
EXPORT_SYMBOL(tape_op_verbose); EXPORT_SYMBOL(tape_op_verbose);
EXPORT_SYMBOL(tape_state_set); EXPORT_SYMBOL(tape_state_set);
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/version.h>
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/bio.h> #include <linux/bio.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment