From: Monty Montgomery <[EMAIL PROTECTED]>

Greg, the next few patches are for previously requested fixes.

This patch eliminates fstn leakage on controller driver shutdown.  The
visible effect is to eliminate 'dma_pool_destroy ehci_fstn, xxxxxxxx
busy' messages on ehci-hcd module removal.

Patch is against 2.6.19-rc6-mm2; sent as attachment due to Gmail's
now-well-known proclivity for reformatting mesage bodies and
destroying patches.

Signed-off-by: Monty Montgomery <[EMAIL PROTECTED]>
diff -uprN -X a/Documentation/dontdiff a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c
--- a/drivers/usb/host/ehci-mem.c	2006-11-30 01:04:52.000000000 -0500
+++ b/drivers/usb/host/ehci-mem.c	2006-11-30 14:45:43.000000000 -0500
@@ -155,6 +155,7 @@ static inline void qh_put (struct ehci_q
 
 static void ehci_mem_cleanup (struct ehci_hcd *ehci)
 {
+	int i;
 	if (ehci->async)
 		qh_put (ehci->async);
 	ehci->async = NULL;
@@ -164,6 +165,17 @@ static void ehci_mem_cleanup (struct ehc
 		dma_pool_destroy (ehci->qtd_pool);
 	ehci->qtd_pool = NULL;
 
+	/* previously used FSTNs are all cached; free them */
+	if(ehci->periodic_save_fstns){
+		for(i=0;i<PERIODIC_QH_MAX_PERIOD;i++)
+			if(ehci->periodic_save_fstns[i])
+				ehci_fstn_free(ehci,ehci->periodic_save_fstns[i]);
+		kfree(ehci->periodic_save_fstns);
+	}
+	
+	if(ehci->periodic_restore_fstn)
+		ehci_fstn_free(ehci,ehci->periodic_restore_fstn);
+	
 	if (ehci->fstn_pool)
 		dma_pool_destroy (ehci->fstn_pool);
 	ehci->fstn_pool = NULL;
@@ -187,8 +199,6 @@ static void ehci_mem_cleanup (struct ehc
 			ehci->periodic, ehci->periodic_dma);
 	ehci->periodic = NULL;
 
-	if(ehci->periodic_save_fstns)
-		kfree(ehci->periodic_save_fstns);
 	if(ehci->budget)
 		kfree(ehci->budget);
 	ehci->budget = NULL;
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to