[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kernel-janitors
Subject:    [PATCH] region changes for rocket
From:       william stinson <wstinson () infonie ! fr>
Date:       2002-07-17 22:15:31
[Download RAW message or body]

Hi

this is a small patch for Rocketport device driver for Linux to
	1) remove two calls to check_region using request_region instead
       	2) release allocated region resource in case of error.

I don't have this hardware so compilation checked only. 
This patch does not remove all references to check_region in this driver (one \
reference still left unchanged).

Patch also available at the following URL:
        http://www.chez.com/wstinson/linux/kernel/patch-char-rocket

Comments and suggestions welcome

William Stinson (wstinson@infonie.fr) 

--- linux-2.5.26/drivers/char/rocket.c	Wed Jul 17 22:29:20 2002
+++ linux-local/drivers/char/rocket.c	Wed Jul 17 22:48:57 2002
@@ -1881,15 +1881,23 @@
 {
 	int	num_aiops, num_chan;
 	int	aiop, chan;
+	int     extent = 0;
 	unsigned int	aiopio[MAX_AIOPS_PER_BOARD];	
 	CONTROLLER_t	*ctlp;
 
 	if (rcktpt_io_addr[i] == 0)
 		return(0);
 
-	if (check_region(rcktpt_io_addr[i],64)) {
+	if (rcktpt_io_addr[i] + 0x40 == controller) {
+		*reserved_controller = 1;
+		extent = 68;
+	} else {
+		extent = 64;
+	}
+	if (!request_region(rcktpt_io_addr[i], extent,
+			    "Comtrol Rocketport")) {
 		printk("RocketPort board address 0x%lx in use...\n",
-			rcktpt_io_addr[i]);
+		       rcktpt_io_addr[i]);
 		rcktpt_io_addr[i] = 0;
 		return(0);
 	}
@@ -1901,6 +1909,7 @@
 				    aiopio, MAX_AIOPS_PER_BOARD, 0,
 				    FREQ_DIS, 0);
 	if (num_aiops <= 0) {
+		release_region(rcktpt_io_addr[i], extent);
 		rcktpt_io_addr[i] = 0;
 		return(0);
 	}
@@ -1914,14 +1923,6 @@
 	printk("Rocketport controller #%d found at 0x%lx, "
 	       "%d AIOPs\n", i, rcktpt_io_addr[i],
 	       num_aiops);
-	if (rcktpt_io_addr[i] + 0x40 == controller) {
-		*reserved_controller = 1;
-		request_region(rcktpt_io_addr[i], 68,
-				       "Comtrol Rocketport");
-	} else {
-		request_region(rcktpt_io_addr[i], 64,
-			       "Comtrol Rocketport");
-	}
 	return(1);
 }
 


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Kernel-janitor-discuss mailing list
Kernel-janitor-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kernel-janitor-discuss


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic