ia64/xen-unstable

changeset 9701:2aa9e9867477

This fixes the state machine of the vTPM driver.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Apr 13 10:59:08 2006 +0100 (2006-04-13)
parents c9d706834d25
children cff23e96eae7
files linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c	Thu Apr 13 10:57:57 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c	Thu Apr 13 10:59:08 2006 +0100
     1.3 @@ -164,10 +164,10 @@ static void frontend_changed(struct xenb
     1.4  
     1.5  	switch (frontend_state) {
     1.6  	case XenbusStateInitialising:
     1.7 -	case XenbusStateConnected:
     1.8 +	case XenbusStateInitialised:
     1.9  		break;
    1.10  
    1.11 -	case XenbusStateInitialised:
    1.12 +	case XenbusStateConnected:
    1.13  		err = connect_ring(be);
    1.14  		if (err) {
    1.15  			return;
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c	Thu Apr 13 10:57:57 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c	Thu Apr 13 10:59:08 2006 +0100
     2.3 @@ -334,12 +334,6 @@ again:
     2.4  		goto abort_transaction;
     2.5  	}
     2.6  
     2.7 -	err = xenbus_printf(xbt, dev->nodename,
     2.8 -	                    "state", "%d", XenbusStateInitialised);
     2.9 -	if (err) {
    2.10 -		goto abort_transaction;
    2.11 -	}
    2.12 -
    2.13  	err = xenbus_transaction_end(xbt, 0);
    2.14  	if (err == -EAGAIN)
    2.15  		goto again;
    2.16 @@ -347,6 +341,9 @@ again:
    2.17  		xenbus_dev_fatal(dev, err, "completing transaction");
    2.18  		goto destroy_tpmring;
    2.19  	}
    2.20 +
    2.21 +	xenbus_switch_state(dev, XenbusStateConnected);
    2.22 +
    2.23  	return 0;
    2.24  
    2.25  abort_transaction:
    2.26 @@ -387,6 +384,7 @@ static void backend_changed(struct xenbu
    2.27  		if (tp->is_suspended == 0) {
    2.28  			device_unregister(&dev->dev);
    2.29  		}
    2.30 +		xenbus_switch_state(dev, XenbusStateClosed);
    2.31  		break;
    2.32  	}
    2.33  }
    2.34 @@ -439,6 +437,7 @@ static int tpmfront_suspend(struct xenbu
    2.35  
    2.36  	/* lock, so no app can send */
    2.37  	mutex_lock(&suspend_lock);
    2.38 +	xenbus_switch_state(dev, XenbusStateClosed);
    2.39  	tp->is_suspended = 1;
    2.40  
    2.41  	for (ctr = 0; atomic_read(&tp->tx_busy) && ctr <= 25; ctr++) {