Commit d3230bfa authored by Jesper Juhl's avatar Jesper Juhl Committed by Linus Torvalds

[PATCH] isp16 check_region() removal

Convert check_region to request_region and clean up some parentheses in
return statements for drivers/cdrom/isp16.c.
Signed-off-by: default avatarJesper Juhl <juhl-lkml@dif.dk>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 2150328b
...@@ -16,6 +16,10 @@ ...@@ -16,6 +16,10 @@
* module_init & module_exit. * module_init & module_exit.
* Torben Mathiasen <tmm@image.dk> * Torben Mathiasen <tmm@image.dk>
* *
* 19 June 2004 -- check_region() converted to request_region()
* and return statement cleanups.
* Jesper Juhl <juhl-lkml@dif.dk>
*
* Detect cdrom interface on ISP16 sound card. * Detect cdrom interface on ISP16 sound card.
* Configure cdrom interface. * Configure cdrom interface.
* *
...@@ -118,17 +122,17 @@ int __init isp16_init(void) ...@@ -118,17 +122,17 @@ int __init isp16_init(void)
if (!strcmp(isp16_cdrom_type, "noisp16")) { if (!strcmp(isp16_cdrom_type, "noisp16")) {
printk("ISP16: no cdrom interface configured.\n"); printk("ISP16: no cdrom interface configured.\n");
return (0); return 0;
} }
if (check_region(ISP16_IO_BASE, ISP16_IO_SIZE)) { if (!request_region(ISP16_IO_BASE, ISP16_IO_SIZE, "isp16")) {
printk("ISP16: i/o ports already in use.\n"); printk("ISP16: i/o ports already in use.\n");
return (-EIO); goto out;
} }
if ((isp16_type = isp16_detect()) < 0) { if ((isp16_type = isp16_detect()) < 0) {
printk("ISP16: no cdrom interface found.\n"); printk("ISP16: no cdrom interface found.\n");
return (-EIO); goto cleanup_out;
} }
printk(KERN_INFO printk(KERN_INFO
...@@ -148,27 +152,32 @@ int __init isp16_init(void) ...@@ -148,27 +152,32 @@ int __init isp16_init(void)
else { else {
printk("ISP16: %s not supported by cdrom interface.\n", printk("ISP16: %s not supported by cdrom interface.\n",
isp16_cdrom_type); isp16_cdrom_type);
return (-EIO); goto cleanup_out;
} }
if (isp16_cdi_config(isp16_cdrom_base, expected_drive, if (isp16_cdi_config(isp16_cdrom_base, expected_drive,
isp16_cdrom_irq, isp16_cdrom_dma) < 0) { isp16_cdrom_irq, isp16_cdrom_dma) < 0) {
printk printk
("ISP16: cdrom interface has not been properly configured.\n"); ("ISP16: cdrom interface has not been properly configured.\n");
return (-EIO); goto cleanup_out;
} }
printk(KERN_INFO printk(KERN_INFO
"ISP16: cdrom interface set up with io base 0x%03X, irq %d, dma %d," "ISP16: cdrom interface set up with io base 0x%03X, irq %d, dma %d,"
" type %s.\n", isp16_cdrom_base, isp16_cdrom_irq, " type %s.\n", isp16_cdrom_base, isp16_cdrom_irq,
isp16_cdrom_dma, isp16_cdrom_type); isp16_cdrom_dma, isp16_cdrom_type);
return (0); return 0;
cleanup_out:
release_region(ISP16_IO_BASE, ISP16_IO_SIZE);
out:
return -EIO;
} }
static short __init isp16_detect(void) static short __init isp16_detect(void)
{ {
if (isp16_c929__detect() >= 0) if (isp16_c929__detect() >= 0)
return (2); return 2;
else else
return (isp16_c928__detect()); return (isp16_c928__detect());
} }
...@@ -206,7 +215,7 @@ static short __init isp16_c928__detect(void) ...@@ -206,7 +215,7 @@ static short __init isp16_c928__detect(void)
ISP16_OUT(ISP16_C928__ENABLE_PORT, enable_cdrom); ISP16_OUT(ISP16_C928__ENABLE_PORT, enable_cdrom);
} else { /* bits are not the same */ } else { /* bits are not the same */
ISP16_OUT(ISP16_CTRL_PORT, ctrl); ISP16_OUT(ISP16_CTRL_PORT, ctrl);
return (i); /* -> not detected: possibly incorrect conclusion */ return i; /* -> not detected: possibly incorrect conclusion */
} }
} else if (enable_cdrom == 0x20) } else if (enable_cdrom == 0x20)
i = 0; i = 0;
...@@ -215,7 +224,7 @@ static short __init isp16_c928__detect(void) ...@@ -215,7 +224,7 @@ static short __init isp16_c928__detect(void)
ISP16_OUT(ISP16_CTRL_PORT, ctrl); ISP16_OUT(ISP16_CTRL_PORT, ctrl);
return (i); return i;
} }
static short __init isp16_c929__detect(void) static short __init isp16_c929__detect(void)
...@@ -236,12 +245,12 @@ static short __init isp16_c929__detect(void) ...@@ -236,12 +245,12 @@ static short __init isp16_c929__detect(void)
tmp = ISP16_IN(ISP16_CTRL_PORT); tmp = ISP16_IN(ISP16_CTRL_PORT);
if (tmp != 2) /* isp16 with 82C929 not detected */ if (tmp != 2) /* isp16 with 82C929 not detected */
return (-1); return -1;
/* restore ctrl port value */ /* restore ctrl port value */
ISP16_OUT(ISP16_CTRL_PORT, ctrl); ISP16_OUT(ISP16_CTRL_PORT, ctrl);
return (2); return 2;
} }
static short __init static short __init
...@@ -272,7 +281,7 @@ isp16_cdi_config(int base, u_char drive_type, int irq, int dma) ...@@ -272,7 +281,7 @@ isp16_cdi_config(int base, u_char drive_type, int irq, int dma)
printk printk
("ISP16: base address 0x%03X not supported by cdrom interface.\n", ("ISP16: base address 0x%03X not supported by cdrom interface.\n",
base); base);
return (-1); return -1;
} }
switch (irq) { switch (irq) {
case 0: case 0:
...@@ -303,7 +312,7 @@ isp16_cdi_config(int base, u_char drive_type, int irq, int dma) ...@@ -303,7 +312,7 @@ isp16_cdi_config(int base, u_char drive_type, int irq, int dma)
default: default:
printk("ISP16: irq %d not supported by cdrom interface.\n", printk("ISP16: irq %d not supported by cdrom interface.\n",
irq); irq);
return (-1); return -1;
} }
switch (dma) { switch (dma) {
case 0: case 0:
...@@ -312,7 +321,7 @@ isp16_cdi_config(int base, u_char drive_type, int irq, int dma) ...@@ -312,7 +321,7 @@ isp16_cdi_config(int base, u_char drive_type, int irq, int dma)
case 1: case 1:
printk("ISP16: dma 1 cannot be used by cdrom interface," printk("ISP16: dma 1 cannot be used by cdrom interface,"
" due to conflict with the sound card.\n"); " due to conflict with the sound card.\n");
return (-1); return -1;
break; break;
case 3: case 3:
dma_code = ISP16_DMA_3; dma_code = ISP16_DMA_3;
...@@ -329,7 +338,7 @@ isp16_cdi_config(int base, u_char drive_type, int irq, int dma) ...@@ -329,7 +338,7 @@ isp16_cdi_config(int base, u_char drive_type, int irq, int dma)
default: default:
printk("ISP16: dma %d not supported by cdrom interface.\n", printk("ISP16: dma %d not supported by cdrom interface.\n",
dma); dma);
return (-1); return -1;
} }
if (drive_type != ISP16_SONY && drive_type != ISP16_PANASONIC0 && if (drive_type != ISP16_SONY && drive_type != ISP16_PANASONIC0 &&
...@@ -339,7 +348,7 @@ isp16_cdi_config(int base, u_char drive_type, int irq, int dma) ...@@ -339,7 +348,7 @@ isp16_cdi_config(int base, u_char drive_type, int irq, int dma)
printk printk
("ISP16: drive type (code 0x%02X) not supported by cdrom" ("ISP16: drive type (code 0x%02X) not supported by cdrom"
" interface.\n", drive_type); " interface.\n", drive_type);
return (-1); return -1;
} }
/* set type of interface */ /* set type of interface */
...@@ -354,7 +363,7 @@ isp16_cdi_config(int base, u_char drive_type, int irq, int dma) ...@@ -354,7 +363,7 @@ isp16_cdi_config(int base, u_char drive_type, int irq, int dma)
i = ISP16_IN(ISP16_IO_SET_PORT) & ISP16_IO_SET_MASK; /* keep some bits */ i = ISP16_IN(ISP16_IO_SET_PORT) & ISP16_IO_SET_MASK; /* keep some bits */
ISP16_OUT(ISP16_IO_SET_PORT, i | base_code | irq_code | dma_code); ISP16_OUT(ISP16_IO_SET_PORT, i | base_code | irq_code | dma_code);
return (0); return 0;
} }
void __exit isp16_exit(void) void __exit isp16_exit(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment