From: viro@parcelfarce.linux.theplanet.co.uk

Equivalent transformation:
	call of pi_do_claimed() in run_fsm() expanded; recursive
	call of run_fsm() replaced with loop.



---

 25-akpm/drivers/block/paride/pd.c |   32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)

diff -puN drivers/block/paride/pd.c~PI13-run_fsm-loop-RC1 drivers/block/paride/pd.c
--- 25/drivers/block/paride/pd.c~PI13-run_fsm-loop-RC1	Wed Jan 14 13:46:20 2004
+++ 25-akpm/drivers/block/paride/pd.c	Wed Jan 14 13:46:20 2004
@@ -215,21 +215,25 @@ static struct request *pd_req;	/* curren
 
 static void run_fsm(void)
 {
-	enum action res;
+	while (1) {
+		enum action res;
 
-	switch(res = phase()) {
-		case Ok: case Fail:
-			pi_unclaim(pi_current);
-			next_request(res);
-			break;
-		case Wait:
-			pi_unclaim(pi_current);
-			/* fallthrough */
-		case Claim:
-			pi_do_claimed(pi_current, run_fsm);
-			break;
-		case Hold:
-			ps_set_intr();
+		switch(res = phase()) {
+			case Ok: case Fail:
+				pi_unclaim(pi_current);
+				next_request(res);
+				return;
+			case Wait:
+				pi_unclaim(pi_current);
+				/* fallthrough */
+			case Claim:
+				if (!pi_schedule_claimed(pi_current, run_fsm))
+					return;
+				break;
+			case Hold:
+				ps_set_intr();
+				return;
+		}
 	}
 }
 

_