Commit 4542c37e authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

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

Moved calls of ->connect and ->disconnect into run_fsm().  The only
change is that now do_pd_start_io() is ran when we are connected.
parent 3b4de4f2
...@@ -229,15 +229,19 @@ static void run_fsm(void) ...@@ -229,15 +229,19 @@ static void run_fsm(void)
phase = do_pd_io_start; phase = do_pd_io_start;
} }
if (!pd_claimed) { switch (pd_claimed) {
pd_claimed = 1; case 0:
if (!pi_schedule_claimed(pi_current, run_fsm)) pd_claimed = 1;
return; if (!pi_schedule_claimed(pi_current, run_fsm))
return;
case 1:
pd_claimed = 2;
pi_current->proto->connect(pi_current);
} }
switch(res = phase()) { switch(res = phase()) {
case Ok: case Fail: case Ok: case Fail:
pi_unclaim(pi_current); pi_disconnect(pi_current);
pd_claimed = 0; pd_claimed = 0;
phase = NULL; phase = NULL;
spin_lock_irqsave(&pd_lock, saved_flags); spin_lock_irqsave(&pd_lock, saved_flags);
...@@ -252,7 +256,7 @@ static void run_fsm(void) ...@@ -252,7 +256,7 @@ static void run_fsm(void)
ps_set_intr(); ps_set_intr();
return; return;
case Wait: case Wait:
pi_unclaim(pi_current); pi_disconnect(pi_current);
pd_claimed = 0; pd_claimed = 0;
} }
} }
...@@ -840,9 +844,7 @@ static enum action do_pd_io_start(void) ...@@ -840,9 +844,7 @@ static enum action do_pd_io_start(void)
static enum action do_pd_read_start(void) static enum action do_pd_read_start(void)
{ {
pi_current->proto->connect(pi_current);
if (pd_wait_for(pd_current, STAT_READY, "do_pd_read") & STAT_ERR) { if (pd_wait_for(pd_current, STAT_READY, "do_pd_read") & STAT_ERR) {
pi_current->proto->disconnect(pi_current);
if (pd_retries < PD_MAX_RETRIES) { if (pd_retries < PD_MAX_RETRIES) {
pd_retries++; pd_retries++;
return Wait; return Wait;
...@@ -862,7 +864,6 @@ static enum action do_pd_read_drq(void) ...@@ -862,7 +864,6 @@ static enum action do_pd_read_drq(void)
while (1) { while (1) {
if (pd_wait_for(pd_current, STAT_DRQ, "do_pd_read_drq") & STAT_ERR) { if (pd_wait_for(pd_current, STAT_DRQ, "do_pd_read_drq") & STAT_ERR) {
pi_current->proto->disconnect(pi_current);
if (pd_retries < PD_MAX_RETRIES) { if (pd_retries < PD_MAX_RETRIES) {
pd_retries++; pd_retries++;
phase = do_pd_read_start; phase = do_pd_read_start;
...@@ -874,15 +875,12 @@ static enum action do_pd_read_drq(void) ...@@ -874,15 +875,12 @@ static enum action do_pd_read_drq(void)
if (pd_next_buf()) if (pd_next_buf())
break; break;
} }
pi_current->proto->disconnect(pi_current);
return Ok; return Ok;
} }
static enum action do_pd_write_start(void) static enum action do_pd_write_start(void)
{ {
pi_current->proto->connect(pi_current);
if (pd_wait_for(pd_current, STAT_READY, "do_pd_write") & STAT_ERR) { if (pd_wait_for(pd_current, STAT_READY, "do_pd_write") & STAT_ERR) {
pi_current->proto->disconnect(pi_current);
if (pd_retries < PD_MAX_RETRIES) { if (pd_retries < PD_MAX_RETRIES) {
pd_retries++; pd_retries++;
return Wait; return Wait;
...@@ -892,7 +890,6 @@ static enum action do_pd_write_start(void) ...@@ -892,7 +890,6 @@ static enum action do_pd_write_start(void)
pd_ide_command(pd_current, IDE_WRITE, pd_block, pd_run); pd_ide_command(pd_current, IDE_WRITE, pd_block, pd_run);
while (1) { while (1) {
if (pd_wait_for(pd_current, STAT_DRQ, "do_pd_write_drq") & STAT_ERR) { if (pd_wait_for(pd_current, STAT_DRQ, "do_pd_write_drq") & STAT_ERR) {
pi_current->proto->disconnect(pi_current);
if (pd_retries < PD_MAX_RETRIES) { if (pd_retries < PD_MAX_RETRIES) {
pd_retries++; pd_retries++;
return Wait; return Wait;
...@@ -914,7 +911,6 @@ static enum action do_pd_write_done(void) ...@@ -914,7 +911,6 @@ static enum action do_pd_write_done(void)
return Hold; return Hold;
if (pd_wait_for(pd_current, STAT_READY, "do_pd_write_done") & STAT_ERR) { if (pd_wait_for(pd_current, STAT_READY, "do_pd_write_done") & STAT_ERR) {
pi_current->proto->disconnect(pi_current);
if (pd_retries < PD_MAX_RETRIES) { if (pd_retries < PD_MAX_RETRIES) {
pd_retries++; pd_retries++;
phase = do_pd_write_start; phase = do_pd_write_start;
...@@ -922,7 +918,6 @@ static enum action do_pd_write_done(void) ...@@ -922,7 +918,6 @@ static enum action do_pd_write_done(void)
} }
return Fail; return Fail;
} }
pi_current->proto->disconnect(pi_current);
return Ok; return Ok;
} }
......
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