From 3b4de4f2745b72242b22c9f8a6de343fd7058895 Mon Sep 17 00:00:00 2001 From: Alexander Viro Date: Wed, 4 Feb 2004 17:18:42 -0800 Subject: [PATCH] [PATCH] paride cleanup and fixes (17/25) Equivalent transformation: now that all phase functions are called claimed, we can simplify the logics around claiming - new variable (pd_claimed) keeps track of claim/unclaim we'd done. We check it in the beginning of the loop and do claiming if it's not set. --- drivers/block/paride/pd.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c index 5c68498b8d00f..b3b58b5db34cc 100644 --- a/drivers/block/paride/pd.c +++ b/drivers/block/paride/pd.c @@ -213,6 +213,7 @@ static struct pd_unit *pd_current; /* current request's drive */ static PIA *pi_current; /* current request's PIA */ static struct request *pd_req; /* current request */ static enum action do_pd_io_start(void); +static int pd_claimed; static struct request_queue *pd_queue; static void run_fsm(void) @@ -226,6 +227,10 @@ static void run_fsm(void) pd_current = pd_req->rq_disk->private_data; pi_current = pd_current->pi; phase = do_pd_io_start; + } + + if (!pd_claimed) { + pd_claimed = 1; if (!pi_schedule_claimed(pi_current, run_fsm)) return; } @@ -233,6 +238,7 @@ static void run_fsm(void) switch(res = phase()) { case Ok: case Fail: pi_unclaim(pi_current); + pd_claimed = 0; phase = NULL; spin_lock_irqsave(&pd_lock, saved_flags); end_request(pd_req, res); @@ -247,9 +253,7 @@ static void run_fsm(void) return; case Wait: pi_unclaim(pi_current); - if (!pi_schedule_claimed(pi_current, run_fsm)) - return; - break; + pd_claimed = 0; } } } -- 2.53.0