Skip to contentSkip to conversation

drivers/cdrom/sjcd.c check_region() fix

PATCH In review Omkhar Arasaratnam 2 participants 4 messages Dec 29, 2003 – Dec 30, 2003

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/cdrom/sjcd.c check_region() fix

Here is another check_region fix, this time for sjcd.c

cdrom/sjcd.c renamed from usr/src/linux-2.6.0/drivers/cdrom/sjcd.c +2 -1
@@ -1700,12 +1700,13 @@
 	sprintf(sjcd_disk->disk_name, "sjcd");
 	sprintf(sjcd_disk->devfs_name, "sjcd");
 
-	if (check_region(sjcd_base, 4)) {
+	if (!request_region(sjcd_base, 4,"sjcd")) {
 		printk
 		    ("SJCD: Init failed, I/O port (%X) is already in use\n",
 		     sjcd_base);
 		goto out2;
 	}
+	release_region(sjcd_base,4);
 
 	/*
 	 * Check for card. Since we are booting now, we can't use standard
#1 lore raw
Quoted 17 lines · Omkhar Arasaratnam

Here is another check_region fix, this time for sjcd.c

--- /usr/src/linux-2.6.0/drivers/cdrom/sjcd.c 2003-12-17
21:59:05.000000000 -0500 +++ drivers/cdrom/sjcd.c 2003-12-29
14:52:05.000000000 -0500 @@ -1700,12 +1700,13 @@

	sprintf(sjcd_disk->disk_name, "sjcd");
	sprintf(sjcd_disk->devfs_name, "sjcd");
cdrom/sjcd.c renamed from usr/src/linux-2.6.0/drivers/cdrom/sjcd.c +1 -1
-	if (check_region(sjcd_base, 4)) {
+	if (!request_region(sjcd_base, 4,"sjcd")) {
		printk
		    ("SJCD: Init failed, I/O port (%X) is already in use\n",
		     sjcd_base);
		goto out2;
	}
cdrom/sjcd.c renamed from usr/src/linux-2.6.0/drivers/cdrom/sjcd.c +1 -0
+	release_region(sjcd_base,4);
Quoted 2 lines
	/*
	 * Check for card. Since we are booting now, we can't use standard

I've got two of those check_region() warnings in advansys.c.

Would it be appropriate to do a similar fix to it?

Quoted 5 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 7 lines
Cheers, Gene
AMD K6-III@500mhz 320M
Athlon1600XP@1400mhz  512M
99.22% setiathome rank, not too shabby for a WV hillbilly
Yahoo.com attornies please note, additions to this message
by Gene Heskett are:
Copyright 2003 by Maurice Eugene Heskett, all rights reserved.
#2 lore raw
Quoted 18 lines · Gene Heskett
Quoted 17 lines · Omkhar Arasaratnam

Here is another check_region fix, this time for sjcd.c

--- /usr/src/linux-2.6.0/drivers/cdrom/sjcd.c 2003-12-17
21:59:05.000000000 -0500 +++ drivers/cdrom/sjcd.c 2003-12-29
14:52:05.000000000 -0500 @@ -1700,12 +1700,13 @@

	sprintf(sjcd_disk->disk_name, "sjcd");
	sprintf(sjcd_disk->devfs_name, "sjcd");
(quoted diff) +1 -1
-	if (check_region(sjcd_base, 4)) {
+	if (!request_region(sjcd_base, 4,"sjcd")) {
		printk
		    ("SJCD: Init failed, I/O port (%X) is already in use\n",
		     sjcd_base);
		goto out2;
	}
(quoted diff) +1 -0
+	release_region(sjcd_base,4);
Quoted 6 lines
Quoted 2 lines
	/*
	 * Check for card. Since we are booting now, we can't use standard

I've got two of those check_region() warnings in advansys.c.

Would it be appropriate to do a similar fix to it?

Believe it or not I was actually working on advant.c as well. That's a big file. I was going to leave it till the AM to post after doing a final sanity check (it's almost 2am local time :)
I believe this _should_ work - perhaps you can advise if line 5390 (after applying my patch) will fail because of a duplicate request_region()... Either way here is my patch:

drivers/scsi/advansys.c renamed from drivers/scsi/advansys.c.org +6 -3
@@ -4619,7 +4619,7 @@
                         ASC_DBG1(1,
                                 "advansys_detect: probing I/O port 0x%x...\n",
                             iop);
-                        if (check_region(iop, ASC_IOADR_GAP) != 0) {
+                        if (!request_region(iop, ASC_IOADR_GAP, "advansys")) {
                             printk(
 "AdvanSys SCSI: specified I/O Port 0x%X is busy\n", iop);
                             /* Don't try this I/O port twice. */
@@ -4630,6 +4630,7 @@
 "AdvanSys SCSI: specified I/O Port 0x%X has no adapter\n", iop);
                             /* Don't try this I/O port twice. */
                             asc_ioport[ioport] = 0;
+			    release_region(iop, ASC_IOADR_GAP);
                             goto ioport_try_again;
                         } else {
                             /*
@@ -4647,6 +4648,7 @@
                                   * 'ioport' past this board.
                                   */
                                  ioport++;
+				 release_region(iop, ASC_IOADR_GAP);
                                  goto ioport_try_again;
                             }
                         }
@@ -10003,10 +10005,11 @@
     }
     for (; i < ASC_IOADR_TABLE_MAX_IX; i++) {
         iop_base = _asc_def_iop_base[i];
-        if (check_region(iop_base, ASC_IOADR_GAP) != 0) {
+        if (!request_region(iop_base, ASC_IOADR_GAP, "advansys")) {
             ASC_DBG1(1,
-               "AscSearchIOPortAddr11: check_region() failed I/O port 0x%x\n",
+               "AscSearchIOPortAddr11: request_region() failed I/O port 0x%x\n",
                      iop_base);
+	    release_region(iop_base, ASC_IOADR_GAP);
             continue;
         }
         ASC_DBG1(1, "AscSearchIOPortAddr11: probing I/O port 0x%x\n", iop_base);

O

#3 lore raw
Quoted 25 lines · Omkhar Arasaratnam
Quoted 24 lines · Gene Heskett
Quoted 17 lines · Omkhar Arasaratnam

Here is another check_region fix, this time for sjcd.c

--- /usr/src/linux-2.6.0/drivers/cdrom/sjcd.c 2003-12-17
21:59:05.000000000 -0500 +++ drivers/cdrom/sjcd.c 2003-12-29
14:52:05.000000000 -0500 @@ -1700,12 +1700,13 @@

	sprintf(sjcd_disk->disk_name, "sjcd");
	sprintf(sjcd_disk->devfs_name, "sjcd");
(quoted diff) +1 -1
-	if (check_region(sjcd_base, 4)) {
+	if (!request_region(sjcd_base, 4,"sjcd")) {
		printk
		    ("SJCD: Init failed, I/O port (%X) is already in use\n",
		     sjcd_base);
		goto out2;
	}
(quoted diff) +1 -0
+	release_region(sjcd_base,4);
Quoted 3 lines
	/*
	 * Check for card. Since we are booting now, we can't use

standard

I've got two of those check_region() warnings in advansys.c.

Quoted 5 lines
Quoted 1 line

Would it be appropriate to do a similar fix to it?

Believe it or not I was actually working on advant.c as well. That's a big file. I was going to leave it till the AM to post after doing a final sanity check (it's almost 2am local time :)

Humm, 2:26am here...

Quoted 4 lines

I believe this
_should_ work - perhaps you can advise if line 5390 (after applying my patch) will fail because of a duplicate request_region()... Either way here is my patch:

I'll give it a try sometime tomorrow, many thanks! But tonight I'm running out of eyeballs.

Signature · 7 lines
Cheers, Gene
AMD K6-III@500mhz 320M
Athlon1600XP@1400mhz  512M
99.22% setiathome rank, not too shabby for a WV hillbilly
Yahoo.com attornies please note, additions to this message
by Gene Heskett are:
Copyright 2003 by Maurice Eugene Heskett, all rights reserved.