Merge to kernel-2.6.20-1.2949.fc6.vs2.2.0.1
[linux-2.6.git] / drivers / s390 / char / tape_34xx.c
index e738c4d..e765875 100644 (file)
@@ -2,28 +2,29 @@
  *  drivers/s390/char/tape_34xx.c
  *    tape device discipline for 3480/3490 tapes.
  *
- *  S390 and zSeries version
- *    Copyright (C) 2001,2002 IBM Deutschland Entwicklung GmbH, IBM Corporation
+ *    Copyright (C) IBM Corp. 2001,2006
  *    Author(s): Carsten Otte <cotte@de.ibm.com>
  *              Tuan Ngo-Anh <ngoanh@de.ibm.com>
  *              Martin Schwidefsky <schwidefsky@de.ibm.com>
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/bio.h>
 #include <linux/workqueue.h>
 
+#define TAPE_DBF_AREA  tape_34xx_dbf
+
 #include "tape.h"
 #include "tape_std.h"
 
 #define PRINTK_HEADER "TAPE_34XX: "
 
-enum tape_34xx_type {
-       tape_3480,
-       tape_3490,
-};
+/*
+ * Pointer to debug area.
+ */
+debug_info_t *TAPE_DBF_AREA = NULL;
+EXPORT_SYMBOL(TAPE_DBF_AREA);
 
 #define TAPE34XX_FMT_3480      0
 #define TAPE34XX_FMT_3480_2_XF 1
@@ -94,6 +95,12 @@ tape_34xx_medium_sense(struct tape_device *device)
        return rc;
 }
 
+struct tape_34xx_work {
+       struct tape_device      *device;
+       enum tape_op             op;
+       struct work_struct       work;
+};
+
 /*
  * These functions are currently used only to schedule a medium_sense for
  * later execution. This is because we get an interrupt whenever a medium
@@ -102,13 +109,10 @@ tape_34xx_medium_sense(struct tape_device *device)
  * interrupt handler.
  */
 static void
-tape_34xx_work_handler(void *data)
+tape_34xx_work_handler(struct work_struct *work)
 {
-       struct {
-               struct tape_device      *device;
-               enum tape_op             op;
-               struct work_struct       work;
-       } *p = data;
+       struct tape_34xx_work *p =
+               container_of(work, struct tape_34xx_work, work);
 
        switch(p->op) {
                case TO_MSEN:
@@ -125,17 +129,13 @@ tape_34xx_work_handler(void *data)
 static int
 tape_34xx_schedule_work(struct tape_device *device, enum tape_op op)
 {
-       struct {
-               struct tape_device      *device;
-               enum tape_op             op;
-               struct work_struct       work;
-       } *p;
+       struct tape_34xx_work *p;
 
        if ((p = kmalloc(sizeof(*p), GFP_ATOMIC)) == NULL)
                return -ENOMEM;
 
        memset(p, 0, sizeof(*p));
-       INIT_WORK(&p->work, tape_34xx_work_handler, p);
+       INIT_WORK(&p->work, tape_34xx_work_handler);
 
        p->device = tape_get_device_reference(device);
        p->op     = op;
@@ -885,7 +885,7 @@ tape_34xx_ioctl(struct tape_device *device, unsigned int cmd, unsigned long arg)
        if (cmd == TAPE390_DISPLAY) {
                struct display_struct disp;
 
-               if (copy_from_user(&disp, (char *) arg, sizeof(disp)) != 0)
+               if (copy_from_user(&disp, (char __user *) arg, sizeof(disp)) != 0)
                        return -EFAULT;
 
                return tape_std_display(device, &disp);
@@ -1308,9 +1308,9 @@ static struct tape_discipline tape_discipline_34xx = {
 };
 
 static struct ccw_device_id tape_34xx_ids[] = {
-       { CCW_DEVICE_DEVTYPE(0x3480, 0, 0x3480, 0), driver_info: tape_3480},
-       { CCW_DEVICE_DEVTYPE(0x3490, 0, 0x3490, 0), driver_info: tape_3490},
-       { /* end of list */ }
+       { CCW_DEVICE_DEVTYPE(0x3480, 0, 0x3480, 0), .driver_info = tape_3480},
+       { CCW_DEVICE_DEVTYPE(0x3490, 0, 0x3490, 0), .driver_info = tape_3490},
+       { /* end of list */ },
 };
 
 static int
@@ -1343,7 +1343,13 @@ tape_34xx_init (void)
 {
        int rc;
 
-       DBF_EVENT(3, "34xx init: $Revision: 1.20 $\n");
+       TAPE_DBF_AREA = debug_register ( "tape_34xx", 2, 2, 4*sizeof(long));
+       debug_register_view(TAPE_DBF_AREA, &debug_sprintf_view);
+#ifdef DBF_LIKE_HELL
+       debug_set_level(TAPE_DBF_AREA, 6);
+#endif
+
+       DBF_EVENT(3, "34xx init\n");
        /* Register driver for 3480/3490 tapes. */
        rc = ccw_driver_register(&tape_34xx_driver);
        if (rc)
@@ -1357,12 +1363,13 @@ static void
 tape_34xx_exit(void)
 {
        ccw_driver_unregister(&tape_34xx_driver);
+
+       debug_unregister(TAPE_DBF_AREA);
 }
 
 MODULE_DEVICE_TABLE(ccw, tape_34xx_ids);
 MODULE_AUTHOR("(C) 2001-2002 IBM Deutschland Entwicklung GmbH");
-MODULE_DESCRIPTION("Linux on zSeries channel attached 3480 tape "
-                  "device driver ($Revision: 1.20 $)");
+MODULE_DESCRIPTION("Linux on zSeries channel attached 3480 tape device driver");
 MODULE_LICENSE("GPL");
 
 module_init(tape_34xx_init);