Commit f299adc6 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] kills CURRENT in floppy.c

dumb expansion of macro - it had #define CURRENT current_req
parent 0beb090c
...@@ -239,7 +239,6 @@ static int allowed_drive_mask = 0x33; ...@@ -239,7 +239,6 @@ static int allowed_drive_mask = 0x33;
static int irqdma_allocated; static int irqdma_allocated;
#define CURRENT current_req
#define LOCAL_END_REQUEST #define LOCAL_END_REQUEST
#define MAJOR_NR FLOPPY_MAJOR #define MAJOR_NR FLOPPY_MAJOR
#define DEVICE_NAME "floppy" #define DEVICE_NAME "floppy"
...@@ -665,12 +664,12 @@ static struct output_log { ...@@ -665,12 +664,12 @@ static struct output_log {
static int output_log_pos; static int output_log_pos;
#endif #endif
#define CURRENTD -1 #define current_reqD -1
#define MAXTIMEOUT -2 #define MAXTIMEOUT -2
static void reschedule_timeout(int drive, const char *message, int marg) static void reschedule_timeout(int drive, const char *message, int marg)
{ {
if (drive == CURRENTD) if (drive == current_reqD)
drive = current_drive; drive = current_drive;
del_timer(&fd_timeout); del_timer(&fd_timeout);
if (drive < 0 || drive > N_DRIVE) { if (drive < 0 || drive > N_DRIVE) {
...@@ -1898,7 +1897,7 @@ static void show_floppy(void) ...@@ -1898,7 +1897,7 @@ static void show_floppy(void)
printk("now=%lu\n",jiffies); printk("now=%lu\n",jiffies);
} }
printk("cont=%p\n", cont); printk("cont=%p\n", cont);
printk("CURRENT=%p\n", CURRENT); printk("current_req=%p\n", current_req);
printk("command_status=%d\n", command_status); printk("command_status=%d\n", command_status);
printk("\n"); printk("\n");
} }
...@@ -2004,7 +2003,7 @@ static void floppy_ready(void) ...@@ -2004,7 +2003,7 @@ static void floppy_ready(void)
static void floppy_start(void) static void floppy_start(void)
{ {
reschedule_timeout(CURRENTD, "floppy start", 0); reschedule_timeout(current_reqD, "floppy start", 0);
scandrives(); scandrives();
#ifdef DCL_DEBUG #ifdef DCL_DEBUG
...@@ -2308,7 +2307,7 @@ static inline void end_request(struct request *req, int uptodate) ...@@ -2308,7 +2307,7 @@ static inline void end_request(struct request *req, int uptodate)
end_that_request_last(req); end_that_request_last(req);
/* We're done with the request */ /* We're done with the request */
CURRENT = NULL; current_req = NULL;
} }
...@@ -2317,7 +2316,7 @@ static inline void end_request(struct request *req, int uptodate) ...@@ -2317,7 +2316,7 @@ static inline void end_request(struct request *req, int uptodate)
static void request_done(int uptodate) static void request_done(int uptodate)
{ {
struct request_queue *q = QUEUE; struct request_queue *q = QUEUE;
struct request *req = CURRENT; struct request *req = current_req;
unsigned long flags; unsigned long flags;
int block; int block;
...@@ -2441,7 +2440,7 @@ static void rw_interrupt(void) ...@@ -2441,7 +2440,7 @@ static void rw_interrupt(void)
} }
if (CT(COMMAND) != FD_READ || if (CT(COMMAND) != FD_READ ||
raw_cmd->kernel_data == CURRENT->buffer){ raw_cmd->kernel_data == current_req->buffer){
/* transfer directly from buffer */ /* transfer directly from buffer */
cont->done(1); cont->done(1);
} else if (CT(COMMAND) == FD_READ){ } else if (CT(COMMAND) == FD_READ){
...@@ -2460,10 +2459,10 @@ static int buffer_chain_size(void) ...@@ -2460,10 +2459,10 @@ static int buffer_chain_size(void)
int size, i; int size, i;
char *base; char *base;
base = bio_data(CURRENT->bio); base = bio_data(current_req->bio);
size = 0; size = 0;
rq_for_each_bio(bio, CURRENT) { rq_for_each_bio(bio, current_req) {
bio_for_each_segment(bv, bio, i) { bio_for_each_segment(bv, bio, i) {
if (page_address(bv->bv_page) + bv->bv_offset != base + size) if (page_address(bv->bv_page) + bv->bv_offset != base + size)
break; break;
...@@ -2502,23 +2501,23 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2) ...@@ -2502,23 +2501,23 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2)
max_sector = transfer_size(ssize, max_sector = transfer_size(ssize,
minimum(max_sector, max_sector_2), minimum(max_sector, max_sector_2),
CURRENT->nr_sectors); current_req->nr_sectors);
if (current_count_sectors <= 0 && CT(COMMAND) == FD_WRITE && if (current_count_sectors <= 0 && CT(COMMAND) == FD_WRITE &&
buffer_max > fsector_t + CURRENT->nr_sectors) buffer_max > fsector_t + current_req->nr_sectors)
current_count_sectors = minimum(buffer_max - fsector_t, current_count_sectors = minimum(buffer_max - fsector_t,
CURRENT->nr_sectors); current_req->nr_sectors);
remaining = current_count_sectors << 9; remaining = current_count_sectors << 9;
#ifdef FLOPPY_SANITY_CHECK #ifdef FLOPPY_SANITY_CHECK
if ((remaining >> 9) > CURRENT->nr_sectors && if ((remaining >> 9) > current_req->nr_sectors &&
CT(COMMAND) == FD_WRITE){ CT(COMMAND) == FD_WRITE){
DPRINT("in copy buffer\n"); DPRINT("in copy buffer\n");
printk("current_count_sectors=%ld\n", current_count_sectors); printk("current_count_sectors=%ld\n", current_count_sectors);
printk("remaining=%d\n", remaining >> 9); printk("remaining=%d\n", remaining >> 9);
printk("CURRENT->nr_sectors=%ld\n",CURRENT->nr_sectors); printk("current_req->nr_sectors=%ld\n",current_req->nr_sectors);
printk("CURRENT->current_nr_sectors=%u\n", printk("current_req->current_nr_sectors=%u\n",
CURRENT->current_nr_sectors); current_req->current_nr_sectors);
printk("max_sector=%d\n", max_sector); printk("max_sector=%d\n", max_sector);
printk("ssize=%d\n", ssize); printk("ssize=%d\n", ssize);
} }
...@@ -2528,9 +2527,9 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2) ...@@ -2528,9 +2527,9 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2)
dma_buffer = floppy_track_buffer + ((fsector_t - buffer_min) << 9); dma_buffer = floppy_track_buffer + ((fsector_t - buffer_min) << 9);
size = CURRENT->current_nr_sectors << 9; size = current_req->current_nr_sectors << 9;
rq_for_each_bio(bio, CURRENT) { rq_for_each_bio(bio, current_req) {
bio_for_each_segment(bv, bio, i) { bio_for_each_segment(bv, bio, i) {
if (!remaining) if (!remaining)
break; break;
...@@ -2637,16 +2636,16 @@ static int make_raw_rw_request(void) ...@@ -2637,16 +2636,16 @@ static int make_raw_rw_request(void)
return 0; return 0;
} }
set_fdc(DRIVE(CURRENT->rq_dev)); set_fdc(DRIVE(current_req->rq_dev));
raw_cmd = &default_raw_cmd; raw_cmd = &default_raw_cmd;
raw_cmd->flags = FD_RAW_SPIN | FD_RAW_NEED_DISK | FD_RAW_NEED_DISK | raw_cmd->flags = FD_RAW_SPIN | FD_RAW_NEED_DISK | FD_RAW_NEED_DISK |
FD_RAW_NEED_SEEK; FD_RAW_NEED_SEEK;
raw_cmd->cmd_count = NR_RW; raw_cmd->cmd_count = NR_RW;
if (rq_data_dir(CURRENT) == READ) { if (rq_data_dir(current_req) == READ) {
raw_cmd->flags |= FD_RAW_READ; raw_cmd->flags |= FD_RAW_READ;
COMMAND = FM_MODE(_floppy,FD_READ); COMMAND = FM_MODE(_floppy,FD_READ);
} else if (rq_data_dir(CURRENT) == WRITE){ } else if (rq_data_dir(current_req) == WRITE){
raw_cmd->flags |= FD_RAW_WRITE; raw_cmd->flags |= FD_RAW_WRITE;
COMMAND = FM_MODE(_floppy,FD_WRITE); COMMAND = FM_MODE(_floppy,FD_WRITE);
} else { } else {
...@@ -2656,10 +2655,10 @@ static int make_raw_rw_request(void) ...@@ -2656,10 +2655,10 @@ static int make_raw_rw_request(void)
max_sector = _floppy->sect * _floppy->head; max_sector = _floppy->sect * _floppy->head;
TRACK = CURRENT->sector / max_sector; TRACK = current_req->sector / max_sector;
fsector_t = CURRENT->sector % max_sector; fsector_t = current_req->sector % max_sector;
if (_floppy->track && TRACK >= _floppy->track) { if (_floppy->track && TRACK >= _floppy->track) {
if (CURRENT->current_nr_sectors & 1) { if (current_req->current_nr_sectors & 1) {
current_count_sectors = 1; current_count_sectors = 1;
return 1; return 1;
} else } else
...@@ -2676,7 +2675,7 @@ static int make_raw_rw_request(void) ...@@ -2676,7 +2675,7 @@ static int make_raw_rw_request(void)
max_sector = 2 * _floppy->sect / 3; max_sector = 2 * _floppy->sect / 3;
if (fsector_t >= max_sector){ if (fsector_t >= max_sector){
current_count_sectors = minimum(_floppy->sect - fsector_t, current_count_sectors = minimum(_floppy->sect - fsector_t,
CURRENT->nr_sectors); current_req->nr_sectors);
return 1; return 1;
} }
SIZECODE = 2; SIZECODE = 2;
...@@ -2727,7 +2726,7 @@ static int make_raw_rw_request(void) ...@@ -2727,7 +2726,7 @@ static int make_raw_rw_request(void)
in_sector_offset = (fsector_t % _floppy->sect) % ssize; in_sector_offset = (fsector_t % _floppy->sect) % ssize;
aligned_sector_t = fsector_t - in_sector_offset; aligned_sector_t = fsector_t - in_sector_offset;
max_size = CURRENT->nr_sectors; max_size = current_req->nr_sectors;
if ((raw_cmd->track == buffer_track) && if ((raw_cmd->track == buffer_track) &&
(current_drive == buffer_drive) && (current_drive == buffer_drive) &&
(fsector_t >= buffer_min) && (fsector_t < buffer_max)) { (fsector_t >= buffer_min) && (fsector_t < buffer_max)) {
...@@ -2736,10 +2735,10 @@ static int make_raw_rw_request(void) ...@@ -2736,10 +2735,10 @@ static int make_raw_rw_request(void)
copy_buffer(1, max_sector, buffer_max); copy_buffer(1, max_sector, buffer_max);
return 1; return 1;
} }
} else if (in_sector_offset || CURRENT->nr_sectors < ssize){ } else if (in_sector_offset || current_req->nr_sectors < ssize){
if (CT(COMMAND) == FD_WRITE){ if (CT(COMMAND) == FD_WRITE){
if (fsector_t + CURRENT->nr_sectors > ssize && if (fsector_t + current_req->nr_sectors > ssize &&
fsector_t + CURRENT->nr_sectors < ssize + ssize) fsector_t + current_req->nr_sectors < ssize + ssize)
max_size = ssize + ssize; max_size = ssize + ssize;
else else
max_size = ssize; max_size = ssize;
...@@ -2747,7 +2746,7 @@ static int make_raw_rw_request(void) ...@@ -2747,7 +2746,7 @@ static int make_raw_rw_request(void)
raw_cmd->flags &= ~FD_RAW_WRITE; raw_cmd->flags &= ~FD_RAW_WRITE;
raw_cmd->flags |= FD_RAW_READ; raw_cmd->flags |= FD_RAW_READ;
COMMAND = FM_MODE(_floppy,FD_READ); COMMAND = FM_MODE(_floppy,FD_READ);
} else if ((unsigned long)CURRENT->buffer < MAX_DMA_ADDRESS) { } else if ((unsigned long)current_req->buffer < MAX_DMA_ADDRESS) {
unsigned long dma_limit; unsigned long dma_limit;
int direct, indirect; int direct, indirect;
...@@ -2759,14 +2758,14 @@ static int make_raw_rw_request(void) ...@@ -2759,14 +2758,14 @@ static int make_raw_rw_request(void)
* on a 64 bit machine! * on a 64 bit machine!
*/ */
max_size = buffer_chain_size(); max_size = buffer_chain_size();
dma_limit = (MAX_DMA_ADDRESS - ((unsigned long) CURRENT->buffer)) >> 9; dma_limit = (MAX_DMA_ADDRESS - ((unsigned long) current_req->buffer)) >> 9;
if ((unsigned long) max_size > dma_limit) { if ((unsigned long) max_size > dma_limit) {
max_size = dma_limit; max_size = dma_limit;
} }
/* 64 kb boundaries */ /* 64 kb boundaries */
if (CROSS_64KB(CURRENT->buffer, max_size << 9)) if (CROSS_64KB(current_req->buffer, max_size << 9))
max_size = (K_64 - max_size = (K_64 -
((unsigned long)CURRENT->buffer) % K_64)>>9; ((unsigned long)current_req->buffer) % K_64)>>9;
direct = transfer_size(ssize,max_sector,max_size) - fsector_t; direct = transfer_size(ssize,max_sector,max_size) - fsector_t;
/* /*
* We try to read tracks, but if we get too many errors, we * We try to read tracks, but if we get too many errors, we
...@@ -2780,9 +2779,9 @@ static int make_raw_rw_request(void) ...@@ -2780,9 +2779,9 @@ static int make_raw_rw_request(void)
*errors < DP->max_errors.read_track && *errors < DP->max_errors.read_track &&
/*!TESTF(FD_NEED_TWADDLE) &&*/ /*!TESTF(FD_NEED_TWADDLE) &&*/
((!probing || (DP->read_track&(1<<DRS->probed_format)))))){ ((!probing || (DP->read_track&(1<<DRS->probed_format)))))){
max_size = CURRENT->nr_sectors; max_size = current_req->nr_sectors;
} else { } else {
raw_cmd->kernel_data = CURRENT->buffer; raw_cmd->kernel_data = current_req->buffer;
raw_cmd->length = current_count_sectors << 9; raw_cmd->length = current_count_sectors << 9;
if (raw_cmd->length == 0){ if (raw_cmd->length == 0){
DPRINT("zero dma transfer attempted from make_raw_request\n"); DPRINT("zero dma transfer attempted from make_raw_request\n");
...@@ -2808,7 +2807,7 @@ static int make_raw_rw_request(void) ...@@ -2808,7 +2807,7 @@ static int make_raw_rw_request(void)
fsector_t > buffer_max || fsector_t > buffer_max ||
fsector_t < buffer_min || fsector_t < buffer_min ||
((CT(COMMAND) == FD_READ || ((CT(COMMAND) == FD_READ ||
(!in_sector_offset && CURRENT->nr_sectors >= ssize))&& (!in_sector_offset && current_req->nr_sectors >= ssize))&&
max_sector > 2 * max_buffer_sectors + buffer_min && max_sector > 2 * max_buffer_sectors + buffer_min &&
max_size + fsector_t > 2 * max_buffer_sectors + buffer_min) max_size + fsector_t > 2 * max_buffer_sectors + buffer_min)
/* not enough space */){ /* not enough space */){
...@@ -2843,7 +2842,7 @@ static int make_raw_rw_request(void) ...@@ -2843,7 +2842,7 @@ static int make_raw_rw_request(void)
/*check_dma_crossing(raw_cmd->kernel_data, raw_cmd->length, /*check_dma_crossing(raw_cmd->kernel_data, raw_cmd->length,
"end of make_raw_request");*/ "end of make_raw_request");*/
if ((raw_cmd->length < current_count_sectors << 9) || if ((raw_cmd->length < current_count_sectors << 9) ||
(raw_cmd->kernel_data != CURRENT->buffer && (raw_cmd->kernel_data != current_req->buffer &&
CT(COMMAND) == FD_WRITE && CT(COMMAND) == FD_WRITE &&
(aligned_sector_t + (raw_cmd->length >> 9) > buffer_max || (aligned_sector_t + (raw_cmd->length >> 9) > buffer_max ||
aligned_sector_t < buffer_min)) || aligned_sector_t < buffer_min)) ||
...@@ -2851,7 +2850,7 @@ static int make_raw_rw_request(void) ...@@ -2851,7 +2850,7 @@ static int make_raw_rw_request(void)
raw_cmd->length <= 0 || current_count_sectors <= 0){ raw_cmd->length <= 0 || current_count_sectors <= 0){
DPRINT("fractionary current count b=%lx s=%lx\n", DPRINT("fractionary current count b=%lx s=%lx\n",
raw_cmd->length, current_count_sectors); raw_cmd->length, current_count_sectors);
if (raw_cmd->kernel_data != CURRENT->buffer) if (raw_cmd->kernel_data != current_req->buffer)
printk("addr=%d, length=%ld\n", printk("addr=%d, length=%ld\n",
(int) ((raw_cmd->kernel_data - (int) ((raw_cmd->kernel_data -
floppy_track_buffer) >> 9), floppy_track_buffer) >> 9),
...@@ -2868,7 +2867,7 @@ static int make_raw_rw_request(void) ...@@ -2868,7 +2867,7 @@ static int make_raw_rw_request(void)
return 0; return 0;
} }
if (raw_cmd->kernel_data != CURRENT->buffer){ if (raw_cmd->kernel_data != current_req->buffer){
if (raw_cmd->kernel_data < floppy_track_buffer || if (raw_cmd->kernel_data < floppy_track_buffer ||
current_count_sectors < 0 || current_count_sectors < 0 ||
raw_cmd->length < 0 || raw_cmd->length < 0 ||
...@@ -2886,8 +2885,8 @@ static int make_raw_rw_request(void) ...@@ -2886,8 +2885,8 @@ static int make_raw_rw_request(void)
printk("write\n"); printk("write\n");
return 0; return 0;
} }
} else if (raw_cmd->length > CURRENT->nr_sectors << 9 || } else if (raw_cmd->length > current_req->nr_sectors << 9 ||
current_count_sectors > CURRENT->nr_sectors){ current_count_sectors > current_req->nr_sectors){
DPRINT("buffer overrun in direct transfer\n"); DPRINT("buffer overrun in direct transfer\n");
return 0; return 0;
} else if (raw_cmd->length < current_count_sectors << 9){ } else if (raw_cmd->length < current_count_sectors << 9){
...@@ -2916,21 +2915,21 @@ static void redo_fd_request(void) ...@@ -2916,21 +2915,21 @@ static void redo_fd_request(void)
floppy_off(current_drive); floppy_off(current_drive);
for (;;) { for (;;) {
if (!CURRENT) { if (!current_req) {
struct request *req = elv_next_request(QUEUE); struct request *req = elv_next_request(QUEUE);
if (!req) { if (!req) {
do_floppy = NULL; do_floppy = NULL;
unlock_fdc(); unlock_fdc();
return; return;
} }
CURRENT = req; current_req = req;
} }
if (major(CURRENT->rq_dev) != MAJOR_NR) if (major(current_req->rq_dev) != MAJOR_NR)
panic(DEVICE_NAME ": request list destroyed"); panic(DEVICE_NAME ": request list destroyed");
device = CURRENT->rq_dev; device = current_req->rq_dev;
set_fdc(DRIVE(device)); set_fdc(DRIVE(device));
reschedule_timeout(CURRENTD, "redo fd request", 0); reschedule_timeout(current_reqD, "redo fd request", 0);
set_floppy(device); set_floppy(device);
raw_cmd = & default_raw_cmd; raw_cmd = & default_raw_cmd;
...@@ -2955,7 +2954,7 @@ static void redo_fd_request(void) ...@@ -2955,7 +2954,7 @@ static void redo_fd_request(void)
_floppy = floppy_type+DP->autodetect[DRS->probed_format]; _floppy = floppy_type+DP->autodetect[DRS->probed_format];
} else } else
probing = 0; probing = 0;
errors = & (CURRENT->errors); errors = & (current_req->errors);
tmp = make_raw_rw_request(); tmp = make_raw_rw_request();
if (tmp < 2){ if (tmp < 2){
request_done(tmp); request_done(tmp);
...@@ -2993,8 +2992,8 @@ static void do_fd_request(request_queue_t * q) ...@@ -2993,8 +2992,8 @@ static void do_fd_request(request_queue_t * q)
} }
if (usage_count == 0) { if (usage_count == 0) {
printk("warning: usage count=0, CURRENT=%p exiting\n", CURRENT); printk("warning: usage count=0, current_req=%p exiting\n", current_req);
printk("sect=%ld flags=%lx\n", CURRENT->sector, CURRENT->flags); printk("sect=%ld flags=%lx\n", current_req->sector, current_req->flags);
return; return;
} }
if (fdc_busy){ if (fdc_busy){
......
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