Commit 9b0f2f7d authored by James Simmons's avatar James Simmons

Merge maxwell.earthlink.net:/usr/src/linus-2.5

into maxwell.earthlink.net:/usr/src/fbdev-2.5
parents ca073490 af1dbde2
...@@ -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),
......
...@@ -43,14 +43,15 @@ drv_attr_show(struct kobject * kobj, struct attribute * attr, char * buf) ...@@ -43,14 +43,15 @@ drv_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
} }
static ssize_t static ssize_t
drv_attr_store(struct kobject * kobj, struct attribute * attr, const char * buf) drv_attr_store(struct kobject * kobj, struct attribute * attr,
const char * buf, size_t count)
{ {
struct driver_attribute * drv_attr = to_drv_attr(attr); struct driver_attribute * drv_attr = to_drv_attr(attr);
struct device_driver * drv = to_driver(kobj); struct device_driver * drv = to_driver(kobj);
ssize_t ret = 0; ssize_t ret = 0;
if (drv_attr->store) if (drv_attr->store)
ret = drv_attr->store(drv,buf); ret = drv_attr->store(drv,buf,count);
return ret; return ret;
} }
...@@ -90,14 +91,15 @@ bus_attr_show(struct kobject * kobj, struct attribute * attr, char * buf) ...@@ -90,14 +91,15 @@ bus_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
} }
static ssize_t static ssize_t
bus_attr_store(struct kobject * kobj, struct attribute * attr, const char * buf) bus_attr_store(struct kobject * kobj, struct attribute * attr,
const char * buf, size_t count)
{ {
struct bus_attribute * bus_attr = to_bus_attr(attr); struct bus_attribute * bus_attr = to_bus_attr(attr);
struct bus_type * bus = to_bus(kobj); struct bus_type * bus = to_bus(kobj);
ssize_t ret = 0; ssize_t ret = 0;
if (bus_attr->store) if (bus_attr->store)
ret = bus_attr->store(bus,buf); ret = bus_attr->store(bus,buf,count);
return ret; return ret;
} }
......
...@@ -26,14 +26,15 @@ devclass_attr_show(struct kobject * kobj, struct attribute * attr, char * buf) ...@@ -26,14 +26,15 @@ devclass_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
} }
static ssize_t static ssize_t
devclass_attr_store(struct kobject * kobj, struct attribute * attr, const char * buf) devclass_attr_store(struct kobject * kobj, struct attribute * attr,
const char * buf, size_t count)
{ {
struct devclass_attribute * class_attr = to_class_attr(attr); struct devclass_attribute * class_attr = to_class_attr(attr);
struct device_class * dc = to_class(kobj); struct device_class * dc = to_class(kobj);
ssize_t ret = 0; ssize_t ret = 0;
if (class_attr->store) if (class_attr->store)
ret = class_attr->store(dc,buf); ret = class_attr->store(dc,buf,count);
return ret; return ret;
} }
......
...@@ -47,14 +47,15 @@ dev_attr_show(struct kobject * kobj, struct attribute * attr, char * buf) ...@@ -47,14 +47,15 @@ dev_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
} }
static ssize_t static ssize_t
dev_attr_store(struct kobject * kobj, struct attribute * attr, const char * buf) dev_attr_store(struct kobject * kobj, struct attribute * attr,
const char * buf, size_t count)
{ {
struct device_attribute * dev_attr = to_dev_attr(attr); struct device_attribute * dev_attr = to_dev_attr(attr);
struct device * dev = to_dev(kobj); struct device * dev = to_dev(kobj);
ssize_t ret = 0; ssize_t ret = 0;
if (dev_attr->store) if (dev_attr->store)
ret = dev_attr->store(dev,buf); ret = dev_attr->store(dev,buf,count);
return ret; return ret;
} }
......
...@@ -24,7 +24,7 @@ device_read_power(struct device * dev, char * page) ...@@ -24,7 +24,7 @@ device_read_power(struct device * dev, char * page)
} }
static ssize_t static ssize_t
device_write_power(struct device * dev, const char * buf) device_write_power(struct device * dev, const char * buf, size_t count)
{ {
char str_command[20]; char str_command[20];
char str_level[20]; char str_level[20];
...@@ -80,7 +80,7 @@ device_write_power(struct device * dev, const char * buf) ...@@ -80,7 +80,7 @@ device_write_power(struct device * dev, const char * buf)
error = 0; error = 0;
} }
done: done:
return error < 0 ? error : strlen(buf); return error < 0 ? error : count;
} }
static DEVICE_ATTR(power,S_IWUSR | S_IRUGO, static DEVICE_ATTR(power,S_IWUSR | S_IRUGO,
......
...@@ -36,29 +36,27 @@ static ssize_t node_read_cpumap(struct device * dev, char * buf, size_t count, l ...@@ -36,29 +36,27 @@ static ssize_t node_read_cpumap(struct device * dev, char * buf, size_t count, l
static DEVICE_ATTR(cpumap,S_IRUGO,node_read_cpumap,NULL); static DEVICE_ATTR(cpumap,S_IRUGO,node_read_cpumap,NULL);
#define K(x) ((x) << (PAGE_SHIFT - 10)) #define K(x) ((x) << (PAGE_SHIFT - 10))
static ssize_t node_read_meminfo(struct device * dev, char * buf, size_t count, loff_t off) static ssize_t node_read_meminfo(struct device * dev, char * buf)
{ {
struct sys_root *node = to_root(dev); struct sys_root *node = to_root(dev);
int nid = node->id; int nid = node->id;
struct sysinfo i; struct sysinfo i;
si_meminfo_node(&i, nid); si_meminfo_node(&i, nid);
return off ? 0 : sprintf(buf, "\n" return sprintf(buf, "\n"
"Node %d MemTotal: %8lu kB\n" "Node %d MemTotal: %8lu kB\n"
"Node %d MemFree: %8lu kB\n" "Node %d MemFree: %8lu kB\n"
"Node %d MemUsed: %8lu kB\n" "Node %d MemUsed: %8lu kB\n"
"Node %d HighTotal: %8lu kB\n" "Node %d HighTotal: %8lu kB\n"
"Node %d HighFree: %8lu kB\n" "Node %d HighFree: %8lu kB\n"
"Node %d LowTotal: %8lu kB\n" "Node %d LowTotal: %8lu kB\n"
"Node %d LowFree: %8lu kB\n", "Node %d LowFree: %8lu kB\n",
nid, K(i.totalram), nid, K(i.totalram),
nid, K(i.freeram), nid, K(i.freeram),
nid, K(i.totalram-i.freeram), nid, K(i.totalram-i.freeram),
nid, K(i.totalhigh), nid, K(i.totalhigh),
nid, K(i.freehigh), nid, K(i.freehigh),
nid, K(i.totalram-i.totalhigh), nid, K(i.totalram-i.totalhigh),
nid, K(i.freeram-i.freehigh)); nid, K(i.freeram-i.freehigh));
return 0;
} }
#undef K #undef K
static DEVICE_ATTR(meminfo,S_IRUGO,node_read_meminfo,NULL); static DEVICE_ATTR(meminfo,S_IRUGO,node_read_meminfo,NULL);
......
...@@ -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;
......
...@@ -69,47 +69,28 @@ struct bus_type mca_bus_type = { ...@@ -69,47 +69,28 @@ struct bus_type mca_bus_type = {
}; };
EXPORT_SYMBOL (mca_bus_type); EXPORT_SYMBOL (mca_bus_type);
static ssize_t mca_show_pos_id(struct device *dev, char *buf, size_t count, static ssize_t mca_show_pos_id(struct device *dev, char *buf)
loff_t off)
{ {
/* four digits, \n and trailing \0 */ /* four digits, \n and trailing \0 */
char mybuf[6];
struct mca_device *mca_dev = to_mca_device(dev); struct mca_device *mca_dev = to_mca_device(dev);
int len; int len;
if(mca_dev->pos_id < MCA_DUMMY_POS_START) if(mca_dev->pos_id < MCA_DUMMY_POS_START)
len = sprintf(mybuf, "%04x\n", mca_dev->pos_id); len = sprintf(buf, "%04x\n", mca_dev->pos_id);
else else
len = sprintf(mybuf, "none\n"); len = sprintf(buf, "none\n");
len++;
if(len > off) {
len = min((size_t)(len - off), count);
memcpy(buf + off, mybuf + off, len);
} else {
len = 0;
}
return len; return len;
} }
static ssize_t mca_show_pos(struct device *dev, char *buf, size_t count, static ssize_t mca_show_pos(struct device *dev, char *buf)
loff_t off)
{ {
/* enough for 8 two byte hex chars plus space and new line */ /* enough for 8 two byte hex chars plus space and new line */
char mybuf[26];
int j, len=0; int j, len=0;
struct mca_device *mca_dev = to_mca_device(dev); struct mca_device *mca_dev = to_mca_device(dev);
for(j=0; j<8; j++) for(j=0; j<8; j++)
len += sprintf(mybuf+len, "%02x ", mca_dev->pos[j]); len += sprintf(buf+len, "%02x ", mca_dev->pos[j]);
/* change last trailing space to new line */ /* change last trailing space to new line */
mybuf[len-1] = '\n'; buf[len-1] = '\n';
len++;
if(len > off) {
len = min((size_t)(len - off), count);
memcpy(buf + off, mybuf + off, len);
} else {
len = 0;
}
return len; return len;
} }
......
...@@ -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);
......
...@@ -284,7 +284,7 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, char *buf) ...@@ -284,7 +284,7 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, char *buf)
} }
static ssize_t static ssize_t
pnp_set_current_resources(struct device * dmdev, const char * buf) pnp_set_current_resources(struct device * dmdev, const char * buf, size_t count)
{ {
struct pnp_dev *dev = to_pnp_dev(dmdev); struct pnp_dev *dev = to_pnp_dev(dmdev);
char command[20]; char command[20];
...@@ -326,7 +326,7 @@ pnp_set_current_resources(struct device * dmdev, const char * buf) ...@@ -326,7 +326,7 @@ pnp_set_current_resources(struct device * dmdev, const char * buf)
goto done; goto done;
} }
done: done:
return error < 0 ? error : strlen(buf); return error < 0 ? error : count;
} }
static DEVICE_ATTR(resources,S_IRUGO | S_IWUSR, static DEVICE_ATTR(resources,S_IRUGO | S_IWUSR,
......
...@@ -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");
......
...@@ -1949,28 +1949,22 @@ dasd_generic_set_offline (struct ccw_device *cdev) ...@@ -1949,28 +1949,22 @@ dasd_generic_set_offline (struct ccw_device *cdev)
* readonly controls the readonly status of a dasd * readonly controls the readonly status of a dasd
*/ */
static ssize_t static ssize_t
dasd_ro_show(struct device *dev, char *buf, size_t count, loff_t off) dasd_ro_show(struct device *dev, char *buf)
{ {
dasd_device_t *device; dasd_device_t *device;
if (off)
return 0;
device = dev->driver_data; device = dev->driver_data;
if (!device) if (!device)
return snprintf(buf, count, "n/a\n"); return snprintf(buf, PAGE_SIZE, "n/a\n");
return snprintf(buf, count, device->ro_flag ? "1\n" : "0\n"); return snprintf(buf, PAGE_SIZE, device->ro_flag ? "1\n" : "0\n");
} }
static ssize_t static ssize_t
dasd_ro_store(struct device *dev, const char *buf, size_t count, loff_t off) dasd_ro_store(struct device *dev, const char *buf, size_t count)
{ {
dasd_device_t *device = dev->driver_data; dasd_device_t *device = dev->driver_data;
if (off)
return 0;
if (device) if (device)
device->ro_flag = (buf[0] == '1') ? 1 : 0; device->ro_flag = (buf[0] == '1') ? 1 : 0;
return count; return count;
...@@ -1984,29 +1978,22 @@ static DEVICE_ATTR(readonly, 0644, dasd_ro_show, dasd_ro_store); ...@@ -1984,29 +1978,22 @@ static DEVICE_ATTR(readonly, 0644, dasd_ro_show, dasd_ro_store);
*/ */
/* TODO: Implement */ /* TODO: Implement */
static ssize_t static ssize_t
dasd_use_diag_show(struct device *dev, char *buf, size_t count, loff_t off) dasd_use_diag_show(struct device *dev, char *buf)
{ {
dasd_device_t *device; dasd_device_t *device;
if (off)
return 0;
device = dev->driver_data; device = dev->driver_data;
if (!device) if (!device)
return snprintf(buf, count, "n/a\n"); return sprintf(buf, "n/a\n");
return snprintf(buf, count, device->use_diag_flag ? "1\n" : "0\n"); return sprintf(buf, device->use_diag_flag ? "1\n" : "0\n");
} }
static ssize_t static ssize_t
dasd_use_diag_store(struct device *dev, const char *buf, dasd_use_diag_store(struct device *dev, const char *buf, size_t count)
size_t count, loff_t off)
{ {
dasd_device_t *device = dev->driver_data; dasd_device_t *device = dev->driver_data;
if (off)
return 0;
if (device) if (device)
device->use_diag_flag = (buf[0] == '1') ? 1 : 0; device->use_diag_flag = (buf[0] == '1') ? 1 : 0;
return count; return count;
...@@ -2020,43 +2007,38 @@ DEVICE_ATTR(use_diag, 0644, dasd_use_diag_show, dasd_use_diag_store); ...@@ -2020,43 +2007,38 @@ DEVICE_ATTR(use_diag, 0644, dasd_use_diag_show, dasd_use_diag_store);
* an inaccaptable interface */ * an inaccaptable interface */
/* TODO: Split this up into smaller files! */ /* TODO: Split this up into smaller files! */
static ssize_t static ssize_t
dasd_devices_show(struct device *dev, char *buf, size_t count, loff_t off) dasd_devices_show(struct device *dev, char *buf)
{ {
dasd_device_t *device; dasd_device_t *device;
dasd_devmap_t *devmap; dasd_devmap_t *devmap;
if (off) /* ignore partial write */
return 0;
devmap = NULL; devmap = NULL;
device = dev->driver_data; device = dev->driver_data;
if (device) if (device)
devmap = dasd_devmap_from_devno(device->devno); devmap = dasd_devmap_from_devno(device->devno);
if (!devmap) if (!devmap)
return snprintf(buf, count, "unused\n"); return sprintf(buf, "unused\n");
return min ((size_t) dasd_devices_print(devmap, buf), count); return min ((size_t) dasd_devices_print(devmap, buf), PAGE_SIZE);
} }
static DEVICE_ATTR(dasd, 0444, dasd_devices_show, 0); static DEVICE_ATTR(dasd, 0444, dasd_devices_show, 0);
#endif #endif
static ssize_t static ssize_t
dasd_discipline_show(struct device *dev, char *buf, size_t count, loff_t off) dasd_discipline_show(struct device *dev, char *buf)
{ {
dasd_device_t *device; dasd_device_t *device;
if (off)
return 0;
device = dev->driver_data; device = dev->driver_data;
if (!device || !device->discipline) if (!device || !device->discipline)
return snprintf(buf, count, "none\n"); return sprintf(buf, "none\n");
return snprintf(buf, count, "%s\n", device->discipline->name); return snprintf(buf, PAGE_SIZE, "%s\n", device->discipline->name);
} }
static DEVICE_ATTR(discipline, 0444, dasd_discipline_show, 0); static DEVICE_ATTR(discipline, 0444, dasd_discipline_show, NULL);
static int static int
dasd_add_sysfs_files(struct ccw_device *cdev) dasd_add_sysfs_files(struct ccw_device *cdev)
......
...@@ -185,15 +185,11 @@ ccwgroup_set_offline(struct ccwgroup_device *gdev) ...@@ -185,15 +185,11 @@ ccwgroup_set_offline(struct ccwgroup_device *gdev)
} }
static ssize_t static ssize_t
ccwgroup_online_store (struct device *dev, const char *buf, size_t count, ccwgroup_online_store (struct device *dev, const char *buf, size_t count)
loff_t off)
{ {
struct ccwgroup_device *gdev; struct ccwgroup_device *gdev;
unsigned int value; unsigned int value;
if (off)
return 0;
gdev = to_ccwgroupdev(dev); gdev = to_ccwgroupdev(dev);
if (!dev->driver) if (!dev->driver)
return count; return count;
...@@ -209,16 +205,13 @@ ccwgroup_online_store (struct device *dev, const char *buf, size_t count, ...@@ -209,16 +205,13 @@ ccwgroup_online_store (struct device *dev, const char *buf, size_t count,
} }
static ssize_t static ssize_t
ccwgroup_online_show (struct device *dev, char *buf, size_t count, loff_t off) ccwgroup_online_show (struct device *dev, char *buf)
{ {
int online; int online;
if (off)
return 0;
online = (to_ccwgroupdev(dev)->state == CCWGROUP_ONLINE); online = (to_ccwgroupdev(dev)->state == CCWGROUP_ONLINE);
return snprintf(buf, count, online ? "1\n" : "0\n"); return sprintf(buf, online ? "1\n" : "0\n");
} }
static DEVICE_ATTR(online, 0644, ccwgroup_online_show, ccwgroup_online_store); static DEVICE_ATTR(online, 0644, ccwgroup_online_show, ccwgroup_online_store);
......
...@@ -606,30 +606,30 @@ s390_vary_chpid( __u8 chpid, int on) ...@@ -606,30 +606,30 @@ s390_vary_chpid( __u8 chpid, int on)
* Files for the channel path entries. * Files for the channel path entries.
*/ */
static ssize_t static ssize_t
chp_status_show(struct device *dev, char *buf, size_t count, loff_t off) chp_status_show(struct device *dev, char *buf)
{ {
struct sys_device *sdev = container_of(dev, struct sys_device, dev); struct sys_device *sdev = container_of(dev, struct sys_device, dev);
struct channel_path *chp = container_of(sdev, struct channel_path, sdev); struct channel_path *chp = container_of(sdev, struct channel_path, sdev);
if (!chp) if (!chp)
return off ? 0 : count; return 0;
switch(chp->state) { switch(chp->state) {
case CHP_OFFLINE: case CHP_OFFLINE:
return off ? 0 : snprintf(buf, count, "n/a\n"); return snprintf(buf, count, "n/a\n");
case CHP_LOGICALLY_OFFLINE: case CHP_LOGICALLY_OFFLINE:
return off ? 0 : snprintf(buf, count, "logically offline\n"); return snprintf(buf, count, "logically offline\n");
case CHP_STANDBY: case CHP_STANDBY:
return off ? 0 : snprintf(buf, count, "n/a\n"); return snprintf(buf, count, "n/a\n");
case CHP_ONLINE: case CHP_ONLINE:
return off ? 0 : snprintf(buf, count, "online\n"); return snprintf(buf, count, "online\n");
default: default:
return off ? 0 : count; return 0;
} }
} }
static ssize_t static ssize_t
chp_status_write(struct device *dev, const char *buf, size_t count, loff_t off) chp_status_write(struct device *dev, const char *buf, size_t count)
{ {
struct sys_device *sdev = container_of(dev, struct sys_device, dev); struct sys_device *sdev = container_of(dev, struct sys_device, dev);
struct channel_path *cp = container_of(sdev, struct channel_path, sdev); struct channel_path *cp = container_of(sdev, struct channel_path, sdev);
...@@ -637,9 +637,6 @@ chp_status_write(struct device *dev, const char *buf, size_t count, loff_t off) ...@@ -637,9 +637,6 @@ chp_status_write(struct device *dev, const char *buf, size_t count, loff_t off)
int num_args; int num_args;
int error; int error;
if (off)
return 0;
num_args = sscanf(buf, "%5s", cmd); num_args = sscanf(buf, "%5s", cmd);
if (!num_args) if (!num_args)
return count; return count;
......
...@@ -157,7 +157,7 @@ module_exit(cleanup_ccw_bus_type); ...@@ -157,7 +157,7 @@ module_exit(cleanup_ccw_bus_type);
* TODO: Split chpids and pimpampom up? Where is "in use" in the tree? * TODO: Split chpids and pimpampom up? Where is "in use" in the tree?
*/ */
static ssize_t static ssize_t
chpids_show (struct device * dev, char * buf, size_t count, loff_t off) chpids_show (struct device * dev, char * buf)
{ {
struct subchannel *sch = to_subchannel(dev); struct subchannel *sch = to_subchannel(dev);
struct ssd_info *ssd = &sch->ssd_info; struct ssd_info *ssd = &sch->ssd_info;
...@@ -168,48 +168,48 @@ chpids_show (struct device * dev, char * buf, size_t count, loff_t off) ...@@ -168,48 +168,48 @@ chpids_show (struct device * dev, char * buf, size_t count, loff_t off)
ret += sprintf (buf+ret, "%02x ", ssd->chpid[chp]); ret += sprintf (buf+ret, "%02x ", ssd->chpid[chp]);
ret += sprintf (buf+ret, "\n"); ret += sprintf (buf+ret, "\n");
return off ? 0 : min((ssize_t)count, ret); return min((ssize_t)PAGE_SIZE, ret);
} }
static ssize_t static ssize_t
pimpampom_show (struct device * dev, char * buf, size_t count, loff_t off) pimpampom_show (struct device * dev, char * buf)
{ {
struct subchannel *sch = to_subchannel(dev); struct subchannel *sch = to_subchannel(dev);
struct pmcw *pmcw = &sch->schib.pmcw; struct pmcw *pmcw = &sch->schib.pmcw;
return off ? 0 : snprintf (buf, count, "%02x %02x %02x\n", return sprintf (buf, "%02x %02x %02x\n",
pmcw->pim, pmcw->pam, pmcw->pom); pmcw->pim, pmcw->pam, pmcw->pom);
} }
static ssize_t static ssize_t
devtype_show (struct device *dev, char *buf, size_t count, loff_t off) devtype_show (struct device *dev, char *buf)
{ {
struct ccw_device *cdev = to_ccwdev(dev); struct ccw_device *cdev = to_ccwdev(dev);
struct ccw_device_id *id = &(cdev->id); struct ccw_device_id *id = &(cdev->id);
if (id->dev_type != 0) if (id->dev_type != 0)
return off ? 0 : snprintf(buf, count, "%04x/%02x\n", return sprintf(buf, "%04x/%02x\n",
id->dev_type, id->dev_model); id->dev_type, id->dev_model);
else else
return off ? 0 : snprintf(buf, count, "n/a\n"); return sprintf(buf, "n/a\n");
} }
static ssize_t static ssize_t
cutype_show (struct device *dev, char *buf, size_t count, loff_t off) cutype_show (struct device *dev, char *buf)
{ {
struct ccw_device *cdev = to_ccwdev(dev); struct ccw_device *cdev = to_ccwdev(dev);
struct ccw_device_id *id = &(cdev->id); struct ccw_device_id *id = &(cdev->id);
return off ? 0 : snprintf(buf, count, "%04x/%02x\n", return sprintf(buf, "%04x/%02x\n",
id->cu_type, id->cu_model); id->cu_type, id->cu_model);
} }
static ssize_t static ssize_t
online_show (struct device *dev, char *buf, size_t count, loff_t off) online_show (struct device *dev, char *buf)
{ {
struct ccw_device *cdev = to_ccwdev(dev); struct ccw_device *cdev = to_ccwdev(dev);
return off ? 0 : snprintf(buf, count, cdev->online ? "yes\n" : "no\n"); return sprintf(buf, cdev->online ? "yes\n" : "no\n");
} }
void void
...@@ -256,14 +256,11 @@ ccw_device_set_online(struct ccw_device *cdev) ...@@ -256,14 +256,11 @@ ccw_device_set_online(struct ccw_device *cdev)
} }
static ssize_t static ssize_t
online_store (struct device *dev, const char *buf, size_t count, loff_t off) online_store (struct device *dev, const char *buf, size_t count)
{ {
struct ccw_device *cdev = to_ccwdev(dev); struct ccw_device *cdev = to_ccwdev(dev);
unsigned int value; unsigned int value;
if (off)
return 0;
if (!cdev->drv) if (!cdev->drv)
return count; return count;
......
...@@ -2512,27 +2512,24 @@ ctc_stats(struct net_device * dev) ...@@ -2512,27 +2512,24 @@ ctc_stats(struct net_device * dev)
#define CTRL_BUFSIZE 40 #define CTRL_BUFSIZE 40
static ssize_t static ssize_t
buffer_show(struct device *dev, char *buf, size_t count, loff_t off) buffer_show(struct device *dev, char *buf)
{ {
struct ctc_priv *priv; struct ctc_priv *priv;
priv = dev->driver_data; priv = dev->driver_data;
if (!priv) if (!priv)
return -ENODEV; return -ENODEV;
return off ? 0 : snprintf(buf, count, "%d\n", return sprintf(buf, "%d\n",
priv->channel[READ]->max_bufsize); priv->channel[READ]->max_bufsize);
} }
static ssize_t static ssize_t
buffer_write(struct device *dev, const char *buf, size_t count, loff_t off) buffer_write(struct device *dev, const char *buf, size_t count)
{ {
struct ctc_priv *priv; struct ctc_priv *priv;
struct net_device *ndev; struct net_device *ndev;
int bs1; int bs1;
if (off)
return 0;
priv = dev->driver_data; priv = dev->driver_data;
if (!priv) if (!priv)
return -ENODEV; return -ENODEV;
......
...@@ -1637,32 +1637,30 @@ lcs_open_device(struct net_device *dev) ...@@ -1637,32 +1637,30 @@ lcs_open_device(struct net_device *dev)
* show function for portno called by cat or similar things * show function for portno called by cat or similar things
*/ */
static ssize_t static ssize_t
lcs_portno_show (struct device *dev, char *buf, size_t count, lcs_portno_show (struct device *dev, char *buf)
loff_t off)
{ {
struct lcs_card *card; struct lcs_card *card;
card = (struct lcs_card *)dev->driver_data; card = (struct lcs_card *)dev->driver_data;
if (off || !card) if (!card)
return 0; return 0;
return snprintf(buf, count, "%d\n", card->portno); return sprintf(buf, "%d\n", card->portno);
} }
/** /**
* store the value which is piped to file portno * store the value which is piped to file portno
*/ */
static ssize_t static ssize_t
lcs_portno_store (struct device *dev, const char *buf, size_t count, lcs_portno_store (struct device *dev, const char *buf, size_t count)
loff_t off)
{ {
struct lcs_card *card; struct lcs_card *card;
int value; int value;
card = (struct lcs_card *)dev->driver_data; card = (struct lcs_card *)dev->driver_data;
if (off || !card) if (!card)
return 0; return 0;
sscanf(buf, "%u", &value); sscanf(buf, "%u", &value);
......
...@@ -1259,16 +1259,16 @@ netiucv_change_mtu (net_device * dev, int new_mtu) ...@@ -1259,16 +1259,16 @@ netiucv_change_mtu (net_device * dev, int new_mtu)
#define CTRL_BUFSIZE 40 #define CTRL_BUFSIZE 40
static ssize_t static ssize_t
user_show (struct device *dev, char *buf, size_t count, loff_t off) user_show (struct device *dev, char *buf)
{ {
netiucv_priv *priv = dev->driver_data; netiucv_priv *priv = dev->driver_data;
return off ? 0 : snprintf(buf, count, "%s\n", return snprintf(buf, PAGE_SIZE, "%s\n",
netiucv_printname(priv->conn->userid)); netiucv_printname(priv->conn->userid));
} }
static ssize_t static ssize_t
user_write (struct device *dev, const char *buf, size_t count, loff_t off) user_write (struct device *dev, const char *buf, size_t count)
{ {
netiucv_priv *priv = dev->driver_data; netiucv_priv *priv = dev->driver_data;
struct net_device *ndev = container_of((void *)priv, struct net_device, priv); struct net_device *ndev = container_of((void *)priv, struct net_device, priv);
...@@ -1305,16 +1305,16 @@ user_write (struct device *dev, const char *buf, size_t count, loff_t off) ...@@ -1305,16 +1305,16 @@ user_write (struct device *dev, const char *buf, size_t count, loff_t off)
static DEVICE_ATTR(user, 0644, user_show, user_write); static DEVICE_ATTR(user, 0644, user_show, user_write);
static ssize_t static ssize_t
buffer_show (struct device *dev, char *buf, size_t count, loff_t off) buffer_show (struct device *dev, char *buf)
{ {
netiucv_priv *priv = dev->driver_data; netiucv_priv *priv = dev->driver_data;
return off ? 0 : snprintf(buf, count, "%d\n", return sprintf(buf, "%d\n",
priv->conn->max_buffsize); priv->conn->max_buffsize);
} }
static ssize_t static ssize_t
buffer_write (struct device *dev, const char *buf, size_t count, loff_t off) buffer_write (struct device *dev, const char *buf, size_t count)
{ {
netiucv_priv *priv = dev->driver_data; netiucv_priv *priv = dev->driver_data;
struct net_device *ndev = container_of((void *)priv, struct net_device, priv); struct net_device *ndev = container_of((void *)priv, struct net_device, priv);
...@@ -1352,38 +1352,37 @@ buffer_write (struct device *dev, const char *buf, size_t count, loff_t off) ...@@ -1352,38 +1352,37 @@ buffer_write (struct device *dev, const char *buf, size_t count, loff_t off)
static DEVICE_ATTR(buffer, 0644, buffer_show, buffer_write); static DEVICE_ATTR(buffer, 0644, buffer_show, buffer_write);
static ssize_t static ssize_t
dev_fsm_show (struct device *dev, char *buf, size_t count, loff_t off) dev_fsm_show (struct device *dev, char *buf)
{ {
netiucv_priv *priv = dev->driver_data; netiucv_priv *priv = dev->driver_data;
return off ? 0 : snprintf(buf, count, "%s\n", return snprintf(buf, PAGE_SIZE, "%s\n",
fsm_getstate_str(priv->fsm)); fsm_getstate_str(priv->fsm));
} }
static DEVICE_ATTR(device_fsm_state, 0444, dev_fsm_show, NULL); static DEVICE_ATTR(device_fsm_state, 0444, dev_fsm_show, NULL);
static ssize_t static ssize_t
conn_fsm_show (struct device *dev, char *buf, size_t count, loff_t off) conn_fsm_show (struct device *dev, char *buf)
{ {
netiucv_priv *priv = dev->driver_data; netiucv_priv *priv = dev->driver_data;
return off ? 0 : snprintf(buf, count, "%s\n", return snprintf(buf, PAGE_SIZE, "%s\n",
fsm_getstate_str(priv->conn->fsm)); fsm_getstate_str(priv->conn->fsm));
} }
static DEVICE_ATTR(connection_fsm_state, 0444, conn_fsm_show, NULL); static DEVICE_ATTR(connection_fsm_state, 0444, conn_fsm_show, NULL);
static ssize_t static ssize_t
maxmulti_show (struct device *dev, char *buf, size_t count, loff_t off) maxmulti_show (struct device *dev, char *buf)
{ {
netiucv_priv *priv = dev->driver_data; netiucv_priv *priv = dev->driver_data;
return off ? 0 : snprintf(buf, count, "%ld\n", return sprintf(buf, "%ld\n", priv->conn->prof.maxmulti);
priv->conn->prof.maxmulti);
} }
static ssize_t static ssize_t
maxmulti_write (struct device *dev, const char *buf, size_t count, loff_t off) maxmulti_write (struct device *dev, const char *buf, size_t count)
{ {
netiucv_priv *priv = dev->driver_data; netiucv_priv *priv = dev->driver_data;
...@@ -1394,16 +1393,15 @@ maxmulti_write (struct device *dev, const char *buf, size_t count, loff_t off) ...@@ -1394,16 +1393,15 @@ maxmulti_write (struct device *dev, const char *buf, size_t count, loff_t off)
static DEVICE_ATTR(max_tx_buffer_used, 0644, maxmulti_show, maxmulti_write); static DEVICE_ATTR(max_tx_buffer_used, 0644, maxmulti_show, maxmulti_write);
static ssize_t static ssize_t
maxcq_show (struct device *dev, char *buf, size_t count, loff_t off) maxcq_show (struct device *dev, char *buf)
{ {
netiucv_priv *priv = dev->driver_data; netiucv_priv *priv = dev->driver_data;
return off ? 0 : snprintf(buf, count, "%ld\n", return sprintf(buf, "%ld\n", priv->conn->prof.maxcqueue);
priv->conn->prof.maxcqueue);
} }
static ssize_t static ssize_t
maxcq_write (struct device *dev, const char *buf, size_t count, loff_t off) maxcq_write (struct device *dev, const char *buf, size_t count)
{ {
netiucv_priv *priv = dev->driver_data; netiucv_priv *priv = dev->driver_data;
...@@ -1414,16 +1412,15 @@ maxcq_write (struct device *dev, const char *buf, size_t count, loff_t off) ...@@ -1414,16 +1412,15 @@ maxcq_write (struct device *dev, const char *buf, size_t count, loff_t off)
static DEVICE_ATTR(max_chained_skbs, 0644, maxcq_show, maxcq_write); static DEVICE_ATTR(max_chained_skbs, 0644, maxcq_show, maxcq_write);
static ssize_t static ssize_t
sdoio_show (struct device *dev, char *buf, size_t count, loff_t off) sdoio_show (struct device *dev, char *buf)
{ {
netiucv_priv *priv = dev->driver_data; netiucv_priv *priv = dev->driver_data;
return off ? 0 : snprintf(buf, count, "%ld\n", return sprintf(buf, "%ld\n", priv->conn->prof.doios_single);
priv->conn->prof.doios_single);
} }
static ssize_t static ssize_t
sdoio_write (struct device *dev, const char *buf, size_t count, loff_t off) sdoio_write (struct device *dev, const char *buf, size_t count)
{ {
netiucv_priv *priv = dev->driver_data; netiucv_priv *priv = dev->driver_data;
...@@ -1434,16 +1431,15 @@ sdoio_write (struct device *dev, const char *buf, size_t count, loff_t off) ...@@ -1434,16 +1431,15 @@ sdoio_write (struct device *dev, const char *buf, size_t count, loff_t off)
static DEVICE_ATTR(tx_single_write_ops, 0644, sdoio_show, sdoio_write); static DEVICE_ATTR(tx_single_write_ops, 0644, sdoio_show, sdoio_write);
static ssize_t static ssize_t
mdoio_show (struct device *dev, char *buf, size_t count, loff_t off) mdoio_show (struct device *dev, char *buf)
{ {
netiucv_priv *priv = dev->driver_data; netiucv_priv *priv = dev->driver_data;
return off ? 0 : snprintf(buf, count, "%ld\n", return sprintf(buf, "%ld\n", priv->conn->prof.doios_multi);
priv->conn->prof.doios_multi);
} }
static ssize_t static ssize_t
mdoio_write (struct device *dev, const char *buf, size_t count, loff_t off) mdoio_write (struct device *dev, const char *buf, size_t count)
{ {
netiucv_priv *priv = dev->driver_data; netiucv_priv *priv = dev->driver_data;
...@@ -1454,16 +1450,15 @@ mdoio_write (struct device *dev, const char *buf, size_t count, loff_t off) ...@@ -1454,16 +1450,15 @@ mdoio_write (struct device *dev, const char *buf, size_t count, loff_t off)
static DEVICE_ATTR(tx_multi_write_ops, 0644, mdoio_show, mdoio_write); static DEVICE_ATTR(tx_multi_write_ops, 0644, mdoio_show, mdoio_write);
static ssize_t static ssize_t
txlen_show (struct device *dev, char *buf, size_t count, loff_t off) txlen_show (struct device *dev, char *buf)
{ {
netiucv_priv *priv = dev->driver_data; netiucv_priv *priv = dev->driver_data;
return off ? 0 : snprintf(buf, count, "%ld\n", return sprintf(buf, "%ld\n", priv->conn->prof.txlen);
priv->conn->prof.txlen);
} }
static ssize_t static ssize_t
txlen_write (struct device *dev, const char *buf, size_t count, loff_t off) txlen_write (struct device *dev, const char *buf, size_t count)
{ {
netiucv_priv *priv = dev->driver_data; netiucv_priv *priv = dev->driver_data;
...@@ -1474,16 +1469,15 @@ txlen_write (struct device *dev, const char *buf, size_t count, loff_t off) ...@@ -1474,16 +1469,15 @@ txlen_write (struct device *dev, const char *buf, size_t count, loff_t off)
static DEVICE_ATTR(netto_bytes, 0644, txlen_show, txlen_write); static DEVICE_ATTR(netto_bytes, 0644, txlen_show, txlen_write);
static ssize_t static ssize_t
txtime_show (struct device *dev, char *buf, size_t count, loff_t off) txtime_show (struct device *dev, char *buf)
{ {
netiucv_priv *priv = dev->driver_data; netiucv_priv *priv = dev->driver_data;
return off ? 0 : snprintf(buf, count, "%ld\n", return snprintf(buf, count, "%ld\n", priv->conn->prof.tx_time);
priv->conn->prof.tx_time);
} }
static ssize_t static ssize_t
txtime_write (struct device *dev, const char *buf, size_t count, loff_t off) txtime_write (struct device *dev, const char *buf)
{ {
netiucv_priv *priv = dev->driver_data; netiucv_priv *priv = dev->driver_data;
......
...@@ -5325,17 +5325,17 @@ __setup("osst=", osst_setup); ...@@ -5325,17 +5325,17 @@ __setup("osst=", osst_setup);
#endif #endif
/* Driverfs file support */ /* Driverfs file support */
static ssize_t osst_device_kdev_read(struct device *driverfs_dev, char *page, size_t count, loff_t off) static ssize_t osst_device_kdev_read(struct device *driverfs_dev, char *page)
{ {
kdev_t kdev; kdev_t kdev;
kdev.value=(int)(long)driverfs_dev->driver_data; kdev.value=(int)(long)driverfs_dev->driver_data;
return off ? 0 : sprintf(page, "%x\n",kdev.value); return sprintf(page, "%x\n",kdev.value);
} }
static DEVICE_ATTR(kdev,S_IRUGO,osst_device_kdev_read,NULL); static DEVICE_ATTR(kdev,S_IRUGO,osst_device_kdev_read,NULL);
static ssize_t osst_device_type_read(struct device *driverfs_dev, char *page, size_t count, loff_t off) static ssize_t osst_device_type_read(struct device *driverfs_dev, char *page)
{ {
return off ? 0 : sprintf (page, "CHR\n"); return sprintf (page, "CHR\n");
} }
static DEVICE_ATTR(type,S_IRUGO,osst_device_type_read,NULL); static DEVICE_ATTR(type,S_IRUGO,osst_device_type_read,NULL);
......
...@@ -158,12 +158,12 @@ static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL) ...@@ -158,12 +158,12 @@ static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL)
show_function(field, format_string) \ show_function(field, format_string) \
\ \
static ssize_t \ static ssize_t \
store_##field (struct device *dev, const char *buf) \ store_##field (struct device *dev, const char *buf, size_t count) \
{ \ { \
struct scsi_device *sdev; \ struct scsi_device *sdev; \
sdev = to_scsi_device(dev); \ sdev = to_scsi_device(dev); \
snscanf (buf, 20, format_string, &sdev->field); \ snscanf (buf, 20, format_string, &sdev->field); \
return strlen(buf); \ return count; \
} \ } \
static DEVICE_ATTR(field, S_IRUGO | S_IWUSR, show_##field, store_##field) static DEVICE_ATTR(field, S_IRUGO | S_IWUSR, show_##field, store_##field)
...@@ -175,7 +175,7 @@ static DEVICE_ATTR(field, S_IRUGO | S_IWUSR, show_##field, store_##field) ...@@ -175,7 +175,7 @@ static DEVICE_ATTR(field, S_IRUGO | S_IWUSR, show_##field, store_##field)
show_function(field, "%d\n") \ show_function(field, "%d\n") \
\ \
static ssize_t \ static ssize_t \
store_##field (struct device *dev, const char *buf) \ store_##field (struct device *dev, const char *buf, size_t count) \
{ \ { \
int ret; \ int ret; \
struct scsi_device *sdev; \ struct scsi_device *sdev; \
...@@ -183,7 +183,7 @@ store_##field (struct device *dev, const char *buf) \ ...@@ -183,7 +183,7 @@ store_##field (struct device *dev, const char *buf) \
if (ret >= 0) { \ if (ret >= 0) { \
sdev = to_scsi_device(dev); \ sdev = to_scsi_device(dev); \
sdev->field = ret; \ sdev->field = ret; \
ret = strlen(buf); \ ret = count; \
} \ } \
return ret; \ return ret; \
} \ } \
......
...@@ -3615,19 +3615,17 @@ __setup("st=", st_setup); ...@@ -3615,19 +3615,17 @@ __setup("st=", st_setup);
#endif #endif
/* Driverfs file support */ /* Driverfs file support */
static ssize_t st_device_kdev_read(struct device *driverfs_dev, static ssize_t st_device_kdev_read(struct device *dev, char *page)
char *page, size_t count, loff_t off)
{ {
kdev_t kdev; kdev_t kdev;
kdev.value=(int)(long)driverfs_dev->driver_data; kdev.value=(int)dev->driver_data;
return off ? 0 : sprintf(page, "%x\n",kdev.value); return sprintf(page, "%x\n",kdev.value);
} }
static DEVICE_ATTR(kdev,S_IRUGO,st_device_kdev_read,NULL); static DEVICE_ATTR(kdev,S_IRUGO,st_device_kdev_read,NULL);
static ssize_t st_device_type_read(struct device *driverfs_dev, static ssize_t st_device_type_read(struct device *ev, char * page)
char *page, size_t count, loff_t off)
{ {
return off ? 0 : sprintf (page, "CHR\n"); return sprintf (page, "CHR\n");
} }
static DEVICE_ATTR(type,S_IRUGO,st_device_type_read,NULL); static DEVICE_ATTR(type,S_IRUGO,st_device_type_read,NULL);
......
...@@ -482,7 +482,7 @@ nfsd_proc_readdir(struct svc_rqst *rqstp, struct nfsd_readdirargs *argp, ...@@ -482,7 +482,7 @@ nfsd_proc_readdir(struct svc_rqst *rqstp, struct nfsd_readdirargs *argp,
resp->count = resp->buffer - argp->buffer; resp->count = resp->buffer - argp->buffer;
if (resp->offset) if (resp->offset)
*resp->offset = (u32)offset; *resp->offset = htonl(offset);
fh_put(&argp->fh); fh_put(&argp->fh);
return nfserr; return nfserr;
......
...@@ -167,14 +167,15 @@ subsys_attr_show(struct kobject * kobj, struct attribute * attr, char * page) ...@@ -167,14 +167,15 @@ subsys_attr_show(struct kobject * kobj, struct attribute * attr, char * page)
} }
static ssize_t static ssize_t
subsys_attr_store(struct kobject * kobj, struct attribute * attr, const char * page) subsys_attr_store(struct kobject * kobj, struct attribute * attr,
const char * page, size_t count)
{ {
struct subsystem * s = to_subsys(kobj); struct subsystem * s = to_subsys(kobj);
struct subsys_attribute * sattr = to_sattr(attr); struct subsys_attribute * sattr = to_sattr(attr);
ssize_t ret = 0; ssize_t ret = 0;
if (sattr->store) if (sattr->store)
ret = sattr->store(s,page); ret = sattr->store(s,page,count);
return ret; return ret;
} }
...@@ -247,7 +248,7 @@ static int flush_read_buffer(struct sysfs_buffer * buffer, char * buf, ...@@ -247,7 +248,7 @@ static int flush_read_buffer(struct sysfs_buffer * buffer, char * buf,
error = copy_to_user(buf,buffer->page + *ppos,count); error = copy_to_user(buf,buffer->page + *ppos,count);
if (!error) if (!error)
*ppos += count; *ppos += count;
return error ? error : count; return error ? -EFAULT : count;
} }
/** /**
...@@ -308,7 +309,7 @@ fill_write_buffer(struct sysfs_buffer * buffer, const char * buf, size_t count) ...@@ -308,7 +309,7 @@ fill_write_buffer(struct sysfs_buffer * buffer, const char * buf, size_t count)
if (count >= PAGE_SIZE) if (count >= PAGE_SIZE)
count = PAGE_SIZE - 1; count = PAGE_SIZE - 1;
error = copy_from_user(buffer->page,buf,count); error = copy_from_user(buffer->page,buf,count);
return error ? error : count; return error ? -EFAULT : count;
} }
...@@ -322,13 +323,14 @@ fill_write_buffer(struct sysfs_buffer * buffer, const char * buf, size_t count) ...@@ -322,13 +323,14 @@ fill_write_buffer(struct sysfs_buffer * buffer, const char * buf, size_t count)
* passing the buffer that we acquired in fill_write_buffer(). * passing the buffer that we acquired in fill_write_buffer().
*/ */
static int flush_write_buffer(struct file * file, struct sysfs_buffer * buffer) static int
flush_write_buffer(struct file * file, struct sysfs_buffer * buffer, size_t count)
{ {
struct attribute * attr = file->f_dentry->d_fsdata; struct attribute * attr = file->f_dentry->d_fsdata;
struct kobject * kobj = file->f_dentry->d_parent->d_fsdata; struct kobject * kobj = file->f_dentry->d_parent->d_fsdata;
struct sysfs_ops * ops = buffer->ops; struct sysfs_ops * ops = buffer->ops;
return ops->store(kobj,attr,buffer->page); return ops->store(kobj,attr,buffer->page,count);
} }
...@@ -356,7 +358,7 @@ sysfs_write_file(struct file *file, const char *buf, size_t count, loff_t *ppos) ...@@ -356,7 +358,7 @@ sysfs_write_file(struct file *file, const char *buf, size_t count, loff_t *ppos)
count = fill_write_buffer(buffer,buf,count); count = fill_write_buffer(buffer,buf,count);
if (count > 0) if (count > 0)
count = flush_write_buffer(file,buffer); count = flush_write_buffer(file,buffer,count);
if (count > 0) if (count > 0)
*ppos += count; *ppos += count;
return count; return count;
......
...@@ -98,7 +98,7 @@ int bus_for_each_drv(struct bus_type * bus, struct device_driver * start, ...@@ -98,7 +98,7 @@ int bus_for_each_drv(struct bus_type * bus, struct device_driver * start,
struct bus_attribute { struct bus_attribute {
struct attribute attr; struct attribute attr;
ssize_t (*show)(struct bus_type *, char * buf); ssize_t (*show)(struct bus_type *, char * buf);
ssize_t (*store)(struct bus_type *, const char * buf); ssize_t (*store)(struct bus_type *, const char * buf, size_t count);
}; };
#define BUS_ATTR(_name,_mode,_show,_store) \ #define BUS_ATTR(_name,_mode,_show,_store) \
...@@ -141,7 +141,7 @@ extern void put_driver(struct device_driver * drv); ...@@ -141,7 +141,7 @@ extern void put_driver(struct device_driver * drv);
struct driver_attribute { struct driver_attribute {
struct attribute attr; struct attribute attr;
ssize_t (*show)(struct device_driver *, char * buf); ssize_t (*show)(struct device_driver *, char * buf);
ssize_t (*store)(struct device_driver *, const char * buf); ssize_t (*store)(struct device_driver *, const char * buf, size_t count);
}; };
#define DRIVER_ATTR(_name,_mode,_show,_store) \ #define DRIVER_ATTR(_name,_mode,_show,_store) \
...@@ -182,7 +182,7 @@ extern void put_devclass(struct device_class *); ...@@ -182,7 +182,7 @@ extern void put_devclass(struct device_class *);
struct devclass_attribute { struct devclass_attribute {
struct attribute attr; struct attribute attr;
ssize_t (*show)(struct device_class *, char * buf); ssize_t (*show)(struct device_class *, char * buf);
ssize_t (*store)(struct device_class *, const char * buf); ssize_t (*store)(struct device_class *, const char * buf, size_t count);
}; };
#define DEVCLASS_ATTR(_name,_str,_mode,_show,_store) \ #define DEVCLASS_ATTR(_name,_str,_mode,_show,_store) \
...@@ -320,7 +320,7 @@ extern void device_release_driver(struct device * dev); ...@@ -320,7 +320,7 @@ extern void device_release_driver(struct device * dev);
struct device_attribute { struct device_attribute {
struct attribute attr; struct attribute attr;
ssize_t (*show)(struct device * dev, char * buf); ssize_t (*show)(struct device * dev, char * buf);
ssize_t (*store)(struct device * dev, const char * buf); ssize_t (*store)(struct device * dev, const char * buf, size_t count);
}; };
#define DEVICE_ATTR(_name,_mode,_show,_store) \ #define DEVICE_ATTR(_name,_mode,_show,_store) \
......
...@@ -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 */
......
...@@ -166,7 +166,7 @@ static inline void subsys_put(struct subsystem * s) ...@@ -166,7 +166,7 @@ static inline void subsys_put(struct subsystem * s)
struct subsys_attribute { struct subsys_attribute {
struct attribute attr; struct attribute attr;
ssize_t (*show)(struct subsystem *, char *); ssize_t (*show)(struct subsystem *, char *);
ssize_t (*store)(struct subsystem *, const char *); ssize_t (*store)(struct subsystem *, const char *, size_t);
}; };
extern int subsys_create_file(struct subsystem * , struct subsys_attribute *); extern int subsys_create_file(struct subsystem * , struct subsys_attribute *);
......
...@@ -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;
}; };
......
...@@ -18,7 +18,7 @@ struct attribute { ...@@ -18,7 +18,7 @@ struct attribute {
struct sysfs_ops { struct sysfs_ops {
ssize_t (*show)(struct kobject *, struct attribute *,char *); ssize_t (*show)(struct kobject *, struct attribute *,char *);
ssize_t (*store)(struct kobject *,struct attribute *,const char *); ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t);
}; };
extern int extern int
......
...@@ -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