git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
drivers
/
pnp
/
isapnp
/
core.c
diff --git
a/drivers/pnp/isapnp/core.c
b/drivers/pnp/isapnp/core.c
index
82c5edd
..
a0b1587
100644
(file)
--- a/
drivers/pnp/isapnp/core.c
+++ b/
drivers/pnp/isapnp/core.c
@@
-34,7
+34,6
@@
* 2003-08-11 Resource Management Updates - Adam Belay <ambx1@neo.rr.com>
*/
* 2003-08-11 Resource Management Updates - Adam Belay <ambx1@neo.rr.com>
*/
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
@@
-42,6
+41,7
@@
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/isapnp.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/isapnp.h>
+#include <linux/mutex.h>
#include <asm/io.h>
#if 0
#include <asm/io.h>
#if 0
@@
-92,7
+92,7
@@
MODULE_LICENSE("GPL");
#define _LTAG_FIXEDMEM32RANGE 0x86
static unsigned char isapnp_checksum_value;
#define _LTAG_FIXEDMEM32RANGE 0x86
static unsigned char isapnp_checksum_value;
-static DE
CLAR
E_MUTEX(isapnp_cfg_mutex);
+static DE
FIN
E_MUTEX(isapnp_cfg_mutex);
static int isapnp_detected;
static int isapnp_csn_count;
static int isapnp_detected;
static int isapnp_csn_count;
@@
-142,17
+142,6
@@
static void isapnp_write_word(unsigned char idx, unsigned short val)
isapnp_write_byte(idx+1, val);
}
isapnp_write_byte(idx+1, val);
}
-static void *isapnp_alloc(long size)
-{
- void *result;
-
- result = kmalloc(size, GFP_KERNEL);
- if (!result)
- return NULL;
- memset(result, 0, size);
- return result;
-}
-
static void isapnp_key(void)
{
unsigned char code = 0x6a, msb;
static void isapnp_key(void)
{
unsigned char code = 0x6a, msb;
@@
-406,7
+395,7
@@
static void isapnp_parse_id(struct pnp_dev * dev, unsigned short vendor, unsigne
struct pnp_id * id;
if (!dev)
return;
struct pnp_id * id;
if (!dev)
return;
- id =
isapnp_alloc(sizeof(struct pnp_id)
);
+ id =
kzalloc(sizeof(struct pnp_id), GFP_KERNEL
);
if (!id)
return;
sprintf(id->id, "%c%c%c%x%x%x%x",
if (!id)
return;
sprintf(id->id, "%c%c%c%x%x%x%x",
@@
-430,7
+419,7
@@
static struct pnp_dev * __init isapnp_parse_device(struct pnp_card *card, int si
struct pnp_dev *dev;
isapnp_peek(tmp, size);
struct pnp_dev *dev;
isapnp_peek(tmp, size);
- dev =
isapnp_alloc(sizeof(struct pnp_dev)
);
+ dev =
kzalloc(sizeof(struct pnp_dev), GFP_KERNEL
);
if (!dev)
return NULL;
dev->number = number;
if (!dev)
return NULL;
dev->number = number;
@@
-461,7
+450,7
@@
static void __init isapnp_parse_irq_resource(struct pnp_option *option,
unsigned long bits;
isapnp_peek(tmp, size);
unsigned long bits;
isapnp_peek(tmp, size);
- irq =
isapnp_alloc(sizeof(struct pnp_irq)
);
+ irq =
kzalloc(sizeof(struct pnp_irq), GFP_KERNEL
);
if (!irq)
return;
bits = (tmp[1] << 8) | tmp[0];
if (!irq)
return;
bits = (tmp[1] << 8) | tmp[0];
@@
-485,7
+474,7
@@
static void __init isapnp_parse_dma_resource(struct pnp_option *option,
struct pnp_dma *dma;
isapnp_peek(tmp, size);
struct pnp_dma *dma;
isapnp_peek(tmp, size);
- dma =
isapnp_alloc(sizeof(struct pnp_dma)
);
+ dma =
kzalloc(sizeof(struct pnp_dma), GFP_KERNEL
);
if (!dma)
return;
dma->map = tmp[0];
if (!dma)
return;
dma->map = tmp[0];
@@
-505,7
+494,7
@@
static void __init isapnp_parse_port_resource(struct pnp_option *option,
struct pnp_port *port;
isapnp_peek(tmp, size);
struct pnp_port *port;
isapnp_peek(tmp, size);
- port =
isapnp_alloc(sizeof(struct pnp_port)
);
+ port =
kzalloc(sizeof(struct pnp_port), GFP_KERNEL
);
if (!port)
return;
port->min = (tmp[2] << 8) | tmp[1];
if (!port)
return;
port->min = (tmp[2] << 8) | tmp[1];
@@
-528,7
+517,7
@@
static void __init isapnp_parse_fixed_port_resource(struct pnp_option *option,
struct pnp_port *port;
isapnp_peek(tmp, size);
struct pnp_port *port;
isapnp_peek(tmp, size);
- port =
isapnp_alloc(sizeof(struct pnp_port)
);
+ port =
kzalloc(sizeof(struct pnp_port), GFP_KERNEL
);
if (!port)
return;
port->min = port->max = (tmp[1] << 8) | tmp[0];
if (!port)
return;
port->min = port->max = (tmp[1] << 8) | tmp[0];
@@
-550,7
+539,7
@@
static void __init isapnp_parse_mem_resource(struct pnp_option *option,
struct pnp_mem *mem;
isapnp_peek(tmp, size);
struct pnp_mem *mem;
isapnp_peek(tmp, size);
- mem =
isapnp_alloc(sizeof(struct pnp_mem)
);
+ mem =
kzalloc(sizeof(struct pnp_mem), GFP_KERNEL
);
if (!mem)
return;
mem->min = ((tmp[2] << 8) | tmp[1]) << 8;
if (!mem)
return;
mem->min = ((tmp[2] << 8) | tmp[1]) << 8;
@@
-573,7
+562,7
@@
static void __init isapnp_parse_mem32_resource(struct pnp_option *option,
struct pnp_mem *mem;
isapnp_peek(tmp, size);
struct pnp_mem *mem;
isapnp_peek(tmp, size);
- mem =
isapnp_alloc(sizeof(struct pnp_mem)
);
+ mem =
kzalloc(sizeof(struct pnp_mem), GFP_KERNEL
);
if (!mem)
return;
mem->min = (tmp[4] << 24) | (tmp[3] << 16) | (tmp[2] << 8) | tmp[1];
if (!mem)
return;
mem->min = (tmp[4] << 24) | (tmp[3] << 16) | (tmp[2] << 8) | tmp[1];
@@
-595,7
+584,7
@@
static void __init isapnp_parse_fixed_mem32_resource(struct pnp_option *option,
struct pnp_mem *mem;
isapnp_peek(tmp, size);
struct pnp_mem *mem;
isapnp_peek(tmp, size);
- mem =
isapnp_alloc(sizeof(struct pnp_mem)
);
+ mem =
kzalloc(sizeof(struct pnp_mem), GFP_KERNEL
);
if (!mem)
return;
mem->min = mem->max = (tmp[4] << 24) | (tmp[3] << 16) | (tmp[2] << 8) | tmp[1];
if (!mem)
return;
mem->min = mem->max = (tmp[4] << 24) | (tmp[3] << 16) | (tmp[2] << 8) | tmp[1];
@@
-657,8
+646,10
@@
static int __init isapnp_create_device(struct pnp_card *card,
size = 0;
skip = 0;
option = pnp_register_independent_option(dev);
size = 0;
skip = 0;
option = pnp_register_independent_option(dev);
- if (!option)
+ if (!option) {
+ kfree(dev);
return 1;
return 1;
+ }
pnp_add_card_device(card,dev);
} else {
skip = 1;
pnp_add_card_device(card,dev);
} else {
skip = 1;
@@
-838,7
+829,7
@@
static unsigned char __init isapnp_checksum(unsigned char *data)
static void isapnp_parse_card_id(struct pnp_card * card, unsigned short vendor, unsigned short device)
{
static void isapnp_parse_card_id(struct pnp_card * card, unsigned short vendor, unsigned short device)
{
- struct pnp_id * id =
isapnp_alloc(sizeof(struct pnp_id)
);
+ struct pnp_id * id =
kzalloc(sizeof(struct pnp_id), GFP_KERNEL
);
if (!id)
return;
sprintf(id->id, "%c%c%c%x%x%x%x",
if (!id)
return;
sprintf(id->id, "%c%c%c%x%x%x%x",
@@
-874,7
+865,7
@@
static int __init isapnp_build_device_list(void)
header[4], header[5], header[6], header[7], header[8]);
printk(KERN_DEBUG "checksum = 0x%x\n", checksum);
#endif
header[4], header[5], header[6], header[7], header[8]);
printk(KERN_DEBUG "checksum = 0x%x\n", checksum);
#endif
- if ((card =
isapnp_alloc(sizeof(struct pnp_card)
)) == NULL)
+ if ((card =
kzalloc(sizeof(struct pnp_card), GFP_KERNEL
)) == NULL)
continue;
card->number = csn;
continue;
card->number = csn;
@@
-912,7
+903,7
@@
int isapnp_cfg_begin(int csn, int logdev)
{
if (csn < 1 || csn > isapnp_csn_count || logdev > 10)
return -EINVAL;
{
if (csn < 1 || csn > isapnp_csn_count || logdev > 10)
return -EINVAL;
-
down
(&isapnp_cfg_mutex);
+
mutex_lock
(&isapnp_cfg_mutex);
isapnp_wait();
isapnp_key();
isapnp_wake(csn);
isapnp_wait();
isapnp_key();
isapnp_wake(csn);
@@
-938,7
+929,7
@@
int isapnp_cfg_begin(int csn, int logdev)
int isapnp_cfg_end(void)
{
isapnp_wait();
int isapnp_cfg_end(void)
{
isapnp_wait();
-
up
(&isapnp_cfg_mutex);
+
mutex_unlock
(&isapnp_cfg_mutex);
return 0;
}
return 0;
}
@@
-952,7
+943,9
@@
EXPORT_SYMBOL(isapnp_protocol);
EXPORT_SYMBOL(isapnp_present);
EXPORT_SYMBOL(isapnp_cfg_begin);
EXPORT_SYMBOL(isapnp_cfg_end);
EXPORT_SYMBOL(isapnp_present);
EXPORT_SYMBOL(isapnp_cfg_begin);
EXPORT_SYMBOL(isapnp_cfg_end);
+#if 0
EXPORT_SYMBOL(isapnp_read_byte);
EXPORT_SYMBOL(isapnp_read_byte);
+#endif
EXPORT_SYMBOL(isapnp_write_byte);
static int isapnp_read_resources(struct pnp_dev *dev, struct pnp_resource_table *res)
EXPORT_SYMBOL(isapnp_write_byte);
static int isapnp_read_resources(struct pnp_dev *dev, struct pnp_resource_table *res)
@@
-1056,6
+1049,10
@@
static int __init isapnp_init(void)
printk(KERN_INFO "isapnp: ISA Plug & Play support disabled\n");
return 0;
}
printk(KERN_INFO "isapnp: ISA Plug & Play support disabled\n");
return 0;
}
+#ifdef CONFIG_PPC_MERGE
+ if (check_legacy_ioport(_PIDXR) || check_legacy_ioport(_PNPWRP))
+ return -EINVAL;
+#endif
#ifdef ISAPNP_REGION_OK
if (!request_region(_PIDXR, 1, "isapnp index")) {
printk(KERN_ERR "isapnp: Index Register 0x%x already used\n", _PIDXR);
#ifdef ISAPNP_REGION_OK
if (!request_region(_PIDXR, 1, "isapnp index")) {
printk(KERN_ERR "isapnp: Index Register 0x%x already used\n", _PIDXR);