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

[PATCH] paride cleanup and fixes (7/25)

Equivalent transformation:
	Handling of bogus requests taken into do_pd_io_start() - we
	call next_request(0) as we would for any other error.  We
	need to call pi_unclaim() before that - on other paths that
	would happen as a side effect of pi_disconnect().
	Setting variables moved into do_pd_io_start() - they don't
	need pd_lock being held, so we can shift that outside.
parent b2e1ca59
......@@ -140,7 +140,7 @@ static void pi_claim(PIA * pi)
#endif
}
static void pi_unclaim(PIA * pi)
void pi_unclaim(PIA * pi)
{
pi->claimed = 0;
#ifdef CONFIG_PARPORT
......@@ -149,6 +149,8 @@ static void pi_unclaim(PIA * pi)
#endif
}
EXPORT_SYMBOL(pi_unclaim);
void pi_connect(PIA * pi)
{
pi_claim(pi);
......
......@@ -88,6 +88,8 @@ extern void pi_write_block(PIA *pi, char * buf, int count);
extern void pi_read_block(PIA *pi, char * buf, int count);
extern void pi_unclaim(PIA *pi);
extern void pi_connect(PIA *pi);
extern void pi_disconnect(PIA *pi);
......
......@@ -744,30 +744,13 @@ static int pd_ready(void)
static void do_pd_request1(request_queue_t * q)
{
repeat:
pd_req = elv_next_request(q);
if (!pd_req)
return;
pd_block = pd_req->sector;
pd_run = pd_req->nr_sectors;
pd_count = pd_req->current_nr_sectors;
pd_current = pd_req->rq_disk->private_data;
if (pd_block + pd_count > get_capacity(pd_req->rq_disk)) {
end_request(pd_req, 0);
goto repeat;
}
pd_cmd = rq_data_dir(pd_req);
pd_buf = pd_req->buffer;
pd_retries = 0;
if (pd_cmd == READ || pd_cmd == WRITE)
pi_do_claimed(pd_current->pi, do_pd_io);
else {
end_request(pd_req, 0);
goto repeat;
}
pi_do_claimed(pd_current->pi, do_pd_io);
}
static void do_pd_request(request_queue_t * q)
......@@ -815,10 +798,26 @@ static void do_pd_io(void)
static void do_pd_io_start(void)
{
pd_block = pd_req->sector;
pd_run = pd_req->nr_sectors;
pd_count = pd_req->current_nr_sectors;
if (pd_block + pd_count > get_capacity(pd_req->rq_disk)) {
pi_unclaim(pd_current->pi);
next_request(0);
return;
}
pd_cmd = rq_data_dir(pd_req);
pd_buf = pd_req->buffer;
pd_retries = 0;
if (pd_cmd == READ) {
do_pd_read_start();
} else {
} else if (pd_cmd == WRITE) {
do_pd_write_start();
} else {
pi_unclaim(pd_current->pi);
next_request(0);
}
}
......
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