]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] make floppy driver useable for 2.5
authorBartlomiej Zolnierkiewicz <b.zolnierkiewicz@elka.pw.edu.pl>
Sun, 4 May 2003 09:01:13 +0000 (02:01 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sun, 4 May 2003 09:01:13 +0000 (02:01 -0700)
This fixes two bugs introduced by some 2.5 changes:

- O_NDELAY handling typo in floppy_open()

- handling of failed transfers in floppy_end_request()
  (do equivalent of what 2.4 does)

Without first fix I was getting "floppy0: disk absent or changed during
operation" infinite loop on opening and without second fix, infinite loop
on error retry.

Now floppy driver seems to be (somehow) working :-).

drivers/block/floppy.c

index ee016885325c3ef6861cd63d71012f23f05ab486..1ba0019f493a2e1295e1247be230bd243a8fc7a7 100644 (file)
@@ -2293,7 +2293,12 @@ static int do_format(int drive, struct format_descr *tmp_format_req)
 
 static void floppy_end_request(struct request *req, int uptodate)
 {
-       if (end_that_request_first(req, uptodate, current_count_sectors))
+       unsigned int nr_sectors = current_count_sectors;
+
+       /* current_count_sectors can be zero if transfer failed */
+       if (!uptodate)
+               nr_sectors = req->current_nr_sectors;
+       if (end_that_request_first(req, uptodate, nr_sectors))
                return;
        add_disk_randomness(req->rq_disk);
        floppy_off((long)req->rq_disk->private_data);
@@ -3768,7 +3773,7 @@ static int floppy_open(struct inode * inode, struct file * filp)
        if (UFDCS->rawcmd == 1)
                UFDCS->rawcmd = 2;
 
-       if (!filp->f_flags & O_NDELAY) {
+       if (!(filp->f_flags & O_NDELAY)) {
                if (filp->f_mode & 3) {
                        UDRS->last_checked = 0;
                        check_disk_change(inode->i_bdev);