Commit 077570f0 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Linus Torvalds

[PATCH] make floppy driver useable for 2.5

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 :-).
parent 9cfeede4
...@@ -2293,7 +2293,12 @@ static int do_format(int drive, struct format_descr *tmp_format_req) ...@@ -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) 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; return;
add_disk_randomness(req->rq_disk); add_disk_randomness(req->rq_disk);
floppy_off((long)req->rq_disk->private_data); floppy_off((long)req->rq_disk->private_data);
...@@ -3768,7 +3773,7 @@ static int floppy_open(struct inode * inode, struct file * filp) ...@@ -3768,7 +3773,7 @@ static int floppy_open(struct inode * inode, struct file * filp)
if (UFDCS->rawcmd == 1) if (UFDCS->rawcmd == 1)
UFDCS->rawcmd = 2; UFDCS->rawcmd = 2;
if (!filp->f_flags & O_NDELAY) { if (!(filp->f_flags & O_NDELAY)) {
if (filp->f_mode & 3) { if (filp->f_mode & 3) {
UDRS->last_checked = 0; UDRS->last_checked = 0;
check_disk_change(inode->i_bdev); check_disk_change(inode->i_bdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment