


---

 25-akpm/drivers/char/hpet.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff -puN drivers/char/hpet.c~hpet-free_irq-deadlock-fix drivers/char/hpet.c
--- 25/drivers/char/hpet.c~hpet-free_irq-deadlock-fix	2004-05-20 23:53:44.731699728 -0700
+++ 25-akpm/drivers/char/hpet.c	2004-05-20 23:55:14.215096184 -0700
@@ -285,6 +285,7 @@ static int hpet_release(struct inode *in
 {
 	struct hpet_dev *devp;
 	struct hpet_timer *timer;
+	int irq = 0;
 
 	devp = file->private_data;
 	timer = devp->hd_timer;
@@ -294,10 +295,8 @@ static int hpet_release(struct inode *in
 	writeq((readq(&timer->hpet_config) & ~Tn_INT_ENB_CNF_MASK),
 	       &timer->hpet_config);
 
-	if (devp->hd_irq) {
-		free_irq(devp->hd_irq, devp);
-		devp->hd_irq = 0;
-	}
+	irq = devp->hd_irq;
+	devp->hd_irq = 0;
 
 	devp->hd_ireqfreq = 0;
 
@@ -313,6 +312,9 @@ static int hpet_release(struct inode *in
 	devp->hd_flags &= ~(HPET_OPEN | HPET_IE | HPET_PERIODIC);
 	spin_unlock_irq(&hpet_lock);
 
+	if (irq)
+		free_irq(irq, devp);
+
 	if (file->f_flags & FASYNC)
 		hpet_fasync(-1, file, 0);
 

_
