Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / s390 / char / tape_block.c
index 1efc9f2..b70d926 100644 (file)
@@ -65,7 +65,7 @@ static void
 tapeblock_trigger_requeue(struct tape_device *device)
 {
        /* Protect against rescheduling. */
-       if (atomic_compare_and_swap(0, 1, &device->blk_data.requeue_scheduled))
+       if (atomic_cmpxchg(&device->blk_data.requeue_scheduled, 0, 1) != 0)
                return;
        schedule_work(&device->blk_data.requeue_task);
 }
@@ -78,7 +78,7 @@ tapeblock_end_request(struct request *req, int uptodate)
 {
        if (end_that_request_first(req, uptodate, req->hard_nr_sectors))
                BUG();
-       end_that_request_last(req);
+       end_that_request_last(req, uptodate);
 }
 
 static void
@@ -198,9 +198,7 @@ tapeblock_request_fn(request_queue_t *queue)
 
        device = (struct tape_device *) queue->queuedata;
        DBF_LH(6, "tapeblock_request_fn(device=%p)\n", device);
-       if (device == NULL)
-               BUG();
-
+       BUG_ON(device == NULL);
        tapeblock_trigger_requeue(device);
 }
 
@@ -307,8 +305,7 @@ tapeblock_revalidate_disk(struct gendisk *disk)
        int                     rc;
 
        device = (struct tape_device *) disk->private_data;
-       if (!device)
-               BUG();
+       BUG_ON(!device);
 
        if (!device->blk_data.medium_changed)
                return 0;
@@ -435,16 +432,14 @@ tapeblock_ioctl(
 ) {
        int rc;
        int minor;
-       struct gendisk *disk = inode->i_bdev->bd_disk;
-       struct tape_device *device = disk->private_data;
+       struct gendisk *disk;
+       struct tape_device *device;
 
        rc     = 0;
        disk   = inode->i_bdev->bd_disk;
-       if (!disk)
-               BUG();
+       BUG_ON(!disk);
        device = disk->private_data;
-       if (!device)
-               BUG();
+       BUG_ON(!device);
        minor  = iminor(inode);
 
        DBF_LH(6, "tapeblock_ioctl(0x%0x)\n", command);