Commit 0f48bdd5 authored by Maximilian Attems's avatar Maximilian Attems Committed by Linus Torvalds

[PATCH] janitor: remove check_region from drivers/char/esp.c

Signed-off-by: default avatarMaximilian Attems <janitor@sternwelten.at>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ac9ebed4
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
#define NR_PORTS 64 /* maximum number of ports */ #define NR_PORTS 64 /* maximum number of ports */
#define NR_PRIMARY 8 /* maximum number of primary ports */ #define NR_PRIMARY 8 /* maximum number of primary ports */
#define REGION_SIZE 8 /* size of io region to request */
/* The following variables can be set by giving module options */ /* The following variables can be set by giving module options */
static int irq[NR_PRIMARY]; /* IRQ for each base port */ static int irq[NR_PRIMARY]; /* IRQ for each base port */
...@@ -2343,19 +2344,21 @@ static _INLINE_ void show_serial_version(void) ...@@ -2343,19 +2344,21 @@ static _INLINE_ void show_serial_version(void)
* This routine is called by espserial_init() to initialize a specific serial * This routine is called by espserial_init() to initialize a specific serial
* port. * port.
*/ */
static _INLINE_ int autoconfig(struct esp_struct * info, int *region_start) static _INLINE_ int autoconfig(struct esp_struct * info)
{ {
int port_detected = 0; int port_detected = 0;
unsigned long flags; unsigned long flags;
if (!request_region(info->port, REGION_SIZE, "esp serial"))
return -EIO;
save_flags(flags); cli(); save_flags(flags); cli();
/* /*
* Check for ESP card * Check for ESP card
*/ */
if (!check_region(info->port, 8) && if (serial_in(info, UART_ESI_BASE) == 0xf3) {
serial_in(info, UART_ESI_BASE) == 0xf3) {
serial_out(info, UART_ESI_CMD1, 0x00); serial_out(info, UART_ESI_CMD1, 0x00);
serial_out(info, UART_ESI_CMD1, 0x01); serial_out(info, UART_ESI_CMD1, 0x01);
...@@ -2371,19 +2374,6 @@ static _INLINE_ int autoconfig(struct esp_struct * info, int *region_start) ...@@ -2371,19 +2374,6 @@ static _INLINE_ int autoconfig(struct esp_struct * info, int *region_start)
info->irq = 4; info->irq = 4;
} }
if (ports && (ports->port == (info->port - 8))) {
release_region(*region_start,
info->port - *region_start);
} else
*region_start = info->port;
if (!request_region(*region_start,
info->port - *region_start + 8,
"esp serial"))
{
restore_flags(flags);
return -EIO;
}
/* put card in enhanced mode */ /* put card in enhanced mode */
/* this prevents access through */ /* this prevents access through */
...@@ -2396,6 +2386,8 @@ static _INLINE_ int autoconfig(struct esp_struct * info, int *region_start) ...@@ -2396,6 +2386,8 @@ static _INLINE_ int autoconfig(struct esp_struct * info, int *region_start)
serial_out(info, UART_ESI_CMD2, 0x00); serial_out(info, UART_ESI_CMD2, 0x00);
} }
} }
if (!port_detected)
release_region(info->port, REGION_SIZE);
restore_flags(flags); restore_flags(flags);
return (port_detected); return (port_detected);
...@@ -2429,7 +2421,6 @@ static struct tty_operations esp_ops = { ...@@ -2429,7 +2421,6 @@ static struct tty_operations esp_ops = {
int __init espserial_init(void) int __init espserial_init(void)
{ {
int i, offset; int i, offset;
int region_start;
struct esp_struct * info; struct esp_struct * info;
struct esp_struct *last_primary = NULL; struct esp_struct *last_primary = NULL;
int esp[] = {0x100,0x140,0x180,0x200,0x240,0x280,0x300,0x380}; int esp[] = {0x100,0x140,0x180,0x200,0x240,0x280,0x300,0x380};
...@@ -2515,7 +2506,7 @@ int __init espserial_init(void) ...@@ -2515,7 +2506,7 @@ int __init espserial_init(void)
info->irq = irq[i]; info->irq = irq[i];
info->line = (i * 8) + (offset / 8); info->line = (i * 8) + (offset / 8);
if (!autoconfig(info, &region_start)) { if (!autoconfig(info)) {
i++; i++;
offset = 0; offset = 0;
continue; continue;
...@@ -2591,7 +2582,6 @@ static void __exit espserial_exit(void) ...@@ -2591,7 +2582,6 @@ static void __exit espserial_exit(void)
{ {
unsigned long flags; unsigned long flags;
int e1; int e1;
unsigned int region_start, region_end;
struct esp_struct *temp_async; struct esp_struct *temp_async;
struct esp_pio_buffer *pio_buf; struct esp_pio_buffer *pio_buf;
...@@ -2606,27 +2596,8 @@ static void __exit espserial_exit(void) ...@@ -2606,27 +2596,8 @@ static void __exit espserial_exit(void)
while (ports) { while (ports) {
if (ports->port) { if (ports->port) {
region_start = region_end = ports->port; release_region(ports->port, REGION_SIZE);
temp_async = ports;
while (temp_async) {
if ((region_start - temp_async->port) == 8) {
region_start = temp_async->port;
temp_async->port = 0;
temp_async = ports;
} else if ((temp_async->port - region_end)
== 8) {
region_end = temp_async->port;
temp_async->port = 0;
temp_async = ports;
} else
temp_async = temp_async->next_port;
} }
release_region(region_start,
region_end - region_start + 8);
}
temp_async = ports->next_port; temp_async = ports->next_port;
kfree(ports); kfree(ports);
ports = temp_async; ports = temp_async;
......
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