summaryrefslogtreecommitdiffstats
path: root/drivers/pnp
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2001-01-10 05:27:25 +0000
committerRalf Baechle <ralf@linux-mips.org>2001-01-10 05:27:25 +0000
commitc9c06167e7933d93a6e396174c68abf242294abb (patch)
treed9a8bb30663e9a3405a1ef37ffb62bc14b9f019f /drivers/pnp
parentf79e8cc3c34e4192a3e5ef4cc9c6542fdef703c0 (diff)
Merge with Linux 2.4.0-test12.
Diffstat (limited to 'drivers/pnp')
-rw-r--r--drivers/pnp/isapnp.c46
1 files changed, 27 insertions, 19 deletions
diff --git a/drivers/pnp/isapnp.c b/drivers/pnp/isapnp.c
index 7d7b705c7..7256544ff 100644
--- a/drivers/pnp/isapnp.c
+++ b/drivers/pnp/isapnp.c
@@ -270,17 +270,16 @@ static int isapnp_next_rdp(void)
{
int rdp = isapnp_rdp;
while (rdp <= 0x3ff) {
- if (!check_region(rdp, 1)) {
- isapnp_rdp = rdp;
- return 0;
- }
- rdp += RDP_STEP;
/*
* We cannot use NE2000 probe spaces for ISAPnP or we
* will lock up machines.
*/
- if(rdp >= 0x280 && rdp <= 0x380)
- continue;
+ if ((rdp < 0x280 || rdp > 0x380) && !check_region(rdp, 1))
+ {
+ isapnp_rdp = rdp;
+ return 0;
+ }
+ rdp += RDP_STEP;
}
return -1;
}
@@ -748,6 +747,25 @@ static void __init isapnp_add_fixed_mem32_resource(struct pci_dev *dev,
}
/*
+ * Parse card name for ISA PnP device.
+ */
+
+static void __init
+isapnp_parse_name(char *name, unsigned int name_max, unsigned short *size)
+{
+ if (name[0] == '\0') {
+ unsigned short size1 = *size >= name_max ? (name_max - 1) : *size;
+ isapnp_peek(name, size1);
+ name[size1] = '\0';
+ *size -= size1;
+
+ /* clean whitespace from end of string */
+ while (size1 > 0 && name[--size1] == ' ')
+ name[size1] = '\0';
+ }
+}
+
+/*
* Parse resource map for logical device.
*/
@@ -844,12 +862,7 @@ static int __init isapnp_create_device(struct pci_bus *card,
size = 0;
break;
case _LTAG_ANSISTR:
- if (dev->name[0] == '\0') {
- unsigned short size1 = size > 47 ? 47 : size;
- isapnp_peek(dev->name, size1);
- dev->name[size1] = '\0';
- size -= size1;
- }
+ isapnp_parse_name(dev->name, sizeof(dev->name), &size);
break;
case _LTAG_UNICODESTR:
/* silently ignore */
@@ -915,12 +928,7 @@ static void __init isapnp_parse_resource_map(struct pci_bus *card)
case _STAG_VENDOR:
break;
case _LTAG_ANSISTR:
- if (card->name[0] == '\0') {
- unsigned short size1 = size > 47 ? 47 : size;
- isapnp_peek(card->name, size1);
- card->name[size1] = '\0';
- size -= size1;
- }
+ isapnp_parse_name(card->name, sizeof(card->name), &size);
break;
case _LTAG_UNICODESTR:
/* silently ignore */