]> err.no Git - linux-2.6/blobdiff - drivers/s390/char/tape_34xx.c
[S390] cio: introduce fcx enabled scsw format
[linux-2.6] / drivers / s390 / char / tape_34xx.c
index 48b4d30a725612fedef6af60ba58d0bff4a792cf..22ca34361ed7711e15eb9a7c5688970aab46b81d 100644 (file)
@@ -95,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
@@ -103,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:
@@ -126,17 +129,12 @@ 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)
+       if ((p = kzalloc(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;
@@ -198,7 +196,7 @@ tape_34xx_erp_retry(struct tape_request *request)
 static int
 tape_34xx_unsolicited_irq(struct tape_device *device, struct irb *irb)
 {
-       if (irb->scsw.dstat == 0x85 /* READY */) {
+       if (irb->scsw.cmd.dstat == 0x85) { /* READY */
                /* A medium was inserted in the drive. */
                DBF_EVENT(6, "xuud med\n");
                tape_34xx_delete_sbid_from(device, 0);
@@ -396,7 +394,7 @@ tape_34xx_unit_check(struct tape_device *device, struct tape_request *request,
                        return tape_34xx_erp_failed(request, -ENOSPC);
                default:
                        PRINT_ERR("Invalid op in %s:%i\n",
-                                 __FUNCTION__, __LINE__);
+                                 __func__, __LINE__);
                        return tape_34xx_erp_failed(request, 0);
                }
        }
@@ -846,22 +844,22 @@ tape_34xx_irq(struct tape_device *device, struct tape_request *request,
        if (request == NULL)
                return tape_34xx_unsolicited_irq(device, irb);
 
-       if ((irb->scsw.dstat & DEV_STAT_UNIT_EXCEP) &&
-           (irb->scsw.dstat & DEV_STAT_DEV_END) &&
+       if ((irb->scsw.cmd.dstat & DEV_STAT_UNIT_EXCEP) &&
+           (irb->scsw.cmd.dstat & DEV_STAT_DEV_END) &&
            (request->op == TO_WRI)) {
                /* Write at end of volume */
                PRINT_INFO("End of volume\n"); /* XXX */
                return tape_34xx_erp_failed(request, -ENOSPC);
        }
 
-       if (irb->scsw.dstat & DEV_STAT_UNIT_CHECK)
+       if (irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK)
                return tape_34xx_unit_check(device, request, irb);
 
-       if (irb->scsw.dstat & DEV_STAT_DEV_END) {
+       if (irb->scsw.cmd.dstat & DEV_STAT_DEV_END) {
                /*
                 * A unit exception occurs on skipping over a tapemark block.
                 */
-               if (irb->scsw.dstat & DEV_STAT_UNIT_EXCEP) {
+               if (irb->scsw.cmd.dstat & DEV_STAT_UNIT_EXCEP) {
                        if (request->op == TO_BSB || request->op == TO_FSB)
                                request->rescnt++;
                        else
@@ -1136,21 +1134,18 @@ tape_34xx_bread(struct tape_device *device, struct request *req)
 {
        struct tape_request *request;
        struct ccw1 *ccw;
-       int count = 0, i;
+       int count = 0;
        unsigned off;
        char *dst;
        struct bio_vec *bv;
-       struct bio *bio;
+       struct req_iterator iter;
        struct tape_34xx_block_id *     start_block;
 
        DBF_EVENT(6, "xBREDid:");
 
        /* Count the number of blocks for the request. */
-       rq_for_each_bio(bio, req) {
-               bio_for_each_segment(bv, bio, i) {
-                       count += bv->bv_len >> (TAPEBLOCK_HSEC_S2B + 9);
-               }
-       }
+       rq_for_each_segment(bv, req, iter)
+               count += bv->bv_len >> (TAPEBLOCK_HSEC_S2B + 9);
 
        /* Allocate the ccw request. */
        request = tape_alloc_request(3+count+1, 8);
@@ -1177,18 +1172,15 @@ tape_34xx_bread(struct tape_device *device, struct request *req)
        ccw = tape_ccw_cc(ccw, NOP, 0, NULL);
        ccw = tape_ccw_cc(ccw, NOP, 0, NULL);
 
-       rq_for_each_bio(bio, req) {
-               bio_for_each_segment(bv, bio, i) {
-                       dst = kmap(bv->bv_page) + bv->bv_offset;
-                       for (off = 0; off < bv->bv_len;
-                            off += TAPEBLOCK_HSEC_SIZE) {
-                               ccw->flags = CCW_FLAG_CC;
-                               ccw->cmd_code = READ_FORWARD;
-                               ccw->count = TAPEBLOCK_HSEC_SIZE;
-                               set_normalized_cda(ccw, (void*) __pa(dst));
-                               ccw++;
-                               dst += TAPEBLOCK_HSEC_SIZE;
-                       }
+       rq_for_each_segment(bv, req, iter) {
+               dst = kmap(bv->bv_page) + bv->bv_offset;
+               for (off = 0; off < bv->bv_len; off += TAPEBLOCK_HSEC_SIZE) {
+                       ccw->flags = CCW_FLAG_CC;
+                       ccw->cmd_code = READ_FORWARD;
+                       ccw->count = TAPEBLOCK_HSEC_SIZE;
+                       set_normalized_cda(ccw, (void*) __pa(dst));
+                       ccw++;
+                       dst += TAPEBLOCK_HSEC_SIZE;
                }
        }
 
@@ -1309,9 +1301,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