[S390] cio: introduce fcx enabled scsw format
[linux-block.git] / drivers / s390 / char / raw3270.c
index 2edd5fb6d3dc1e8a4894e0ff5c8557ccdf2de838..efce32e97be24d694e8eb31183c029cd5bd41301 100644 (file)
@@ -48,8 +48,8 @@ struct raw3270 {
        struct timer_list timer;        /* Device timer. */
 
        unsigned char *ascebc;          /* ascii -> ebcdic table */
-       struct class_device *clttydev;  /* 3270-class tty device ptr */
-       struct class_device *cltubdev;  /* 3270-class tub device ptr */
+       struct device *clttydev;        /* 3270-class tty device ptr */
+       struct device *cltubdev;        /* 3270-class tub device ptr */
 
        struct raw3270_request init_request;
        unsigned char init_data[256];
@@ -66,7 +66,7 @@ struct raw3270 {
 static DEFINE_MUTEX(raw3270_mutex);
 
 /* List of 3270 devices. */
-static struct list_head raw3270_devices = LIST_HEAD_INIT(raw3270_devices);
+static LIST_HEAD(raw3270_devices);
 
 /*
  * Flag to indicate if the driver has been registered. Some operations
@@ -372,17 +372,17 @@ raw3270_irq (struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
 
        if (IS_ERR(irb))
                rc = RAW3270_IO_RETRY;
-       else if (irb->scsw.fctl & SCSW_FCTL_HALT_FUNC) {
+       else if (irb->scsw.cmd.fctl & SCSW_FCTL_HALT_FUNC) {
                rq->rc = -EIO;
                rc = RAW3270_IO_DONE;
-       } else if (irb->scsw.dstat ==  (DEV_STAT_CHN_END | DEV_STAT_DEV_END |
-                                       DEV_STAT_UNIT_EXCEP)) {
+       } else if (irb->scsw.cmd.dstat == (DEV_STAT_CHN_END | DEV_STAT_DEV_END |
+                                          DEV_STAT_UNIT_EXCEP)) {
                /* Handle CE-DE-UE and subsequent UDE */
                set_bit(RAW3270_FLAGS_BUSY, &rp->flags);
                rc = RAW3270_IO_BUSY;
        } else if (test_bit(RAW3270_FLAGS_BUSY, &rp->flags)) {
                /* Wait for UDE if busy flag is set. */
-               if (irb->scsw.dstat & DEV_STAT_DEV_END) {
+               if (irb->scsw.cmd.dstat & DEV_STAT_DEV_END) {
                        clear_bit(RAW3270_FLAGS_BUSY, &rp->flags);
                        /* Got it, now retry. */
                        rc = RAW3270_IO_RETRY;
@@ -497,7 +497,7 @@ raw3270_init_irq(struct raw3270_view *view, struct raw3270_request *rq,
         * Unit-Check Processing:
         * Expect Command Reject or Intervention Required.
         */
-       if (irb->scsw.dstat & DEV_STAT_UNIT_CHECK) {
+       if (irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) {
                /* Request finished abnormally. */
                if (irb->ecw[0] & SNS0_INTERVENTION_REQ) {
                        set_bit(RAW3270_FLAGS_BUSY, &view->dev->flags);
@@ -505,16 +505,16 @@ raw3270_init_irq(struct raw3270_view *view, struct raw3270_request *rq,
                }
        }
        if (rq) {
-               if (irb->scsw.dstat & DEV_STAT_UNIT_CHECK) {
+               if (irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) {
                        if (irb->ecw[0] & SNS0_CMD_REJECT)
                                rq->rc = -EOPNOTSUPP;
                        else
                                rq->rc = -EIO;
                } else
                        /* Request finished normally. Copy residual count. */
-                       rq->rescnt = irb->scsw.count;
+                       rq->rescnt = irb->scsw.cmd.count;
        }
-       if (irb->scsw.dstat & DEV_STAT_ATTENTION) {
+       if (irb->scsw.cmd.dstat & DEV_STAT_ATTENTION) {
                set_bit(RAW3270_FLAGS_ATTN, &view->dev->flags);
                wake_up(&raw3270_wait_queue);
        }
@@ -549,7 +549,6 @@ raw3270_start_init(struct raw3270 *rp, struct raw3270_view *view,
                   struct raw3270_request *rq)
 {
        unsigned long flags;
-       wait_queue_head_t wq;
        int rc;
 
 #ifdef CONFIG_TN3270_CONSOLE
@@ -566,20 +565,20 @@ raw3270_start_init(struct raw3270 *rp, struct raw3270_view *view,
                return rq->rc;
        }
 #endif
-       init_waitqueue_head(&wq);
        rq->callback = raw3270_wake_init;
-       rq->callback_data = &wq;
+       rq->callback_data = &raw3270_wait_queue;
        spin_lock_irqsave(get_ccwdev_lock(view->dev->cdev), flags);
        rc = __raw3270_start(rp, view, rq);
        spin_unlock_irqrestore(get_ccwdev_lock(view->dev->cdev), flags);
        if (rc)
                return rc;
        /* Now wait for the completion. */
-       rc = wait_event_interruptible(wq, raw3270_request_final(rq));
+       rc = wait_event_interruptible(raw3270_wait_queue,
+                                     raw3270_request_final(rq));
        if (rc == -ERESTARTSYS) {       /* Interrupted by a signal. */
                raw3270_halt_io(view->dev, rq);
                /* No wait for the halt to complete. */
-               wait_event(wq, raw3270_request_final(rq));
+               wait_event(raw3270_wait_queue, raw3270_request_final(rq));
                return -ERESTARTSYS;
        }
        return rq->rc;
@@ -1107,11 +1106,9 @@ raw3270_delete_device(struct raw3270 *rp)
        /* Remove from device chain. */
        mutex_lock(&raw3270_mutex);
        if (rp->clttydev && !IS_ERR(rp->clttydev))
-               class_device_destroy(class3270,
-                                    MKDEV(IBM_TTY3270_MAJOR, rp->minor));
+               device_destroy(class3270, MKDEV(IBM_TTY3270_MAJOR, rp->minor));
        if (rp->cltubdev && !IS_ERR(rp->cltubdev))
-               class_device_destroy(class3270,
-                                    MKDEV(IBM_FS3270_MAJOR, rp->minor));
+               device_destroy(class3270, MKDEV(IBM_FS3270_MAJOR, rp->minor));
        list_del_init(&rp->list);
        mutex_unlock(&raw3270_mutex);
 
@@ -1181,24 +1178,22 @@ static int raw3270_create_attributes(struct raw3270 *rp)
        if (rc)
                goto out;
 
-       rp->clttydev = class_device_create(class3270, NULL,
-                                          MKDEV(IBM_TTY3270_MAJOR, rp->minor),
-                                          &rp->cdev->dev, "tty%s",
-                                          rp->cdev->dev.bus_id);
+       rp->clttydev = device_create(class3270, &rp->cdev->dev,
+                                    MKDEV(IBM_TTY3270_MAJOR, rp->minor),
+                                    "tty%s", rp->cdev->dev.bus_id);
        if (IS_ERR(rp->clttydev)) {
                rc = PTR_ERR(rp->clttydev);
                goto out_ttydev;
        }
 
-       rp->cltubdev = class_device_create(class3270, NULL,
-                                          MKDEV(IBM_FS3270_MAJOR, rp->minor),
-                                          &rp->cdev->dev, "tub%s",
-                                          rp->cdev->dev.bus_id);
+       rp->cltubdev = device_create(class3270, &rp->cdev->dev,
+                                    MKDEV(IBM_FS3270_MAJOR, rp->minor),
+                                    "tub%s", rp->cdev->dev.bus_id);
        if (!IS_ERR(rp->cltubdev))
                goto out;
 
        rc = PTR_ERR(rp->cltubdev);
-       class_device_destroy(class3270, MKDEV(IBM_TTY3270_MAJOR, rp->minor));
+       device_destroy(class3270, MKDEV(IBM_TTY3270_MAJOR, rp->minor));
 
 out_ttydev:
        sysfs_remove_group(&rp->cdev->dev.kobj, &raw3270_attr_group);
@@ -1214,7 +1209,7 @@ struct raw3270_notifier {
        void (*notifier)(int, int);
 };
 
-static struct list_head raw3270_notifier = LIST_HEAD_INIT(raw3270_notifier);
+static LIST_HEAD(raw3270_notifier);
 
 int raw3270_register_notifier(void (*notifier)(int, int))
 {