[PATCH] make floppy driver useable for 2.5

Bartlomiej Zolnierkiewicz (B.Zolnierkiewicz@elka.pw.edu.pl)
Sun, 4 May 2003 22:21:26 +0200 (MET DST)


Hi,

I fixed 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 :-).

Please apply,

--
Bartlomiej

--- linux-2.5.68-bk6/drivers/block/floppy.c Sat Apr 26 18:14:24 2003 +++ linux/drivers/block/floppy.c Sun May 4 21:57:36 2003 @@ -2293,7 +2293,12 @@

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 @@ 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);

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/