Commit fb4532b5 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://ldm.bkbits.net/linux-2.5-core

into penguin.transmeta.com:/home/penguin/torvalds/repositories/kernel/linux
parents bb8d2379 21846253
...@@ -190,15 +190,10 @@ apply_relocate_add(Elf64_Shdr *sechdrs, const char *strtab, ...@@ -190,15 +190,10 @@ apply_relocate_add(Elf64_Shdr *sechdrs, const char *strtab,
/* This is where to make the change. */ /* This is where to make the change. */
location = base + rela[i].r_offset; location = base + rela[i].r_offset;
/* This is the symbol it is referring to. */ /* This is the symbol it is referring to. Note that all
unresolved symbols have been resolved. */
sym = symtab + r_sym; sym = symtab + r_sym;
value = sym->st_value; value = sym->st_value + rela[i].r_addend;
if (!value) {
printk(KERN_ERR "module %s: Unknown symbol %s\n",
me->name, strtab + sym->st_name);
return -ENOENT;
}
value += rela[i].r_addend;
switch (r_type) { switch (r_type) {
case R_ALPHA_NONE: case R_ALPHA_NONE:
......
...@@ -98,11 +98,6 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, ...@@ -98,11 +98,6 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
} }
sym = ((Elf32_Sym *)symsec->sh_addr) + offset; sym = ((Elf32_Sym *)symsec->sh_addr) + offset;
if (!sym->st_value) {
printk(KERN_WARNING "%s: unknown symbol %s\n",
module->name, strtab + sym->st_name);
return -ENOENT;
}
if (rel->r_offset < 0 || rel->r_offset > dstsec->sh_size - sizeof(u32)) { if (rel->r_offset < 0 || rel->r_offset > dstsec->sh_size - sizeof(u32)) {
printk(KERN_ERR "%s: out of bounds relocation, " printk(KERN_ERR "%s: out of bounds relocation, "
......
...@@ -70,14 +70,10 @@ int apply_relocate(Elf32_Shdr *sechdrs, ...@@ -70,14 +70,10 @@ int apply_relocate(Elf32_Shdr *sechdrs,
/* This is where to make the change */ /* This is where to make the change */
location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
+ rel[i].r_offset; + rel[i].r_offset;
/* This is the symbol it is referring to */ /* This is the symbol it is referring to. Note that all
undefined symbols have been resolved. */
sym = (Elf32_Sym *)sechdrs[symindex].sh_addr sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
+ ELF32_R_SYM(rel[i].r_info); + ELF32_R_SYM(rel[i].r_info);
if (!sym->st_value) {
printk(KERN_WARNING "%s: Unknown symbol %s\n",
me->name, strtab + sym->st_name);
return -ENOENT;
}
switch (ELF32_R_TYPE(rel[i].r_info)) { switch (ELF32_R_TYPE(rel[i].r_info)) {
case R_386_32: case R_386_32:
......
...@@ -197,14 +197,10 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, ...@@ -197,14 +197,10 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
/* This is where to make the change */ /* This is where to make the change */
location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
+ rela[i].r_offset; + rela[i].r_offset;
/* This is the symbol it is referring to */ /* This is the symbol it is referring to. Note that all
undefined symbols have been resolved. */
sym = (Elf32_Sym *)sechdrs[symindex].sh_addr sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
+ ELF32_R_SYM(rela[i].r_info); + ELF32_R_SYM(rela[i].r_info);
if (!sym->st_value) {
printk(KERN_WARNING "%s: Unknown symbol %s\n",
module->name, strtab + sym->st_name);
return -ENOENT;
}
/* `Everything is relative'. */ /* `Everything is relative'. */
value = sym->st_value + rela[i].r_addend; value = sym->st_value + rela[i].r_addend;
......
/* /*
* arch/s390x/kernel/module.c - Kernel module help for s390x. * arch/s390/kernel/module.c - Kernel module help for s390.
* *
* S390 version * S390 version
* Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, IBM Corporation * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, IBM Corporation
...@@ -77,14 +77,10 @@ int apply_relocate(Elf_Shdr *sechdrs, ...@@ -77,14 +77,10 @@ int apply_relocate(Elf_Shdr *sechdrs,
/* This is where to make the change */ /* This is where to make the change */
location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
+ rel[i].r_offset; + rel[i].r_offset;
/* This is the symbol it is referring to */ /* This is the symbol it is referring to. Note that all
undefined symbols have been resolved. */
sym = (ElfW(Sym) *)sechdrs[symindex].sh_addr sym = (ElfW(Sym) *)sechdrs[symindex].sh_addr
+ ELFW(R_SYM)(rel[i].r_info); + ELFW(R_SYM)(rel[i].r_info);
if (!sym->st_value) {
printk(KERN_WARNING "%s: Unknown symbol %s\n",
me->name, strtab + sym->st_name);
return -ENOENT;
}
switch (ELF_R_TYPE(rel[i].r_info)) { switch (ELF_R_TYPE(rel[i].r_info)) {
case R_390_8: /* Direct 8 bit. */ case R_390_8: /* Direct 8 bit. */
......
...@@ -78,14 +78,10 @@ int apply_relocate(Elf_Shdr *sechdrs, ...@@ -78,14 +78,10 @@ int apply_relocate(Elf_Shdr *sechdrs,
/* This is where to make the change */ /* This is where to make the change */
location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
+ rel[i].r_offset; + rel[i].r_offset;
/* This is the symbol it is referring to */ /* This is the symbol it is referring to. Note that all
undefined symbols have been resolved. */
sym = (ElfW(Sym) *)sechdrs[symindex].sh_addr sym = (ElfW(Sym) *)sechdrs[symindex].sh_addr
+ ELFW(R_SYM)(rel[i].r_info); + ELFW(R_SYM)(rel[i].r_info);
if (!sym->st_value) {
printk(KERN_WARNING "%s: Unknown symbol %s\n",
me->name, strtab + sym->st_name);
return -ENOENT;
}
switch (ELF_R_TYPE(rel[i].r_info)) { switch (ELF_R_TYPE(rel[i].r_info)) {
case R_390_8: /* Direct 8 bit. */ case R_390_8: /* Direct 8 bit. */
......
...@@ -75,15 +75,11 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, ...@@ -75,15 +75,11 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
location = (u8 *)sechdrs[sechdrs[relsec].sh_info].sh_addr location = (u8 *)sechdrs[sechdrs[relsec].sh_info].sh_addr
+ rel[i].r_offset; + rel[i].r_offset;
loc32 = (u32 *) location; loc32 = (u32 *) location;
/* This is the symbol it is referring to */ /* This is the symbol it is referring to. Note that all
undefined symbols have been resolved. */
sym = (Elf32_Sym *)sechdrs[symindex].sh_addr sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
+ ELF32_R_SYM(rel[i].r_info); + ELF32_R_SYM(rel[i].r_info);
if (!(v = sym->st_value)) { v = sym->st_value + rel[i].r_addend;
printk(KERN_WARNING "%s: Unknown symbol %s\n",
me->name, strtab + sym->st_name);
return -ENOENT;
}
v += rel[i].r_addend;
switch (ELF32_R_TYPE(rel[i].r_info)) { switch (ELF32_R_TYPE(rel[i].r_info)) {
case R_SPARC_32: case R_SPARC_32:
......
...@@ -185,15 +185,11 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, ...@@ -185,15 +185,11 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
BUG_ON(((u64)location >> (u64)32) != (u64)0); BUG_ON(((u64)location >> (u64)32) != (u64)0);
/* This is the symbol it is referring to */ /* This is the symbol it is referring to. Note that all
undefined symbols have been resolved. */
sym = (Elf64_Sym *)sechdrs[symindex].sh_addr sym = (Elf64_Sym *)sechdrs[symindex].sh_addr
+ ELF64_R_SYM(rel[i].r_info); + ELF64_R_SYM(rel[i].r_info);
if (!(v = sym->st_value)) { v = sym->st_value + rel[i].r_addend;
printk(KERN_WARNING "%s: Unknown symbol %s\n",
me->name, strtab + sym->st_name);
return -ENOENT;
}
v += rel[i].r_addend;
switch (ELF64_R_TYPE(rel[i].r_info) & 0xff) { switch (ELF64_R_TYPE(rel[i].r_info) & 0xff) {
case R_SPARC_64: case R_SPARC_64:
......
...@@ -184,19 +184,12 @@ int apply_relocate_add (Elf32_Shdr *sechdrs, const char *strtab, ...@@ -184,19 +184,12 @@ int apply_relocate_add (Elf32_Shdr *sechdrs, const char *strtab,
uint32_t *loc uint32_t *loc
= ((void *)sechdrs[sechdrs[relsec].sh_info].sh_addr = ((void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
+ rela[i].r_offset); + rela[i].r_offset);
/* This is the symbol it is referring to */ /* This is the symbol it is referring to. Note that all
undefined symbols have been resolved. */
Elf32_Sym *sym Elf32_Sym *sym
= ((Elf32_Sym *)sechdrs[symindex].sh_addr = ((Elf32_Sym *)sechdrs[symindex].sh_addr
+ ELF32_R_SYM (rela[i].r_info)); + ELF32_R_SYM (rela[i].r_info));
uint32_t val = sym->st_value; uint32_t val = sym->st_value + rela[i].r_addend;
if (! val) {
printk (KERN_WARNING "%s: Unknown symbol %s\n",
mod->name, strtab + sym->st_name);
return -ENOENT;
}
val += rela[i].r_addend;
switch (ELF32_R_TYPE (rela[i].r_info)) { switch (ELF32_R_TYPE (rela[i].r_info)) {
case R_V850_32: case R_V850_32:
......
...@@ -53,14 +53,10 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, ...@@ -53,14 +53,10 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
loc = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr loc = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
+ rel[i].r_offset; + rel[i].r_offset;
/* This is the symbol it is referring to */ /* This is the symbol it is referring to. Note that all
undefined symbols have been resolved. */
sym = (Elf64_Sym *)sechdrs[symindex].sh_addr sym = (Elf64_Sym *)sechdrs[symindex].sh_addr
+ ELF64_R_SYM(rel[i].r_info); + ELF64_R_SYM(rel[i].r_info);
if (!sym->st_value) {
printk(KERN_WARNING "%s: Unknown symbol %s\n",
me->name, strtab + sym->st_name);
return -ENOENT;
}
DEBUGP("type %d st_value %Lx r_addend %Lx loc %Lx\n", DEBUGP("type %d st_value %Lx r_addend %Lx loc %Lx\n",
(int)ELF64_R_TYPE(rel[i].r_info), (int)ELF64_R_TYPE(rel[i].r_info),
......
...@@ -63,7 +63,7 @@ static struct pnp_card_id fcpnp_ids[] __devinitdata = { ...@@ -63,7 +63,7 @@ static struct pnp_card_id fcpnp_ids[] __devinitdata = {
.driver_data = (unsigned long) "Fritz!Card PnP", .driver_data = (unsigned long) "Fritz!Card PnP",
.devs = { { "AVM0900" } } } .devs = { { "AVM0900" } } }
}; };
//MODULE_DEVICE_TABLE(pnpc, fcpnp_ids); FIXME MODULE_DEVICE_TABLE(pnp_card, fcpnp_ids);
static int protocol = 2; /* EURO-ISDN Default */ static int protocol = 2; /* EURO-ISDN Default */
MODULE_PARM(protocol, "i"); MODULE_PARM(protocol, "i");
...@@ -911,7 +911,7 @@ static struct pci_driver fcpci_driver = { ...@@ -911,7 +911,7 @@ static struct pci_driver fcpci_driver = {
#ifdef __ISAPNP__ #ifdef __ISAPNP__
static int __devinit fcpnp_probe(struct pnp_card *card, static int __devinit fcpnp_probe(struct pnp_card *card,
const struct pnp_card_id *card_id) const struct pnp_card_device_id *card_id)
{ {
struct fritz_adapter *adapter; struct fritz_adapter *adapter;
struct pnp_dev *pnp_dev; struct pnp_dev *pnp_dev;
......
...@@ -455,10 +455,7 @@ static void awc_pnp_release(void) { ...@@ -455,10 +455,7 @@ static void awc_pnp_release(void) {
if (awc_proc_unset_fun) if (awc_proc_unset_fun)
awc_proc_unset_fun(i); awc_proc_unset_fun(i);
if (isapnp_cfg_begin(logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER)<0) pnp_device_detach(logdev);
printk("isapnp cfg failed at release \n");
isapnp_deactivate(logdev->PNP_DEV_NUMBER);
isapnp_cfg_end();
release_region(aironet4500_devices[i]->base_addr, AIRONET4X00_IO_SIZE); release_region(aironet4500_devices[i]->base_addr, AIRONET4X00_IO_SIZE);
// release_region(isa_cisaddr, AIRONET4X00_CIS_SIZE, "aironet4x00 cis"); // release_region(isa_cisaddr, AIRONET4X00_CIS_SIZE, "aironet4x00 cis");
......
...@@ -206,13 +206,14 @@ static int __init ne_probe_isapnp(struct net_device *dev) ...@@ -206,13 +206,14 @@ static int __init ne_probe_isapnp(struct net_device *dev)
if (pnp_device_attach(idev) < 0) if (pnp_device_attach(idev) < 0)
continue; continue;
if (pnp_activate_dev(idev, NULL) < 0) { if (pnp_activate_dev(idev, NULL) < 0) {
__again:
pnp_device_detach(idev); pnp_device_detach(idev);
continue; continue;
} }
/* if no io and irq, search for next */ /* if no io and irq, search for next */
if (!pnp_port_valid(idev, 0) || !pnp_irq_valid(idev, 0)) if (!pnp_port_valid(idev, 0) || !pnp_irq_valid(idev, 0)) {
goto __again; pnp_device_detach(idev);
continue;
}
/* found it */ /* found it */
dev->base_addr = pnp_port_start(idev, 0); dev->base_addr = pnp_port_start(idev, 0);
dev->irq = pnp_irq(idev, 0); dev->irq = pnp_irq(idev, 0);
...@@ -786,9 +787,9 @@ void cleanup_module(void) ...@@ -786,9 +787,9 @@ void cleanup_module(void)
struct net_device *dev = &dev_ne[this_dev]; struct net_device *dev = &dev_ne[this_dev];
if (dev->priv != NULL) { if (dev->priv != NULL) {
void *priv = dev->priv; void *priv = dev->priv;
struct pci_dev *idev = (struct pci_dev *)ei_status.priv; struct pnp_dev *idev = (struct pnp_dev *)ei_status.priv;
if (idev) if (idev)
idev->deactivate(idev); pnp_device_detach(idev);
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
release_region(dev->base_addr, NE_IO_EXTENT); release_region(dev->base_addr, NE_IO_EXTENT);
unregister_netdev(dev); unregister_netdev(dev);
......
...@@ -550,9 +550,9 @@ cleanup_module(void) ...@@ -550,9 +550,9 @@ cleanup_module(void)
int ioaddr = dev->base_addr - ULTRA_NIC_OFFSET; int ioaddr = dev->base_addr - ULTRA_NIC_OFFSET;
#ifdef __ISAPNP__ #ifdef __ISAPNP__
struct pci_dev *idev = (struct pci_dev *)ei_status.priv; struct pnp_dev *idev = (struct pnp_dev *)ei_status.priv;
if (idev) if (idev)
idev->deactivate(idev); pnp_device_detach(idev);
#endif #endif
unregister_netdev(dev); unregister_netdev(dev);
......
...@@ -22,9 +22,9 @@ ...@@ -22,9 +22,9 @@
LIST_HEAD(pnp_cards); LIST_HEAD(pnp_cards);
static const struct pnp_card_id * match_card(struct pnpc_driver *drv, struct pnp_card *card) static const struct pnp_card_device_id * match_card(struct pnpc_driver *drv, struct pnp_card *card)
{ {
const struct pnp_card_id *drv_id = drv->id_table; const struct pnp_card_device_id *drv_id = drv->id_table;
while (*drv_id->id){ while (*drv_id->id){
if (compare_pnp_id(card->id,drv_id->id)) if (compare_pnp_id(card->id,drv_id->id))
return drv_id; return drv_id;
...@@ -216,18 +216,15 @@ struct pnp_dev * pnp_request_card_device(struct pnp_card *card, const char *id, ...@@ -216,18 +216,15 @@ struct pnp_dev * pnp_request_card_device(struct pnp_card *card, const char *id,
return NULL; return NULL;
found: found:
spin_lock(&pnp_lock); if (pnp_device_attach(dev) < 0)
if(dev->status != PNP_READY){
spin_unlock(&pnp_lock);
return NULL; return NULL;
}
dev->status = PNP_ATTACHED;
spin_unlock(&pnp_lock);
cdrv = to_pnpc_driver(card->dev.driver); cdrv = to_pnpc_driver(card->dev.driver);
if (dev->active == 0) { if (dev->active == 0) {
if (!(cdrv->flags & PNPC_DRIVER_DO_NOT_ACTIVATE)) { if (!(cdrv->flags & PNPC_DRIVER_DO_NOT_ACTIVATE)) {
if(pnp_activate_dev(dev,NULL)<0) if(pnp_activate_dev(dev,NULL)<0) {
pnp_device_detach(dev);
return NULL; return NULL;
}
} }
} else { } else {
if ((cdrv->flags & PNPC_DRIVER_DO_NOT_ACTIVATE)) if ((cdrv->flags & PNPC_DRIVER_DO_NOT_ACTIVATE))
...@@ -250,10 +247,8 @@ void pnp_release_card_device(struct pnp_dev *dev) ...@@ -250,10 +247,8 @@ void pnp_release_card_device(struct pnp_dev *dev)
{ {
spin_lock(&pnp_lock); spin_lock(&pnp_lock);
list_del(&dev->rdev_list); list_del(&dev->rdev_list);
if (dev->status == PNP_ATTACHED)
dev->status = PNP_READY;
spin_unlock(&pnp_lock); spin_unlock(&pnp_lock);
pnp_disable_dev(dev); pnp_device_detach(dev);
} }
static void pnpc_recover_devices(struct pnp_card *card) static void pnpc_recover_devices(struct pnp_card *card)
...@@ -291,7 +286,7 @@ static int pnpc_card_probe(struct device *dev) ...@@ -291,7 +286,7 @@ static int pnpc_card_probe(struct device *dev)
int error = 0; int error = 0;
struct pnpc_driver *drv = to_pnpc_driver(dev->driver); struct pnpc_driver *drv = to_pnpc_driver(dev->driver);
struct pnp_card *card = to_pnp_card(dev); struct pnp_card *card = to_pnp_card(dev);
const struct pnp_card_id *card_id = NULL; const struct pnp_card_device_id *card_id = NULL;
pnp_dbg("pnp: match found with the PnP card '%s' and the driver '%s'", dev->bus_id,drv->name); pnp_dbg("pnp: match found with the PnP card '%s' and the driver '%s'", dev->bus_id,drv->name);
......
...@@ -102,7 +102,6 @@ static int isapnp_detected; ...@@ -102,7 +102,6 @@ static int isapnp_detected;
/* some prototypes */ /* some prototypes */
static int isapnp_config_prepare(struct pnp_dev *dev); static int isapnp_config_prepare(struct pnp_dev *dev);
extern struct pnp_protocol isapnp_card_protocol;
extern struct pnp_protocol isapnp_protocol; extern struct pnp_protocol isapnp_protocol;
static inline void write_data(unsigned char x) static inline void write_data(unsigned char x)
...@@ -1125,7 +1124,7 @@ int __init isapnp_init(void) ...@@ -1125,7 +1124,7 @@ int __init isapnp_init(void)
isapnp_build_device_list(); isapnp_build_device_list();
cards = 0; cards = 0;
protocol_for_each_card(&isapnp_card_protocol,card) { protocol_for_each_card(&isapnp_protocol,card) {
cards++; cards++;
if (isapnp_verbose) { if (isapnp_verbose) {
printk(KERN_INFO "isapnp: Card '%s'\n", card->name[0]?card->name:"Unknown"); printk(KERN_INFO "isapnp: Card '%s'\n", card->name[0]?card->name:"Unknown");
......
...@@ -156,11 +156,12 @@ typedef __s64 Elf64_Sxword; ...@@ -156,11 +156,12 @@ typedef __s64 Elf64_Sxword;
#define STT_SECTION 3 #define STT_SECTION 3
#define STT_FILE 4 #define STT_FILE 4
#define ELF32_ST_BIND(x) ((x) >> 4) #define ELF_ST_BIND(x) ((x) >> 4)
#define ELF32_ST_TYPE(x) (((unsigned int) x) & 0xf) #define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf)
#define ELF32_ST_BIND(x) ELF_ST_BIND(x)
#define ELF64_ST_BIND(x) ((x) >> 4) #define ELF32_ST_TYPE(x) ELF_ST_TYPE(x)
#define ELF64_ST_TYPE(x) (((unsigned int) x) & 0xf) #define ELF64_ST_BIND(x) ELF_ST_BIND(x)
#define ELF64_ST_TYPE(x) ELF_ST_TYPE(x)
/* Symbolic values for the entries in the auxiliary table /* Symbolic values for the entries in the auxiliary table
put on the initial stack */ put on the initial stack */
......
...@@ -5,14 +5,6 @@ ...@@ -5,14 +5,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/elf.h> #include <linux/elf.h>
/* Helper function for arch-specific module loaders */
unsigned long find_symbol_internal(Elf_Shdr *sechdrs,
unsigned int symindex,
const char *strtab,
const char *name,
struct module *mod,
struct kernel_symbol_group **group);
/* These must be implemented by the specific architecture */ /* These must be implemented by the specific architecture */
/* Adjust arch-specific sections. Return 0 on success. */ /* Adjust arch-specific sections. Return 0 on success. */
......
...@@ -189,7 +189,7 @@ struct pnp_device_id { ...@@ -189,7 +189,7 @@ struct pnp_device_id {
unsigned long driver_data; /* data private to the driver */ unsigned long driver_data; /* data private to the driver */
}; };
struct pnp_card_id { struct pnp_card_device_id {
char id[7]; char id[7];
unsigned long driver_data; /* data private to the driver */ unsigned long driver_data; /* data private to the driver */
struct { struct {
...@@ -216,9 +216,9 @@ struct pnp_driver { ...@@ -216,9 +216,9 @@ struct pnp_driver {
struct pnpc_driver { struct pnpc_driver {
struct list_head node; struct list_head node;
char *name; char *name;
const struct pnp_card_id *id_table; const struct pnp_card_device_id *id_table;
unsigned int flags; unsigned int flags;
int (*probe) (struct pnp_card *card, const struct pnp_card_id *card_id); int (*probe) (struct pnp_card *card, const struct pnp_card_device_id *card_id);
void (*remove) (struct pnp_card *card); void (*remove) (struct pnp_card *card);
struct device_driver driver; struct device_driver driver;
}; };
......
...@@ -722,28 +722,22 @@ static int obsolete_params(const char *name, ...@@ -722,28 +722,22 @@ static int obsolete_params(const char *name,
} }
#endif /* CONFIG_OBSOLETE_MODPARM */ #endif /* CONFIG_OBSOLETE_MODPARM */
/* Find an symbol for this module (ie. resolve internals first). /* Resolve a symbol for this module. I.e. if we find one, record usage.
It we find one, record usage. Must be holding module_mutex. */ Must be holding module_mutex. */
unsigned long find_symbol_internal(Elf_Shdr *sechdrs, static unsigned long resolve_symbol(Elf_Shdr *sechdrs,
unsigned int symindex, unsigned int symindex,
const char *strtab, const char *strtab,
const char *name, const char *name,
struct module *mod, struct module *mod)
struct kernel_symbol_group **ksg)
{ {
struct kernel_symbol_group *ksg;
unsigned long ret; unsigned long ret;
ret = find_local_symbol(sechdrs, symindex, strtab, name);
if (ret) {
*ksg = NULL;
return ret;
}
/* Look in other modules... */
spin_lock_irq(&modlist_lock); spin_lock_irq(&modlist_lock);
ret = __find_symbol(name, ksg, mod->license_gplok); ret = __find_symbol(name, &ksg, mod->license_gplok);
if (ret) { if (ret) {
/* This can fail due to OOM, or module unloading */ /* This can fail due to OOM, or module unloading */
if (!use_module(mod, (*ksg)->owner)) if (!use_module(mod, ksg->owner))
ret = 0; ret = 0;
} }
spin_unlock_irq(&modlist_lock); spin_unlock_irq(&modlist_lock);
...@@ -832,21 +826,19 @@ static int simplify_symbols(Elf_Shdr *sechdrs, ...@@ -832,21 +826,19 @@ static int simplify_symbols(Elf_Shdr *sechdrs,
unsigned int strindex, unsigned int strindex,
struct module *mod) struct module *mod)
{ {
unsigned int i; Elf_Sym *sym = (void *)sechdrs[symindex].sh_addr;
Elf_Sym *sym; const char *strtab = (char *)sechdrs[strindex].sh_addr;
unsigned int i, n = sechdrs[symindex].sh_size / sizeof(Elf_Sym);
/* First simplify defined symbols, so if they become the int ret = 0;
"answer" to undefined symbols, copying their st_value us
correct. */ for (i = 1; i < n; i++) {
for (sym = (void *)sechdrs[symindex].sh_addr, i = 0;
i < sechdrs[symindex].sh_size / sizeof(Elf_Sym);
i++) {
switch (sym[i].st_shndx) { switch (sym[i].st_shndx) {
case SHN_COMMON: case SHN_COMMON:
/* We compiled with -fno-common. These are not /* We compiled with -fno-common. These are not
supposed to happen. */ supposed to happen. */
DEBUGP("Common symbol: %s\n", strtab + sym[i].st_name); DEBUGP("Common symbol: %s\n", strtab + sym[i].st_name);
return -ENOEXEC; ret = -ENOEXEC;
break;
case SHN_ABS: case SHN_ABS:
/* Don't need to do anything */ /* Don't need to do anything */
...@@ -855,6 +847,20 @@ static int simplify_symbols(Elf_Shdr *sechdrs, ...@@ -855,6 +847,20 @@ static int simplify_symbols(Elf_Shdr *sechdrs,
break; break;
case SHN_UNDEF: case SHN_UNDEF:
sym[i].st_value
= resolve_symbol(sechdrs, symindex, strtab,
strtab + sym[i].st_name, mod);
/* Ok if resolved. */
if (sym[i].st_value != 0)
break;
/* Ok if weak. */
if (ELF_ST_BIND(sym[i].st_info) == STB_WEAK)
break;
printk(KERN_WARNING "%s: Unknown symbol %s\n",
mod->name, strtab + sym[i].st_name);
ret = -ENOENT;
break; break;
default: default:
...@@ -862,30 +868,11 @@ static int simplify_symbols(Elf_Shdr *sechdrs, ...@@ -862,30 +868,11 @@ static int simplify_symbols(Elf_Shdr *sechdrs,
= (unsigned long) = (unsigned long)
(sechdrs[sym[i].st_shndx].sh_addr (sechdrs[sym[i].st_shndx].sh_addr
+ sym[i].st_value); + sym[i].st_value);
break;
} }
} }
/* Now try to resolve undefined symbols */ return ret;
for (sym = (void *)sechdrs[symindex].sh_addr, i = 0;
i < sechdrs[symindex].sh_size / sizeof(Elf_Sym);
i++) {
if (sym[i].st_shndx == SHN_UNDEF) {
/* Look for symbol */
struct kernel_symbol_group *ksg = NULL;
const char *strtab
= (char *)sechdrs[strindex].sh_addr;
sym[i].st_value
= find_symbol_internal(sechdrs,
symindex,
strtab,
strtab + sym[i].st_name,
mod,
&ksg);
}
}
return 0;
} }
/* Update size with this section: return offset. */ /* Update size with this section: return offset. */
......
...@@ -2983,14 +2983,14 @@ static struct pnp_dev *activate_dev(char *devname, char *resname, struct pnp_dev ...@@ -2983,14 +2983,14 @@ static struct pnp_dev *activate_dev(char *devname, char *resname, struct pnp_dev
{ {
int err; int err;
/* Device already active? Let's use it */ err = pnp_device_attach(dev);
if(dev->active) if (err < 0)
return(dev); return(NULL);
if((err = pnp_activate_dev(dev,NULL)) < 0) { if((err = pnp_activate_dev(dev,NULL)) < 0) {
printk(KERN_ERR "ad1848: %s %s config failed (out of resources?)[%d]\n", devname, resname, err); printk(KERN_ERR "ad1848: %s %s config failed (out of resources?)[%d]\n", devname, resname, err);
pnp_disable_dev(dev); pnp_device_detach(dev);
return(NULL); return(NULL);
} }
...@@ -3006,12 +3006,11 @@ static struct pnp_dev *ad1848_init_generic(struct pnp_card *bus, struct address_ ...@@ -3006,12 +3006,11 @@ static struct pnp_dev *ad1848_init_generic(struct pnp_card *bus, struct address_
{ {
if((ad1848_dev = activate_dev(ad1848_isapnp_list[slot].name, "ad1848", ad1848_dev))) if((ad1848_dev = activate_dev(ad1848_isapnp_list[slot].name, "ad1848", ad1848_dev)))
{ {
get_device(&ad1848_dev->dev); hw_config->io_base = pnp_port_start(ad1848_dev, ad1848_isapnp_list[slot].mss_io);
hw_config->io_base = ad1848_dev->resource[ad1848_isapnp_list[slot].mss_io].start; hw_config->irq = pnp_irq(ad1848_dev, ad1848_isapnp_list[slot].irq);
hw_config->irq = ad1848_dev->irq_resource[ad1848_isapnp_list[slot].irq].start; hw_config->dma = pnp_dma(ad1848_dev, ad1848_isapnp_list[slot].dma);
hw_config->dma = ad1848_dev->dma_resource[ad1848_isapnp_list[slot].dma].start;
if(ad1848_isapnp_list[slot].dma2 != -1) if(ad1848_isapnp_list[slot].dma2 != -1)
hw_config->dma2 = ad1848_dev->dma_resource[ad1848_isapnp_list[slot].dma2].start; hw_config->dma2 = pnp_dma(ad1848_dev, ad1848_isapnp_list[slot].dma2);
else else
hw_config->dma2 = -1; hw_config->dma2 = -1;
hw_config->card_subtype = ad1848_isapnp_list[slot].type; hw_config->card_subtype = ad1848_isapnp_list[slot].type;
...@@ -3032,7 +3031,7 @@ static int __init ad1848_isapnp_init(struct address_info *hw_config, struct pnp_ ...@@ -3032,7 +3031,7 @@ static int __init ad1848_isapnp_init(struct address_info *hw_config, struct pnp_
if(ad1848_init_generic(bus, hw_config, slot)) { if(ad1848_init_generic(bus, hw_config, slot)) {
/* We got it. */ /* We got it. */
printk(KERN_NOTICE "ad1848: ISAPnP reports '%s' at i/o %#x, irq %d, dma %d, %d\n", printk(KERN_NOTICE "ad1848: PnP reports '%s' at i/o %#x, irq %d, dma %d, %d\n",
busname, busname,
hw_config->io_base, hw_config->irq, hw_config->dma, hw_config->io_base, hw_config->irq, hw_config->dma,
hw_config->dma2); hw_config->dma2);
...@@ -3122,8 +3121,7 @@ static void __exit cleanup_ad1848(void) ...@@ -3122,8 +3121,7 @@ static void __exit cleanup_ad1848(void)
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
if(ad1848_dev){ if(ad1848_dev){
if(audio_activated) if(audio_activated)
pnp_disable_dev(ad1848_dev); pnp_device_detach(ad1848_dev);
put_device(&ad1848_dev->dev);
} }
#endif #endif
} }
......
...@@ -357,7 +357,7 @@ MODULE_PARM_DESC(isapnp,"Enable ISAPnP probing (default 1)"); ...@@ -357,7 +357,7 @@ MODULE_PARM_DESC(isapnp,"Enable ISAPnP probing (default 1)");
/* All cs4232 based cards have the main ad1848 card either as CSC0000 or /* All cs4232 based cards have the main ad1848 card either as CSC0000 or
* CSC0100. */ * CSC0100. */
static const struct pnp_id cs4232_pnp_table[] = { static const struct pnp_device_id cs4232_pnp_table[] = {
{ .id = "CSC0100", .driver_data = 0 }, { .id = "CSC0100", .driver_data = 0 },
{ .id = "CSC0000", .driver_data = 0 }, { .id = "CSC0000", .driver_data = 0 },
/* Guillemot Turtlebeach something appears to be cs4232 compatible /* Guillemot Turtlebeach something appears to be cs4232 compatible
...@@ -366,9 +366,9 @@ static const struct pnp_id cs4232_pnp_table[] = { ...@@ -366,9 +366,9 @@ static const struct pnp_id cs4232_pnp_table[] = {
{ .id = ""} { .id = ""}
}; };
/*MODULE_DEVICE_TABLE(isapnp, isapnp_cs4232_list);*/ MODULE_DEVICE_TABLE(pnp, cs4232_pnp_table);
static int cs4232_pnp_probe(struct pnp_dev *dev, const struct pnp_id *card_id, const struct pnp_id *dev_id) static int cs4232_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
{ {
struct address_info *isapnpcfg; struct address_info *isapnpcfg;
...@@ -376,30 +376,31 @@ static int cs4232_pnp_probe(struct pnp_dev *dev, const struct pnp_id *card_id, c ...@@ -376,30 +376,31 @@ static int cs4232_pnp_probe(struct pnp_dev *dev, const struct pnp_id *card_id, c
if (!isapnpcfg) if (!isapnpcfg)
return -ENOMEM; return -ENOMEM;
isapnpcfg->irq = dev->irq_resource[0].start; isapnpcfg->irq = pnp_irq(dev, 0);
isapnpcfg->dma = dev->dma_resource[0].start; isapnpcfg->dma = pnp_dma(dev, 0);
isapnpcfg->dma2 = dev->dma_resource[1].start; isapnpcfg->dma2 = pnp_dma(dev, 1);
isapnpcfg->io_base = dev->resource[0].start; isapnpcfg->io_base = pnp_port_start(dev, 0);
if (probe_cs4232(isapnpcfg,TRUE) == 0) { if (probe_cs4232(isapnpcfg,TRUE) == 0) {
printk(KERN_ERR "cs4232: ISA PnP card found, but not detected?\n"); printk(KERN_ERR "cs4232: ISA PnP card found, but not detected?\n");
kfree(isapnpcfg); kfree(isapnpcfg);
return -ENODEV; return -ENODEV;
} }
attach_cs4232(isapnpcfg); attach_cs4232(isapnpcfg);
pci_set_drvdata(dev,isapnpcfg); pnp_set_drvdata(dev,isapnpcfg);
return 0; return 0;
} }
static void cs4232_pnp_remove(struct pnp_dev *dev) static void cs4232_pnp_remove(struct pnp_dev *dev)
{ {
struct address_info *cfg = (struct address_info*) dev->driver_data; struct address_info *cfg = pnp_get_drvdata(dev);
if (cfg) if (cfg) {
unload_cs4232(cfg); unload_cs4232(cfg);
kfree(cfg);
}
} }
static struct pnp_driver cs4232_driver = { static struct pnp_driver cs4232_driver = {
.name = "cs4232", .name = "cs4232",
.card_id_table = NULL,
.id_table = cs4232_pnp_table, .id_table = cs4232_pnp_table,
.probe = cs4232_pnp_probe, .probe = cs4232_pnp_probe,
.remove = cs4232_pnp_remove, .remove = cs4232_pnp_remove,
......
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