Commit f3b10a3c authored by Willy Tarreau's avatar Willy Tarreau Committed by Linus Torvalds

ataflop: use a statically allocated error counters

This is the last driver making use of fd_request->error_count, which is
easy to get wrong as was shown in floppy.c.  We don't need to keep it
there, it can be moved to the atari_floppy_struct instead, so let's do
this.
Suggested-by: default avatarLinus Torvalds <torvalds@linuxfoundation.org>
Cc: Minh Yuan <yuanmingbuaa@gmail.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f71f0139
...@@ -303,6 +303,7 @@ static struct atari_floppy_struct { ...@@ -303,6 +303,7 @@ static struct atari_floppy_struct {
int ref; int ref;
int type; int type;
struct blk_mq_tag_set tag_set; struct blk_mq_tag_set tag_set;
int error_count;
} unit[FD_MAX_UNITS]; } unit[FD_MAX_UNITS];
#define UD unit[drive] #define UD unit[drive]
...@@ -705,14 +706,14 @@ static void fd_error( void ) ...@@ -705,14 +706,14 @@ static void fd_error( void )
if (!fd_request) if (!fd_request)
return; return;
fd_request->error_count++; unit[SelectedDrive].error_count++;
if (fd_request->error_count >= MAX_ERRORS) { if (unit[SelectedDrive].error_count >= MAX_ERRORS) {
printk(KERN_ERR "fd%d: too many errors.\n", SelectedDrive ); printk(KERN_ERR "fd%d: too many errors.\n", SelectedDrive );
fd_end_request_cur(BLK_STS_IOERR); fd_end_request_cur(BLK_STS_IOERR);
finish_fdc(); finish_fdc();
return; return;
} }
else if (fd_request->error_count == RECALIBRATE_ERRORS) { else if (unit[SelectedDrive].error_count == RECALIBRATE_ERRORS) {
printk(KERN_WARNING "fd%d: recalibrating\n", SelectedDrive ); printk(KERN_WARNING "fd%d: recalibrating\n", SelectedDrive );
if (SelectedDrive != -1) if (SelectedDrive != -1)
SUD.track = -1; SUD.track = -1;
...@@ -1491,7 +1492,7 @@ static void setup_req_params( int drive ) ...@@ -1491,7 +1492,7 @@ static void setup_req_params( int drive )
ReqData = ReqBuffer + 512 * ReqCnt; ReqData = ReqBuffer + 512 * ReqCnt;
if (UseTrackbuffer) if (UseTrackbuffer)
read_track = (ReqCmd == READ && fd_request->error_count == 0); read_track = (ReqCmd == READ && unit[drive].error_count == 0);
else else
read_track = 0; read_track = 0;
...@@ -1520,6 +1521,7 @@ static blk_status_t ataflop_queue_rq(struct blk_mq_hw_ctx *hctx, ...@@ -1520,6 +1521,7 @@ static blk_status_t ataflop_queue_rq(struct blk_mq_hw_ctx *hctx,
return BLK_STS_RESOURCE; return BLK_STS_RESOURCE;
} }
fd_request = bd->rq; fd_request = bd->rq;
unit[drive].error_count = 0;
blk_mq_start_request(fd_request); blk_mq_start_request(fd_request);
atari_disable_irq( IRQ_MFP_FDC ); atari_disable_irq( IRQ_MFP_FDC );
......
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