Commit 9dd78466 authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Linus Torvalds

PNP: Lindent all source files

Run Lindent on all PNP source files.

Produced by:

    $ quilt new pnp-lindent
    $ find drivers/pnp -name \*.[ch] | xargs quilt add
    $ quilt add include/linux/{pnp.h,pnpbios.h}
    $ scripts/Lindent drivers/pnp/*.c drivers/pnp/*/*.c include/linux/pnp*.h
    $ quilt refresh --sort
Signed-off-by: default avatarBjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Adam Belay <ambx1@neo.rr.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8ec3cf7d
This diff is collapsed.
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "base.h" #include "base.h"
static LIST_HEAD(pnp_protocols); static LIST_HEAD(pnp_protocols);
LIST_HEAD(pnp_global); LIST_HEAD(pnp_global);
DEFINE_SPINLOCK(pnp_lock); DEFINE_SPINLOCK(pnp_lock);
...@@ -36,7 +35,7 @@ void *pnp_alloc(long size) ...@@ -36,7 +35,7 @@ void *pnp_alloc(long size)
void *result; void *result;
result = kzalloc(size, GFP_KERNEL); result = kzalloc(size, GFP_KERNEL);
if (!result){ if (!result) {
printk(KERN_ERR "pnp: Out of Memory\n"); printk(KERN_ERR "pnp: Out of Memory\n");
return NULL; return NULL;
} }
...@@ -53,7 +52,7 @@ void *pnp_alloc(long size) ...@@ -53,7 +52,7 @@ void *pnp_alloc(long size)
int pnp_register_protocol(struct pnp_protocol *protocol) int pnp_register_protocol(struct pnp_protocol *protocol)
{ {
int nodenum; int nodenum;
struct list_head * pos; struct list_head *pos;
if (!protocol) if (!protocol)
return -EINVAL; return -EINVAL;
...@@ -64,9 +63,9 @@ int pnp_register_protocol(struct pnp_protocol *protocol) ...@@ -64,9 +63,9 @@ int pnp_register_protocol(struct pnp_protocol *protocol)
spin_lock(&pnp_lock); spin_lock(&pnp_lock);
/* assign the lowest unused number */ /* assign the lowest unused number */
list_for_each(pos,&pnp_protocols) { list_for_each(pos, &pnp_protocols) {
struct pnp_protocol * cur = to_pnp_protocol(pos); struct pnp_protocol *cur = to_pnp_protocol(pos);
if (cur->number == nodenum){ if (cur->number == nodenum) {
pos = &pnp_protocols; pos = &pnp_protocols;
nodenum++; nodenum++;
} }
...@@ -93,11 +92,10 @@ void pnp_unregister_protocol(struct pnp_protocol *protocol) ...@@ -93,11 +92,10 @@ void pnp_unregister_protocol(struct pnp_protocol *protocol)
device_unregister(&protocol->dev); device_unregister(&protocol->dev);
} }
static void pnp_free_ids(struct pnp_dev *dev) static void pnp_free_ids(struct pnp_dev *dev)
{ {
struct pnp_id * id; struct pnp_id *id;
struct pnp_id * next; struct pnp_id *next;
if (!dev) if (!dev)
return; return;
id = dev->id; id = dev->id;
...@@ -110,7 +108,7 @@ static void pnp_free_ids(struct pnp_dev *dev) ...@@ -110,7 +108,7 @@ static void pnp_free_ids(struct pnp_dev *dev)
static void pnp_release_device(struct device *dmdev) static void pnp_release_device(struct device *dmdev)
{ {
struct pnp_dev * dev = to_pnp_dev(dmdev); struct pnp_dev *dev = to_pnp_dev(dmdev);
pnp_free_option(dev->independent); pnp_free_option(dev->independent);
pnp_free_option(dev->dependent); pnp_free_option(dev->dependent);
pnp_free_ids(dev); pnp_free_ids(dev);
...@@ -149,7 +147,8 @@ int pnp_add_device(struct pnp_dev *dev) ...@@ -149,7 +147,8 @@ int pnp_add_device(struct pnp_dev *dev)
if (!dev || !dev->protocol || dev->card) if (!dev || !dev->protocol || dev->card)
return -EINVAL; return -EINVAL;
dev->dev.parent = &dev->protocol->dev; dev->dev.parent = &dev->protocol->dev;
sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number, dev->number); sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number,
dev->number);
return __pnp_add_device(dev); return __pnp_add_device(dev);
} }
......
...@@ -17,11 +17,9 @@ static int compare_func(const char *ida, const char *idb) ...@@ -17,11 +17,9 @@ static int compare_func(const char *ida, const char *idb)
{ {
int i; int i;
/* we only need to compare the last 4 chars */ /* we only need to compare the last 4 chars */
for (i=3; i<7; i++) for (i = 3; i < 7; i++) {
{
if (ida[i] != 'X' && if (ida[i] != 'X' &&
idb[i] != 'X' && idb[i] != 'X' && toupper(ida[i]) != toupper(idb[i]))
toupper(ida[i]) != toupper(idb[i]))
return 0; return 0;
} }
return 1; return 1;
...@@ -31,18 +29,19 @@ int compare_pnp_id(struct pnp_id *pos, const char *id) ...@@ -31,18 +29,19 @@ int compare_pnp_id(struct pnp_id *pos, const char *id)
{ {
if (!pos || !id || (strlen(id) != 7)) if (!pos || !id || (strlen(id) != 7))
return 0; return 0;
if (memcmp(id,"ANYDEVS",7)==0) if (memcmp(id, "ANYDEVS", 7) == 0)
return 1; return 1;
while (pos){ while (pos) {
if (memcmp(pos->id,id,3)==0) if (memcmp(pos->id, id, 3) == 0)
if (compare_func(pos->id,id)==1) if (compare_func(pos->id, id) == 1)
return 1; return 1;
pos = pos->next; pos = pos->next;
} }
return 0; return 0;
} }
static const struct pnp_device_id * match_device(struct pnp_driver *drv, struct pnp_dev *dev) static const struct pnp_device_id *match_device(struct pnp_driver *drv,
struct pnp_dev *dev)
{ {
const struct pnp_device_id *drv_id = drv->id_table; const struct pnp_device_id *drv_id = drv->id_table;
if (!drv_id) if (!drv_id)
...@@ -59,7 +58,7 @@ static const struct pnp_device_id * match_device(struct pnp_driver *drv, struct ...@@ -59,7 +58,7 @@ static const struct pnp_device_id * match_device(struct pnp_driver *drv, struct
int pnp_device_attach(struct pnp_dev *pnp_dev) int pnp_device_attach(struct pnp_dev *pnp_dev)
{ {
spin_lock(&pnp_lock); spin_lock(&pnp_lock);
if(pnp_dev->status != PNP_READY){ if (pnp_dev->status != PNP_READY) {
spin_unlock(&pnp_lock); spin_unlock(&pnp_lock);
return -EBUSY; return -EBUSY;
} }
...@@ -86,7 +85,8 @@ static int pnp_device_probe(struct device *dev) ...@@ -86,7 +85,8 @@ static int pnp_device_probe(struct device *dev)
pnp_dev = to_pnp_dev(dev); pnp_dev = to_pnp_dev(dev);
pnp_drv = to_pnp_driver(dev->driver); pnp_drv = to_pnp_driver(dev->driver);
pnp_dbg("match found with the PnP device '%s' and the driver '%s'", dev->bus_id,pnp_drv->name); pnp_dbg("match found with the PnP device '%s' and the driver '%s'",
dev->bus_id, pnp_drv->name);
error = pnp_device_attach(pnp_dev); error = pnp_device_attach(pnp_dev);
if (error < 0) if (error < 0)
...@@ -110,22 +110,22 @@ static int pnp_device_probe(struct device *dev) ...@@ -110,22 +110,22 @@ static int pnp_device_probe(struct device *dev)
if (dev_id != NULL) if (dev_id != NULL)
error = pnp_drv->probe(pnp_dev, dev_id); error = pnp_drv->probe(pnp_dev, dev_id);
} }
if (error >= 0){ if (error >= 0) {
pnp_dev->driver = pnp_drv; pnp_dev->driver = pnp_drv;
error = 0; error = 0;
} else } else
goto fail; goto fail;
return error; return error;
fail: fail:
pnp_device_detach(pnp_dev); pnp_device_detach(pnp_dev);
return error; return error;
} }
static int pnp_device_remove(struct device *dev) static int pnp_device_remove(struct device *dev)
{ {
struct pnp_dev * pnp_dev = to_pnp_dev(dev); struct pnp_dev *pnp_dev = to_pnp_dev(dev);
struct pnp_driver * drv = pnp_dev->driver; struct pnp_driver *drv = pnp_dev->driver;
if (drv) { if (drv) {
if (drv->remove) if (drv->remove)
...@@ -138,8 +138,8 @@ static int pnp_device_remove(struct device *dev) ...@@ -138,8 +138,8 @@ static int pnp_device_remove(struct device *dev)
static int pnp_bus_match(struct device *dev, struct device_driver *drv) static int pnp_bus_match(struct device *dev, struct device_driver *drv)
{ {
struct pnp_dev * pnp_dev = to_pnp_dev(dev); struct pnp_dev *pnp_dev = to_pnp_dev(dev);
struct pnp_driver * pnp_drv = to_pnp_driver(drv); struct pnp_driver *pnp_drv = to_pnp_driver(drv);
if (match_device(pnp_drv, pnp_dev) == NULL) if (match_device(pnp_drv, pnp_dev) == NULL)
return 0; return 0;
return 1; return 1;
...@@ -147,8 +147,8 @@ static int pnp_bus_match(struct device *dev, struct device_driver *drv) ...@@ -147,8 +147,8 @@ static int pnp_bus_match(struct device *dev, struct device_driver *drv)
static int pnp_bus_suspend(struct device *dev, pm_message_t state) static int pnp_bus_suspend(struct device *dev, pm_message_t state)
{ {
struct pnp_dev * pnp_dev = to_pnp_dev(dev); struct pnp_dev *pnp_dev = to_pnp_dev(dev);
struct pnp_driver * pnp_drv = pnp_dev->driver; struct pnp_driver *pnp_drv = pnp_dev->driver;
int error; int error;
if (!pnp_drv) if (!pnp_drv)
...@@ -174,8 +174,8 @@ static int pnp_bus_suspend(struct device *dev, pm_message_t state) ...@@ -174,8 +174,8 @@ static int pnp_bus_suspend(struct device *dev, pm_message_t state)
static int pnp_bus_resume(struct device *dev) static int pnp_bus_resume(struct device *dev)
{ {
struct pnp_dev * pnp_dev = to_pnp_dev(dev); struct pnp_dev *pnp_dev = to_pnp_dev(dev);
struct pnp_driver * pnp_drv = pnp_dev->driver; struct pnp_driver *pnp_drv = pnp_dev->driver;
int error; int error;
if (!pnp_drv) if (!pnp_drv)
......
This diff is collapsed.
...@@ -12,21 +12,19 @@ ...@@ -12,21 +12,19 @@
#include <linux/isapnp.h> #include <linux/isapnp.h>
#include <linux/string.h> #include <linux/string.h>
static void pnp_convert_id(char *buf, unsigned short vendor, unsigned short device) static void pnp_convert_id(char *buf, unsigned short vendor,
unsigned short device)
{ {
sprintf(buf, "%c%c%c%x%x%x%x", sprintf(buf, "%c%c%c%x%x%x%x",
'A' + ((vendor >> 2) & 0x3f) - 1, 'A' + ((vendor >> 2) & 0x3f) - 1,
'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1, 'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1,
'A' + ((vendor >> 8) & 0x1f) - 1, 'A' + ((vendor >> 8) & 0x1f) - 1,
(device >> 4) & 0x0f, (device >> 4) & 0x0f,
device & 0x0f, device & 0x0f, (device >> 12) & 0x0f, (device >> 8) & 0x0f);
(device >> 12) & 0x0f,
(device >> 8) & 0x0f);
} }
struct pnp_card *pnp_find_card(unsigned short vendor, struct pnp_card *pnp_find_card(unsigned short vendor,
unsigned short device, unsigned short device, struct pnp_card *from)
struct pnp_card *from)
{ {
char id[8]; char id[8];
char any[8]; char any[8];
...@@ -38,7 +36,7 @@ struct pnp_card *pnp_find_card(unsigned short vendor, ...@@ -38,7 +36,7 @@ struct pnp_card *pnp_find_card(unsigned short vendor,
while (list != &pnp_cards) { while (list != &pnp_cards) {
struct pnp_card *card = global_to_pnp_card(list); struct pnp_card *card = global_to_pnp_card(list);
if (compare_pnp_id(card->id,id) || (memcmp(id,any,7)==0)) if (compare_pnp_id(card->id, id) || (memcmp(id, any, 7) == 0))
return card; return card;
list = list->next; list = list->next;
} }
...@@ -47,8 +45,7 @@ struct pnp_card *pnp_find_card(unsigned short vendor, ...@@ -47,8 +45,7 @@ struct pnp_card *pnp_find_card(unsigned short vendor,
struct pnp_dev *pnp_find_dev(struct pnp_card *card, struct pnp_dev *pnp_find_dev(struct pnp_card *card,
unsigned short vendor, unsigned short vendor,
unsigned short function, unsigned short function, struct pnp_dev *from)
struct pnp_dev *from)
{ {
char id[8]; char id[8];
char any[8]; char any[8];
...@@ -63,7 +60,8 @@ struct pnp_dev *pnp_find_dev(struct pnp_card *card, ...@@ -63,7 +60,8 @@ struct pnp_dev *pnp_find_dev(struct pnp_card *card,
while (list != &pnp_global) { while (list != &pnp_global) {
struct pnp_dev *dev = global_to_pnp_dev(list); struct pnp_dev *dev = global_to_pnp_dev(list);
if (compare_pnp_id(dev->id,id) || (memcmp(id,any,7)==0)) if (compare_pnp_id(dev->id, id)
|| (memcmp(id, any, 7) == 0))
return dev; return dev;
list = list->next; list = list->next;
} }
...@@ -78,7 +76,7 @@ struct pnp_dev *pnp_find_dev(struct pnp_card *card, ...@@ -78,7 +76,7 @@ struct pnp_dev *pnp_find_dev(struct pnp_card *card,
} }
while (list != &card->devices) { while (list != &card->devices) {
struct pnp_dev *dev = card_to_pnp_dev(list); struct pnp_dev *dev = card_to_pnp_dev(list);
if (compare_pnp_id(dev->id,id)) if (compare_pnp_id(dev->id, id))
return dev; return dev;
list = list->next; list = list->next;
} }
......
This diff is collapsed.
...@@ -54,7 +54,8 @@ static loff_t isapnp_proc_bus_lseek(struct file *file, loff_t off, int whence) ...@@ -54,7 +54,8 @@ static loff_t isapnp_proc_bus_lseek(struct file *file, loff_t off, int whence)
return (file->f_pos = new); return (file->f_pos = new);
} }
static ssize_t isapnp_proc_bus_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) static ssize_t isapnp_proc_bus_read(struct file *file, char __user * buf,
size_t nbytes, loff_t * ppos)
{ {
struct inode *ino = file->f_path.dentry->d_inode; struct inode *ino = file->f_path.dentry->d_inode;
struct proc_dir_entry *dp = PDE(ino); struct proc_dir_entry *dp = PDE(ino);
...@@ -74,7 +75,7 @@ static ssize_t isapnp_proc_bus_read(struct file *file, char __user *buf, size_t ...@@ -74,7 +75,7 @@ static ssize_t isapnp_proc_bus_read(struct file *file, char __user *buf, size_t
return -EINVAL; return -EINVAL;
isapnp_cfg_begin(dev->card->number, dev->number); isapnp_cfg_begin(dev->card->number, dev->number);
for ( ; pos < 256 && cnt > 0; pos++, buf++, cnt--) { for (; pos < 256 && cnt > 0; pos++, buf++, cnt--) {
unsigned char val; unsigned char val;
val = isapnp_read_byte(pos); val = isapnp_read_byte(pos);
__put_user(val, buf); __put_user(val, buf);
...@@ -85,8 +86,7 @@ static ssize_t isapnp_proc_bus_read(struct file *file, char __user *buf, size_t ...@@ -85,8 +86,7 @@ static ssize_t isapnp_proc_bus_read(struct file *file, char __user *buf, size_t
return nbytes; return nbytes;
} }
static const struct file_operations isapnp_proc_bus_file_operations = static const struct file_operations isapnp_proc_bus_file_operations = {
{
.llseek = isapnp_proc_bus_lseek, .llseek = isapnp_proc_bus_lseek,
.read = isapnp_proc_bus_read, .read = isapnp_proc_bus_read,
}; };
...@@ -145,7 +145,7 @@ int __init isapnp_proc_init(void) ...@@ -145,7 +145,7 @@ int __init isapnp_proc_init(void)
{ {
struct pnp_dev *dev; struct pnp_dev *dev;
isapnp_proc_bus_dir = proc_mkdir("isapnp", proc_bus); isapnp_proc_bus_dir = proc_mkdir("isapnp", proc_bus);
protocol_for_each_dev(&isapnp_protocol,dev) { protocol_for_each_dev(&isapnp_protocol, dev) {
isapnp_proc_attach_device(dev); isapnp_proc_attach_device(dev);
} }
return 0; return 0;
......
...@@ -26,7 +26,8 @@ static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx) ...@@ -26,7 +26,8 @@ static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx)
return -EINVAL; return -EINVAL;
if (idx >= PNP_MAX_PORT) { if (idx >= PNP_MAX_PORT) {
pnp_err("More than 4 ports is incompatible with pnp specifications."); pnp_err
("More than 4 ports is incompatible with pnp specifications.");
/* pretend we were successful so at least the manager won't try again */ /* pretend we were successful so at least the manager won't try again */
return 1; return 1;
} }
...@@ -70,7 +71,8 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx) ...@@ -70,7 +71,8 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
return -EINVAL; return -EINVAL;
if (idx >= PNP_MAX_MEM) { if (idx >= PNP_MAX_MEM) {
pnp_err("More than 8 mems is incompatible with pnp specifications."); pnp_err
("More than 8 mems is incompatible with pnp specifications.");
/* pretend we were successful so at least the manager won't try again */ /* pretend we were successful so at least the manager won't try again */
return 1; return 1;
} }
...@@ -103,7 +105,7 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx) ...@@ -103,7 +105,7 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
} }
*start = rule->min; *start = rule->min;
*end = *start + rule->size -1; *end = *start + rule->size - 1;
/* run through until pnp_check_mem is happy */ /* run through until pnp_check_mem is happy */
while (!pnp_check_mem(dev, idx)) { while (!pnp_check_mem(dev, idx)) {
...@@ -115,7 +117,7 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx) ...@@ -115,7 +117,7 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
return 1; return 1;
} }
static int pnp_assign_irq(struct pnp_dev * dev, struct pnp_irq *rule, int idx) static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx)
{ {
resource_size_t *start, *end; resource_size_t *start, *end;
unsigned long *flags; unsigned long *flags;
...@@ -130,7 +132,8 @@ static int pnp_assign_irq(struct pnp_dev * dev, struct pnp_irq *rule, int idx) ...@@ -130,7 +132,8 @@ static int pnp_assign_irq(struct pnp_dev * dev, struct pnp_irq *rule, int idx)
return -EINVAL; return -EINVAL;
if (idx >= PNP_MAX_IRQ) { if (idx >= PNP_MAX_IRQ) {
pnp_err("More than 2 irqs is incompatible with pnp specifications."); pnp_err
("More than 2 irqs is incompatible with pnp specifications.");
/* pretend we were successful so at least the manager won't try again */ /* pretend we were successful so at least the manager won't try again */
return 1; return 1;
} }
...@@ -159,9 +162,9 @@ static int pnp_assign_irq(struct pnp_dev * dev, struct pnp_irq *rule, int idx) ...@@ -159,9 +162,9 @@ static int pnp_assign_irq(struct pnp_dev * dev, struct pnp_irq *rule, int idx)
return 1; return 1;
} }
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
if(test_bit(xtab[i], rule->map)) { if (test_bit(xtab[i], rule->map)) {
*start = *end = xtab[i]; *start = *end = xtab[i];
if(pnp_check_irq(dev, idx)) if (pnp_check_irq(dev, idx))
return 1; return 1;
} }
} }
...@@ -183,7 +186,8 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx) ...@@ -183,7 +186,8 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
return -EINVAL; return -EINVAL;
if (idx >= PNP_MAX_DMA) { if (idx >= PNP_MAX_DMA) {
pnp_err("More than 2 dmas is incompatible with pnp specifications."); pnp_err
("More than 2 dmas is incompatible with pnp specifications.");
/* pretend we were successful so at least the manager won't try again */ /* pretend we were successful so at least the manager won't try again */
return 1; return 1;
} }
...@@ -206,9 +210,9 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx) ...@@ -206,9 +210,9 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
} }
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
if(rule->map & (1<<xtab[i])) { if (rule->map & (1 << xtab[i])) {
*start = *end = xtab[i]; *start = *end = xtab[i];
if(pnp_check_dma(dev, idx)) if (pnp_check_dma(dev, idx))
return 1; return 1;
} }
} }
...@@ -227,25 +231,29 @@ void pnp_init_resource_table(struct pnp_resource_table *table) ...@@ -227,25 +231,29 @@ void pnp_init_resource_table(struct pnp_resource_table *table)
table->irq_resource[idx].name = NULL; table->irq_resource[idx].name = NULL;
table->irq_resource[idx].start = -1; table->irq_resource[idx].start = -1;
table->irq_resource[idx].end = -1; table->irq_resource[idx].end = -1;
table->irq_resource[idx].flags = IORESOURCE_IRQ | IORESOURCE_AUTO | IORESOURCE_UNSET; table->irq_resource[idx].flags =
IORESOURCE_IRQ | IORESOURCE_AUTO | IORESOURCE_UNSET;
} }
for (idx = 0; idx < PNP_MAX_DMA; idx++) { for (idx = 0; idx < PNP_MAX_DMA; idx++) {
table->dma_resource[idx].name = NULL; table->dma_resource[idx].name = NULL;
table->dma_resource[idx].start = -1; table->dma_resource[idx].start = -1;
table->dma_resource[idx].end = -1; table->dma_resource[idx].end = -1;
table->dma_resource[idx].flags = IORESOURCE_DMA | IORESOURCE_AUTO | IORESOURCE_UNSET; table->dma_resource[idx].flags =
IORESOURCE_DMA | IORESOURCE_AUTO | IORESOURCE_UNSET;
} }
for (idx = 0; idx < PNP_MAX_PORT; idx++) { for (idx = 0; idx < PNP_MAX_PORT; idx++) {
table->port_resource[idx].name = NULL; table->port_resource[idx].name = NULL;
table->port_resource[idx].start = 0; table->port_resource[idx].start = 0;
table->port_resource[idx].end = 0; table->port_resource[idx].end = 0;
table->port_resource[idx].flags = IORESOURCE_IO | IORESOURCE_AUTO | IORESOURCE_UNSET; table->port_resource[idx].flags =
IORESOURCE_IO | IORESOURCE_AUTO | IORESOURCE_UNSET;
} }
for (idx = 0; idx < PNP_MAX_MEM; idx++) { for (idx = 0; idx < PNP_MAX_MEM; idx++) {
table->mem_resource[idx].name = NULL; table->mem_resource[idx].name = NULL;
table->mem_resource[idx].start = 0; table->mem_resource[idx].start = 0;
table->mem_resource[idx].end = 0; table->mem_resource[idx].end = 0;
table->mem_resource[idx].flags = IORESOURCE_MEM | IORESOURCE_AUTO | IORESOURCE_UNSET; table->mem_resource[idx].flags =
IORESOURCE_MEM | IORESOURCE_AUTO | IORESOURCE_UNSET;
} }
} }
...@@ -254,7 +262,7 @@ void pnp_init_resource_table(struct pnp_resource_table *table) ...@@ -254,7 +262,7 @@ void pnp_init_resource_table(struct pnp_resource_table *table)
* @res: the resources to clean * @res: the resources to clean
* *
*/ */
static void pnp_clean_resource_table(struct pnp_resource_table * res) static void pnp_clean_resource_table(struct pnp_resource_table *res)
{ {
int idx; int idx;
for (idx = 0; idx < PNP_MAX_IRQ; idx++) { for (idx = 0; idx < PNP_MAX_IRQ; idx++) {
...@@ -262,28 +270,32 @@ static void pnp_clean_resource_table(struct pnp_resource_table * res) ...@@ -262,28 +270,32 @@ static void pnp_clean_resource_table(struct pnp_resource_table * res)
continue; continue;
res->irq_resource[idx].start = -1; res->irq_resource[idx].start = -1;
res->irq_resource[idx].end = -1; res->irq_resource[idx].end = -1;
res->irq_resource[idx].flags = IORESOURCE_IRQ | IORESOURCE_AUTO | IORESOURCE_UNSET; res->irq_resource[idx].flags =
IORESOURCE_IRQ | IORESOURCE_AUTO | IORESOURCE_UNSET;
} }
for (idx = 0; idx < PNP_MAX_DMA; idx++) { for (idx = 0; idx < PNP_MAX_DMA; idx++) {
if (!(res->dma_resource[idx].flags & IORESOURCE_AUTO)) if (!(res->dma_resource[idx].flags & IORESOURCE_AUTO))
continue; continue;
res->dma_resource[idx].start = -1; res->dma_resource[idx].start = -1;
res->dma_resource[idx].end = -1; res->dma_resource[idx].end = -1;
res->dma_resource[idx].flags = IORESOURCE_DMA | IORESOURCE_AUTO | IORESOURCE_UNSET; res->dma_resource[idx].flags =
IORESOURCE_DMA | IORESOURCE_AUTO | IORESOURCE_UNSET;
} }
for (idx = 0; idx < PNP_MAX_PORT; idx++) { for (idx = 0; idx < PNP_MAX_PORT; idx++) {
if (!(res->port_resource[idx].flags & IORESOURCE_AUTO)) if (!(res->port_resource[idx].flags & IORESOURCE_AUTO))
continue; continue;
res->port_resource[idx].start = 0; res->port_resource[idx].start = 0;
res->port_resource[idx].end = 0; res->port_resource[idx].end = 0;
res->port_resource[idx].flags = IORESOURCE_IO | IORESOURCE_AUTO | IORESOURCE_UNSET; res->port_resource[idx].flags =
IORESOURCE_IO | IORESOURCE_AUTO | IORESOURCE_UNSET;
} }
for (idx = 0; idx < PNP_MAX_MEM; idx++) { for (idx = 0; idx < PNP_MAX_MEM; idx++) {
if (!(res->mem_resource[idx].flags & IORESOURCE_AUTO)) if (!(res->mem_resource[idx].flags & IORESOURCE_AUTO))
continue; continue;
res->mem_resource[idx].start = 0; res->mem_resource[idx].start = 0;
res->mem_resource[idx].end = 0; res->mem_resource[idx].end = 0;
res->mem_resource[idx].flags = IORESOURCE_MEM | IORESOURCE_AUTO | IORESOURCE_UNSET; res->mem_resource[idx].flags =
IORESOURCE_MEM | IORESOURCE_AUTO | IORESOURCE_UNSET;
} }
} }
...@@ -341,10 +353,11 @@ static int pnp_assign_resources(struct pnp_dev *dev, int depnum) ...@@ -341,10 +353,11 @@ static int pnp_assign_resources(struct pnp_dev *dev, int depnum)
if (depnum) { if (depnum) {
struct pnp_option *dep; struct pnp_option *dep;
int i; int i;
for (i=1,dep=dev->dependent; i<depnum; i++, dep=dep->next) for (i = 1, dep = dev->dependent; i < depnum;
if(!dep) i++, dep = dep->next)
if (!dep)
goto fail; goto fail;
port =dep->port; port = dep->port;
mem = dep->mem; mem = dep->mem;
irq = dep->irq; irq = dep->irq;
dma = dep->dma; dma = dep->dma;
...@@ -378,7 +391,7 @@ static int pnp_assign_resources(struct pnp_dev *dev, int depnum) ...@@ -378,7 +391,7 @@ static int pnp_assign_resources(struct pnp_dev *dev, int depnum)
up(&pnp_res_mutex); up(&pnp_res_mutex);
return 1; return 1;
fail: fail:
pnp_clean_resource_table(&dev->res); pnp_clean_resource_table(&dev->res);
up(&pnp_res_mutex); up(&pnp_res_mutex);
return 0; return 0;
...@@ -392,10 +405,11 @@ static int pnp_assign_resources(struct pnp_dev *dev, int depnum) ...@@ -392,10 +405,11 @@ static int pnp_assign_resources(struct pnp_dev *dev, int depnum)
* *
* This function can be used by drivers that want to manually set thier resources. * This function can be used by drivers that want to manually set thier resources.
*/ */
int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table * res, int mode) int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res,
int mode)
{ {
int i; int i;
struct pnp_resource_table * bak; struct pnp_resource_table *bak;
if (!dev || !res) if (!dev || !res)
return -EINVAL; return -EINVAL;
if (!pnp_can_configure(dev)) if (!pnp_can_configure(dev))
...@@ -409,19 +423,19 @@ int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table * res, ...@@ -409,19 +423,19 @@ int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table * res,
dev->res = *res; dev->res = *res;
if (!(mode & PNP_CONFIG_FORCE)) { if (!(mode & PNP_CONFIG_FORCE)) {
for (i = 0; i < PNP_MAX_PORT; i++) { for (i = 0; i < PNP_MAX_PORT; i++) {
if(!pnp_check_port(dev,i)) if (!pnp_check_port(dev, i))
goto fail; goto fail;
} }
for (i = 0; i < PNP_MAX_MEM; i++) { for (i = 0; i < PNP_MAX_MEM; i++) {
if(!pnp_check_mem(dev,i)) if (!pnp_check_mem(dev, i))
goto fail; goto fail;
} }
for (i = 0; i < PNP_MAX_IRQ; i++) { for (i = 0; i < PNP_MAX_IRQ; i++) {
if(!pnp_check_irq(dev,i)) if (!pnp_check_irq(dev, i))
goto fail; goto fail;
} }
for (i = 0; i < PNP_MAX_DMA; i++) { for (i = 0; i < PNP_MAX_DMA; i++) {
if(!pnp_check_dma(dev,i)) if (!pnp_check_dma(dev, i))
goto fail; goto fail;
} }
} }
...@@ -430,7 +444,7 @@ int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table * res, ...@@ -430,7 +444,7 @@ int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table * res,
kfree(bak); kfree(bak);
return 0; return 0;
fail: fail:
dev->res = *bak; dev->res = *bak;
up(&pnp_res_mutex); up(&pnp_res_mutex);
kfree(bak); kfree(bak);
...@@ -447,11 +461,12 @@ int pnp_auto_config_dev(struct pnp_dev *dev) ...@@ -447,11 +461,12 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
struct pnp_option *dep; struct pnp_option *dep;
int i = 1; int i = 1;
if(!dev) if (!dev)
return -EINVAL; return -EINVAL;
if(!pnp_can_configure(dev)) { if (!pnp_can_configure(dev)) {
pnp_dbg("Device %s does not support resource configuration.", dev->dev.bus_id); pnp_dbg("Device %s does not support resource configuration.",
dev->dev.bus_id);
return -ENODEV; return -ENODEV;
} }
...@@ -482,11 +497,12 @@ int pnp_auto_config_dev(struct pnp_dev *dev) ...@@ -482,11 +497,12 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
int pnp_start_dev(struct pnp_dev *dev) int pnp_start_dev(struct pnp_dev *dev)
{ {
if (!pnp_can_write(dev)) { if (!pnp_can_write(dev)) {
pnp_dbg("Device %s does not support activation.", dev->dev.bus_id); pnp_dbg("Device %s does not support activation.",
dev->dev.bus_id);
return -EINVAL; return -EINVAL;
} }
if (dev->protocol->set(dev, &dev->res)<0) { if (dev->protocol->set(dev, &dev->res) < 0) {
pnp_err("Failed to activate device %s.", dev->dev.bus_id); pnp_err("Failed to activate device %s.", dev->dev.bus_id);
return -EIO; return -EIO;
} }
...@@ -506,10 +522,11 @@ int pnp_start_dev(struct pnp_dev *dev) ...@@ -506,10 +522,11 @@ int pnp_start_dev(struct pnp_dev *dev)
int pnp_stop_dev(struct pnp_dev *dev) int pnp_stop_dev(struct pnp_dev *dev)
{ {
if (!pnp_can_disable(dev)) { if (!pnp_can_disable(dev)) {
pnp_dbg("Device %s does not support disabling.", dev->dev.bus_id); pnp_dbg("Device %s does not support disabling.",
dev->dev.bus_id);
return -EINVAL; return -EINVAL;
} }
if (dev->protocol->disable(dev)<0) { if (dev->protocol->disable(dev) < 0) {
pnp_err("Failed to disable device %s.", dev->dev.bus_id); pnp_err("Failed to disable device %s.", dev->dev.bus_id);
return -EIO; return -EIO;
} }
...@@ -595,7 +612,6 @@ void pnp_resource_change(struct resource *resource, resource_size_t start, ...@@ -595,7 +612,6 @@ void pnp_resource_change(struct resource *resource, resource_size_t start,
resource->end = start + size - 1; resource->end = start + size - 1;
} }
EXPORT_SYMBOL(pnp_manual_config_dev); EXPORT_SYMBOL(pnp_manual_config_dev);
#if 0 #if 0
EXPORT_SYMBOL(pnp_auto_config_dev); EXPORT_SYMBOL(pnp_auto_config_dev);
......
...@@ -36,7 +36,7 @@ static int num = 0; ...@@ -36,7 +36,7 @@ static int num = 0;
* have irqs (PIC, Timer) because we call acpi_register_gsi. * have irqs (PIC, Timer) because we call acpi_register_gsi.
* Finaly only devices that have a CRS method need to be in this list. * Finaly only devices that have a CRS method need to be in this list.
*/ */
static __initdata struct acpi_device_id excluded_id_list[] ={ static __initdata struct acpi_device_id excluded_id_list[] = {
{"PNP0C09", 0}, /* EC */ {"PNP0C09", 0}, /* EC */
{"PNP0C0F", 0}, /* Link device */ {"PNP0C0F", 0}, /* Link device */
{"PNP0000", 0}, /* PIC */ {"PNP0000", 0}, /* PIC */
...@@ -84,15 +84,17 @@ static void __init pnpidacpi_to_pnpid(char *id, char *str) ...@@ -84,15 +84,17 @@ static void __init pnpidacpi_to_pnpid(char *id, char *str)
str[7] = '\0'; str[7] = '\0';
} }
static int pnpacpi_get_resources(struct pnp_dev * dev, struct pnp_resource_table * res) static int pnpacpi_get_resources(struct pnp_dev *dev,
struct pnp_resource_table *res)
{ {
acpi_status status; acpi_status status;
status = pnpacpi_parse_allocated_resource((acpi_handle)dev->data, status = pnpacpi_parse_allocated_resource((acpi_handle) dev->data,
&dev->res); &dev->res);
return ACPI_FAILURE(status) ? -ENODEV : 0; return ACPI_FAILURE(status) ? -ENODEV : 0;
} }
static int pnpacpi_set_resources(struct pnp_dev * dev, struct pnp_resource_table * res) static int pnpacpi_set_resources(struct pnp_dev *dev,
struct pnp_resource_table *res)
{ {
acpi_handle handle = dev->data; acpi_handle handle = dev->data;
struct acpi_buffer buffer; struct acpi_buffer buffer;
...@@ -119,21 +121,23 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev) ...@@ -119,21 +121,23 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev)
acpi_status status; acpi_status status;
/* acpi_unregister_gsi(pnp_irq(dev, 0)); */ /* acpi_unregister_gsi(pnp_irq(dev, 0)); */
status = acpi_evaluate_object((acpi_handle)dev->data, status = acpi_evaluate_object((acpi_handle) dev->data,
"_DIS", NULL, NULL); "_DIS", NULL, NULL);
return ACPI_FAILURE(status) ? -ENODEV : 0; return ACPI_FAILURE(status) ? -ENODEV : 0;
} }
static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state) static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state)
{ {
return acpi_bus_set_power((acpi_handle)dev->data, return acpi_bus_set_power((acpi_handle) dev->data,
acpi_pm_device_sleep_state(&dev->dev, acpi_pm_device_sleep_state(&dev->dev,
device_may_wakeup(&dev->dev), NULL)); device_may_wakeup
(&dev->dev),
NULL));
} }
static int pnpacpi_resume(struct pnp_dev *dev) static int pnpacpi_resume(struct pnp_dev *dev)
{ {
return acpi_bus_set_power((acpi_handle)dev->data, ACPI_STATE_D0); return acpi_bus_set_power((acpi_handle) dev->data, ACPI_STATE_D0);
} }
static struct pnp_protocol pnpacpi_protocol = { static struct pnp_protocol pnpacpi_protocol = {
...@@ -194,20 +198,23 @@ static int __init pnpacpi_add_device(struct acpi_device *device) ...@@ -194,20 +198,23 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
pnpidacpi_to_pnpid(acpi_device_hid(device), dev_id->id); pnpidacpi_to_pnpid(acpi_device_hid(device), dev_id->id);
pnp_add_id(dev_id, dev); pnp_add_id(dev_id, dev);
if(dev->active) { if (dev->active) {
/* parse allocated resource */ /* parse allocated resource */
status = pnpacpi_parse_allocated_resource(device->handle, &dev->res); status =
pnpacpi_parse_allocated_resource(device->handle, &dev->res);
if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
pnp_err("PnPACPI: METHOD_NAME__CRS failure for %s", dev_id->id); pnp_err("PnPACPI: METHOD_NAME__CRS failure for %s",
dev_id->id);
goto err1; goto err1;
} }
} }
if(dev->capabilities & PNP_CONFIGURABLE) { if (dev->capabilities & PNP_CONFIGURABLE) {
status = pnpacpi_parse_resource_option_data(device->handle, status = pnpacpi_parse_resource_option_data(device->handle,
dev); dev);
if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
pnp_err("PnPACPI: METHOD_NAME__PRS failure for %s", dev_id->id); pnp_err("PnPACPI: METHOD_NAME__PRS failure for %s",
dev_id->id);
goto err1; goto err1;
} }
} }
...@@ -233,18 +240,19 @@ static int __init pnpacpi_add_device(struct acpi_device *device) ...@@ -233,18 +240,19 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
if (!dev->active) if (!dev->active)
pnp_init_resource_table(&dev->res); pnp_init_resource_table(&dev->res);
pnp_add_device(dev); pnp_add_device(dev);
num ++; num++;
return AE_OK; return AE_OK;
err1: err1:
kfree(dev_id); kfree(dev_id);
err: err:
kfree(dev); kfree(dev);
return -EINVAL; return -EINVAL;
} }
static acpi_status __init pnpacpi_add_device_handler(acpi_handle handle, static acpi_status __init pnpacpi_add_device_handler(acpi_handle handle,
u32 lvl, void *context, void **rv) u32 lvl, void *context,
void **rv)
{ {
struct acpi_device *device; struct acpi_device *device;
...@@ -266,14 +274,13 @@ static int __init acpi_pnp_match(struct device *dev, void *_pnp) ...@@ -266,14 +274,13 @@ static int __init acpi_pnp_match(struct device *dev, void *_pnp)
&& compare_pnp_id(pnp->id, acpi->pnp.hardware_id); && compare_pnp_id(pnp->id, acpi->pnp.hardware_id);
} }
static int __init acpi_pnp_find_device(struct device *dev, acpi_handle *handle) static int __init acpi_pnp_find_device(struct device *dev, acpi_handle * handle)
{ {
struct device *adev; struct device *adev;
struct acpi_device *acpi; struct acpi_device *acpi;
adev = bus_find_device(&acpi_bus_type, NULL, adev = bus_find_device(&acpi_bus_type, NULL,
to_pnp_dev(dev), to_pnp_dev(dev), acpi_pnp_match);
acpi_pnp_match);
if (!adev) if (!adev)
return -ENODEV; return -ENODEV;
...@@ -307,6 +314,7 @@ static int __init pnpacpi_init(void) ...@@ -307,6 +314,7 @@ static int __init pnpacpi_init(void)
pnp_platform_devices = 1; pnp_platform_devices = 1;
return 0; return 0;
} }
subsys_initcall(pnpacpi_init); subsys_initcall(pnpacpi_init);
static int __init pnpacpi_setup(char *str) static int __init pnpacpi_setup(char *str)
...@@ -317,6 +325,7 @@ static int __init pnpacpi_setup(char *str) ...@@ -317,6 +325,7 @@ static int __init pnpacpi_setup(char *str)
pnpacpi_disabled = 1; pnpacpi_disabled = 1;
return 1; return 1;
} }
__setup("pnpacpi=", pnpacpi_setup); __setup("pnpacpi=", pnpacpi_setup);
#if 0 #if 0
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -47,10 +47,7 @@ static int proc_read_pnpconfig(char *buf, char **start, off_t pos, ...@@ -47,10 +47,7 @@ static int proc_read_pnpconfig(char *buf, char **start, off_t pos,
"structure_revision %d\n" "structure_revision %d\n"
"number_of_CSNs %d\n" "number_of_CSNs %d\n"
"ISA_read_data_port 0x%x\n", "ISA_read_data_port 0x%x\n",
pnps.revision, pnps.revision, pnps.no_csns, pnps.isa_rd_data_port);
pnps.no_csns,
pnps.isa_rd_data_port
);
} }
static int proc_read_escdinfo(char *buf, char **start, off_t pos, static int proc_read_escdinfo(char *buf, char **start, off_t pos,
...@@ -65,9 +62,7 @@ static int proc_read_escdinfo(char *buf, char **start, off_t pos, ...@@ -65,9 +62,7 @@ static int proc_read_escdinfo(char *buf, char **start, off_t pos,
"ESCD_size %d\n" "ESCD_size %d\n"
"NVRAM_base 0x%x\n", "NVRAM_base 0x%x\n",
escd.min_escd_write_size, escd.min_escd_write_size,
escd.escd_size, escd.escd_size, escd.nv_storage_base);
escd.nv_storage_base
);
} }
#define MAX_SANE_ESCD_SIZE (32*1024) #define MAX_SANE_ESCD_SIZE (32*1024)
...@@ -83,30 +78,36 @@ static int proc_read_escd(char *buf, char **start, off_t pos, ...@@ -83,30 +78,36 @@ static int proc_read_escd(char *buf, char **start, off_t pos,
/* sanity check */ /* sanity check */
if (escd.escd_size > MAX_SANE_ESCD_SIZE) { if (escd.escd_size > MAX_SANE_ESCD_SIZE) {
printk(KERN_ERR "PnPBIOS: proc_read_escd: ESCD size reported by BIOS escd_info call is too great\n"); printk(KERN_ERR
"PnPBIOS: proc_read_escd: ESCD size reported by BIOS escd_info call is too great\n");
return -EFBIG; return -EFBIG;
} }
tmpbuf = kzalloc(escd.escd_size, GFP_KERNEL); tmpbuf = kzalloc(escd.escd_size, GFP_KERNEL);
if (!tmpbuf) return -ENOMEM; if (!tmpbuf)
return -ENOMEM;
if (pnp_bios_read_escd(tmpbuf, escd.nv_storage_base)) { if (pnp_bios_read_escd(tmpbuf, escd.nv_storage_base)) {
kfree(tmpbuf); kfree(tmpbuf);
return -EIO; return -EIO;
} }
escd_size = (unsigned char)(tmpbuf[0]) + (unsigned char)(tmpbuf[1])*256; escd_size =
(unsigned char)(tmpbuf[0]) + (unsigned char)(tmpbuf[1]) * 256;
/* sanity check */ /* sanity check */
if (escd_size > MAX_SANE_ESCD_SIZE) { if (escd_size > MAX_SANE_ESCD_SIZE) {
printk(KERN_ERR "PnPBIOS: proc_read_escd: ESCD size reported by BIOS read_escd call is too great\n"); printk(KERN_ERR
"PnPBIOS: proc_read_escd: ESCD size reported by BIOS read_escd call is too great\n");
return -EFBIG; return -EFBIG;
} }
escd_left_to_read = escd_size - pos; escd_left_to_read = escd_size - pos;
if (escd_left_to_read < 0) escd_left_to_read = 0; if (escd_left_to_read < 0)
if (escd_left_to_read == 0) *eof = 1; escd_left_to_read = 0;
n = min(count,escd_left_to_read); if (escd_left_to_read == 0)
*eof = 1;
n = min(count, escd_left_to_read);
memcpy(buf, tmpbuf + pos, n); memcpy(buf, tmpbuf + pos, n);
kfree(tmpbuf); kfree(tmpbuf);
*start = buf; *start = buf;
...@@ -134,9 +135,10 @@ static int proc_read_devices(char *buf, char **start, off_t pos, ...@@ -134,9 +135,10 @@ static int proc_read_devices(char *buf, char **start, off_t pos,
return 0; return 0;
node = kzalloc(node_info.max_node_size, GFP_KERNEL); node = kzalloc(node_info.max_node_size, GFP_KERNEL);
if (!node) return -ENOMEM; if (!node)
return -ENOMEM;
for (nodenum=pos; nodenum<0xff; ) { for (nodenum = pos; nodenum < 0xff;) {
u8 thisnodenum = nodenum; u8 thisnodenum = nodenum;
/* 26 = the number of characters per line sprintf'ed */ /* 26 = the number of characters per line sprintf'ed */
if ((p - buf + 26) > count) if ((p - buf + 26) > count)
...@@ -148,7 +150,11 @@ static int proc_read_devices(char *buf, char **start, off_t pos, ...@@ -148,7 +150,11 @@ static int proc_read_devices(char *buf, char **start, off_t pos,
node->type_code[0], node->type_code[1], node->type_code[0], node->type_code[1],
node->type_code[2], node->flags); node->type_code[2], node->flags);
if (nodenum <= thisnodenum) { if (nodenum <= thisnodenum) {
printk(KERN_ERR "%s Node number 0x%x is out of sequence following node 0x%x. Aborting.\n", "PnPBIOS: proc_read_devices:", (unsigned int)nodenum, (unsigned int)thisnodenum); printk(KERN_ERR
"%s Node number 0x%x is out of sequence following node 0x%x. Aborting.\n",
"PnPBIOS: proc_read_devices:",
(unsigned int)nodenum,
(unsigned int)thisnodenum);
*eof = 1; *eof = 1;
break; break;
} }
...@@ -156,7 +162,7 @@ static int proc_read_devices(char *buf, char **start, off_t pos, ...@@ -156,7 +162,7 @@ static int proc_read_devices(char *buf, char **start, off_t pos,
kfree(node); kfree(node);
if (nodenum == 0xff) if (nodenum == 0xff)
*eof = 1; *eof = 1;
*start = (char *)((off_t)nodenum - pos); *start = (char *)((off_t) nodenum - pos);
return p - buf; return p - buf;
} }
...@@ -169,7 +175,8 @@ static int proc_read_node(char *buf, char **start, off_t pos, ...@@ -169,7 +175,8 @@ static int proc_read_node(char *buf, char **start, off_t pos,
int len; int len;
node = kzalloc(node_info.max_node_size, GFP_KERNEL); node = kzalloc(node_info.max_node_size, GFP_KERNEL);
if (!node) return -ENOMEM; if (!node)
return -ENOMEM;
if (pnp_bios_get_dev_node(&nodenum, boot, node)) { if (pnp_bios_get_dev_node(&nodenum, boot, node)) {
kfree(node); kfree(node);
return -EIO; return -EIO;
...@@ -180,7 +187,7 @@ static int proc_read_node(char *buf, char **start, off_t pos, ...@@ -180,7 +187,7 @@ static int proc_read_node(char *buf, char **start, off_t pos,
return len; return len;
} }
static int proc_write_node(struct file *file, const char __user *buf, static int proc_write_node(struct file *file, const char __user * buf,
unsigned long count, void *data) unsigned long count, void *data)
{ {
struct pnp_bios_node *node; struct pnp_bios_node *node;
...@@ -208,12 +215,12 @@ static int proc_write_node(struct file *file, const char __user *buf, ...@@ -208,12 +215,12 @@ static int proc_write_node(struct file *file, const char __user *buf,
goto out; goto out;
} }
ret = count; ret = count;
out: out:
kfree(node); kfree(node);
return ret; return ret;
} }
int pnpbios_interface_attach_device(struct pnp_bios_node * node) int pnpbios_interface_attach_device(struct pnp_bios_node *node)
{ {
char name[3]; char name[3];
struct proc_dir_entry *ent; struct proc_dir_entry *ent;
...@@ -222,7 +229,7 @@ int pnpbios_interface_attach_device(struct pnp_bios_node * node) ...@@ -222,7 +229,7 @@ int pnpbios_interface_attach_device(struct pnp_bios_node * node)
if (!proc_pnp) if (!proc_pnp)
return -EIO; return -EIO;
if ( !pnpbios_dont_use_current_config ) { if (!pnpbios_dont_use_current_config) {
ent = create_proc_entry(name, 0, proc_pnp); ent = create_proc_entry(name, 0, proc_pnp);
if (ent) { if (ent) {
ent->read_proc = proc_read_node; ent->read_proc = proc_read_node;
...@@ -237,7 +244,7 @@ int pnpbios_interface_attach_device(struct pnp_bios_node * node) ...@@ -237,7 +244,7 @@ int pnpbios_interface_attach_device(struct pnp_bios_node * node)
if (ent) { if (ent) {
ent->read_proc = proc_read_node; ent->read_proc = proc_read_node;
ent->write_proc = proc_write_node; ent->write_proc = proc_write_node;
ent->data = (void *)(long)(node->handle+0x100); ent->data = (void *)(long)(node->handle + 0x100);
return 0; return 0;
} }
...@@ -249,7 +256,7 @@ int pnpbios_interface_attach_device(struct pnp_bios_node * node) ...@@ -249,7 +256,7 @@ int pnpbios_interface_attach_device(struct pnp_bios_node * node)
* work and the pnpbios_dont_use_current_config flag * work and the pnpbios_dont_use_current_config flag
* should already have been set to the appropriate value * should already have been set to the appropriate value
*/ */
int __init pnpbios_proc_init( void ) int __init pnpbios_proc_init(void)
{ {
proc_pnp = proc_mkdir("pnp", proc_bus); proc_pnp = proc_mkdir("pnp", proc_bus);
if (!proc_pnp) if (!proc_pnp)
...@@ -258,10 +265,13 @@ int __init pnpbios_proc_init( void ) ...@@ -258,10 +265,13 @@ int __init pnpbios_proc_init( void )
if (!proc_pnp_boot) if (!proc_pnp_boot)
return -EIO; return -EIO;
create_proc_read_entry("devices", 0, proc_pnp, proc_read_devices, NULL); create_proc_read_entry("devices", 0, proc_pnp, proc_read_devices, NULL);
create_proc_read_entry("configuration_info", 0, proc_pnp, proc_read_pnpconfig, NULL); create_proc_read_entry("configuration_info", 0, proc_pnp,
create_proc_read_entry("escd_info", 0, proc_pnp, proc_read_escdinfo, NULL); proc_read_pnpconfig, NULL);
create_proc_read_entry("escd_info", 0, proc_pnp, proc_read_escdinfo,
NULL);
create_proc_read_entry("escd", S_IRUSR, proc_pnp, proc_read_escd, NULL); create_proc_read_entry("escd", S_IRUSR, proc_pnp, proc_read_escd, NULL);
create_proc_read_entry("legacy_device_resources", 0, proc_pnp, proc_read_legacyres, NULL); create_proc_read_entry("legacy_device_resources", 0, proc_pnp,
proc_read_legacyres, NULL);
return 0; return 0;
} }
...@@ -274,9 +284,9 @@ void __exit pnpbios_proc_exit(void) ...@@ -274,9 +284,9 @@ void __exit pnpbios_proc_exit(void)
if (!proc_pnp) if (!proc_pnp)
return; return;
for (i=0; i<0xff; i++) { for (i = 0; i < 0xff; i++) {
sprintf(name, "%02x", i); sprintf(name, "%02x", i);
if ( !pnpbios_dont_use_current_config ) if (!pnpbios_dont_use_current_config)
remove_proc_entry(name, proc_pnp); remove_proc_entry(name, proc_pnp);
remove_proc_entry(name, proc_pnp_boot); remove_proc_entry(name, proc_pnp_boot);
} }
......
This diff is collapsed.
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <linux/io.h> #include <linux/io.h>
#include "base.h" #include "base.h"
static void quirk_awe32_resources(struct pnp_dev *dev) static void quirk_awe32_resources(struct pnp_dev *dev)
{ {
struct pnp_port *port, *port2, *port3; struct pnp_port *port, *port2, *port3;
...@@ -31,7 +30,7 @@ static void quirk_awe32_resources(struct pnp_dev *dev) ...@@ -31,7 +30,7 @@ static void quirk_awe32_resources(struct pnp_dev *dev)
* two extra ports (at offset 0x400 and 0x800 from the one given) by * two extra ports (at offset 0x400 and 0x800 from the one given) by
* hand. * hand.
*/ */
for ( ; res ; res = res->next ) { for (; res; res = res->next) {
port2 = pnp_alloc(sizeof(struct pnp_port)); port2 = pnp_alloc(sizeof(struct pnp_port));
if (!port2) if (!port2)
return; return;
...@@ -58,18 +57,19 @@ static void quirk_cmi8330_resources(struct pnp_dev *dev) ...@@ -58,18 +57,19 @@ static void quirk_cmi8330_resources(struct pnp_dev *dev)
struct pnp_option *res = dev->dependent; struct pnp_option *res = dev->dependent;
unsigned long tmp; unsigned long tmp;
for ( ; res ; res = res->next ) { for (; res; res = res->next) {
struct pnp_irq *irq; struct pnp_irq *irq;
struct pnp_dma *dma; struct pnp_dma *dma;
for( irq = res->irq; irq; irq = irq->next ) { // Valid irqs are 5, 7, 10 for (irq = res->irq; irq; irq = irq->next) { // Valid irqs are 5, 7, 10
tmp = 0x04A0; tmp = 0x04A0;
bitmap_copy(irq->map, &tmp, 16); // 0000 0100 1010 0000 bitmap_copy(irq->map, &tmp, 16); // 0000 0100 1010 0000
} }
for( dma = res->dma; dma; dma = dma->next ) // Valid 8bit dma channels are 1,3 for (dma = res->dma; dma; dma = dma->next) // Valid 8bit dma channels are 1,3
if( ( dma->flags & IORESOURCE_DMA_TYPE_MASK ) == IORESOURCE_DMA_8BIT ) if ((dma->flags & IORESOURCE_DMA_TYPE_MASK) ==
IORESOURCE_DMA_8BIT)
dma->map = 0x000A; dma->map = 0x000A;
} }
printk(KERN_INFO "pnp: CMI8330 quirk - fixing interrupts and dma\n"); printk(KERN_INFO "pnp: CMI8330 quirk - fixing interrupts and dma\n");
...@@ -87,23 +87,24 @@ static void quirk_sb16audio_resources(struct pnp_dev *dev) ...@@ -87,23 +87,24 @@ static void quirk_sb16audio_resources(struct pnp_dev *dev)
* auto-configured. * auto-configured.
*/ */
for( ; res ; res = res->next ) { for (; res; res = res->next) {
port = res->port; port = res->port;
if(!port) if (!port)
continue; continue;
port = port->next; port = port->next;
if(!port) if (!port)
continue; continue;
port = port->next; port = port->next;
if(!port) if (!port)
continue; continue;
if(port->min != port->max) if (port->min != port->max)
continue; continue;
port->max += 0x70; port->max += 0x70;
changed = 1; changed = 1;
} }
if(changed) if (changed)
printk(KERN_INFO "pnp: SB audio device quirk - increasing port range\n"); printk(KERN_INFO
"pnp: SB audio device quirk - increasing port range\n");
return; return;
} }
...@@ -153,8 +154,8 @@ static void quirk_smc_enable(struct pnp_dev *dev) ...@@ -153,8 +154,8 @@ static void quirk_smc_enable(struct pnp_dev *dev)
*/ */
dev_err(&dev->dev, "%s not responding at SIR 0x%lx, FIR 0x%lx; " dev_err(&dev->dev, "%s not responding at SIR 0x%lx, FIR 0x%lx; "
"auto-configuring\n", dev->id->id, "auto-configuring\n", dev->id->id,
(unsigned long) pnp_port_start(dev, 0), (unsigned long)pnp_port_start(dev, 0),
(unsigned long) pnp_port_start(dev, 1)); (unsigned long)pnp_port_start(dev, 1));
pnp_disable_dev(dev); pnp_disable_dev(dev);
pnp_init_resource_table(&dev->res); pnp_init_resource_table(&dev->res);
...@@ -162,8 +163,8 @@ static void quirk_smc_enable(struct pnp_dev *dev) ...@@ -162,8 +163,8 @@ static void quirk_smc_enable(struct pnp_dev *dev)
pnp_activate_dev(dev); pnp_activate_dev(dev);
if (quirk_smc_fir_enabled(dev)) { if (quirk_smc_fir_enabled(dev)) {
dev_err(&dev->dev, "responds at SIR 0x%lx, FIR 0x%lx\n", dev_err(&dev->dev, "responds at SIR 0x%lx, FIR 0x%lx\n",
(unsigned long) pnp_port_start(dev, 0), (unsigned long)pnp_port_start(dev, 0),
(unsigned long) pnp_port_start(dev, 1)); (unsigned long)pnp_port_start(dev, 1));
return; return;
} }
...@@ -175,8 +176,8 @@ static void quirk_smc_enable(struct pnp_dev *dev) ...@@ -175,8 +176,8 @@ static void quirk_smc_enable(struct pnp_dev *dev)
*/ */
dev_err(&dev->dev, "not responding at SIR 0x%lx, FIR 0x%lx; " dev_err(&dev->dev, "not responding at SIR 0x%lx, FIR 0x%lx; "
"swapping SIR/FIR and reconfiguring\n", "swapping SIR/FIR and reconfiguring\n",
(unsigned long) pnp_port_start(dev, 0), (unsigned long)pnp_port_start(dev, 0),
(unsigned long) pnp_port_start(dev, 1)); (unsigned long)pnp_port_start(dev, 1));
/* /*
* Clear IORESOURCE_AUTO so pnp_activate_dev() doesn't reassign * Clear IORESOURCE_AUTO so pnp_activate_dev() doesn't reassign
...@@ -200,8 +201,8 @@ static void quirk_smc_enable(struct pnp_dev *dev) ...@@ -200,8 +201,8 @@ static void quirk_smc_enable(struct pnp_dev *dev)
if (quirk_smc_fir_enabled(dev)) { if (quirk_smc_fir_enabled(dev)) {
dev_err(&dev->dev, "responds at SIR 0x%lx, FIR 0x%lx\n", dev_err(&dev->dev, "responds at SIR 0x%lx, FIR 0x%lx\n",
(unsigned long) pnp_port_start(dev, 0), (unsigned long)pnp_port_start(dev, 0),
(unsigned long) pnp_port_start(dev, 1)); (unsigned long)pnp_port_start(dev, 1));
return; return;
} }
...@@ -209,7 +210,6 @@ static void quirk_smc_enable(struct pnp_dev *dev) ...@@ -209,7 +210,6 @@ static void quirk_smc_enable(struct pnp_dev *dev)
"email bjorn.helgaas@hp.com\n"); "email bjorn.helgaas@hp.com\n");
} }
/* /*
* PnP Quirks * PnP Quirks
* Cards or devices that need some tweaking due to incomplete resource info * Cards or devices that need some tweaking due to incomplete resource info
...@@ -217,21 +217,21 @@ static void quirk_smc_enable(struct pnp_dev *dev) ...@@ -217,21 +217,21 @@ static void quirk_smc_enable(struct pnp_dev *dev)
static struct pnp_fixup pnp_fixups[] = { static struct pnp_fixup pnp_fixups[] = {
/* Soundblaster awe io port quirk */ /* Soundblaster awe io port quirk */
{ "CTL0021", quirk_awe32_resources }, {"CTL0021", quirk_awe32_resources},
{ "CTL0022", quirk_awe32_resources }, {"CTL0022", quirk_awe32_resources},
{ "CTL0023", quirk_awe32_resources }, {"CTL0023", quirk_awe32_resources},
/* CMI 8330 interrupt and dma fix */ /* CMI 8330 interrupt and dma fix */
{ "@X@0001", quirk_cmi8330_resources }, {"@X@0001", quirk_cmi8330_resources},
/* Soundblaster audio device io port range quirk */ /* Soundblaster audio device io port range quirk */
{ "CTL0001", quirk_sb16audio_resources }, {"CTL0001", quirk_sb16audio_resources},
{ "CTL0031", quirk_sb16audio_resources }, {"CTL0031", quirk_sb16audio_resources},
{ "CTL0041", quirk_sb16audio_resources }, {"CTL0041", quirk_sb16audio_resources},
{ "CTL0042", quirk_sb16audio_resources }, {"CTL0042", quirk_sb16audio_resources},
{ "CTL0043", quirk_sb16audio_resources }, {"CTL0043", quirk_sb16audio_resources},
{ "CTL0044", quirk_sb16audio_resources }, {"CTL0044", quirk_sb16audio_resources},
{ "CTL0045", quirk_sb16audio_resources }, {"CTL0045", quirk_sb16audio_resources},
{ "SMCf010", quirk_smc_enable }, {"SMCf010", quirk_smc_enable},
{ "" } {""}
}; };
void pnp_fixup_device(struct pnp_dev *dev) void pnp_fixup_device(struct pnp_dev *dev)
...@@ -239,9 +239,8 @@ void pnp_fixup_device(struct pnp_dev *dev) ...@@ -239,9 +239,8 @@ void pnp_fixup_device(struct pnp_dev *dev)
int i = 0; int i = 0;
while (*pnp_fixups[i].id) { while (*pnp_fixups[i].id) {
if (compare_pnp_id(dev->id,pnp_fixups[i].id)) { if (compare_pnp_id(dev->id, pnp_fixups[i].id)) {
pnp_dbg("Calling quirk for %s", pnp_dbg("Calling quirk for %s", dev->dev.bus_id);
dev->dev.bus_id);
pnp_fixups[i].quirk_function(dev); pnp_fixups[i].quirk_function(dev);
} }
i++; i++;
......
...@@ -20,17 +20,16 @@ ...@@ -20,17 +20,16 @@
#include <linux/pnp.h> #include <linux/pnp.h>
#include "base.h" #include "base.h"
static int pnp_reserve_irq[16] = { [0 ... 15] = -1 }; /* reserve (don't use) some IRQ */ static int pnp_reserve_irq[16] = {[0...15] = -1 }; /* reserve (don't use) some IRQ */
static int pnp_reserve_dma[8] = { [0 ... 7] = -1 }; /* reserve (don't use) some DMA */ static int pnp_reserve_dma[8] = {[0...7] = -1 }; /* reserve (don't use) some DMA */
static int pnp_reserve_io[16] = { [0 ... 15] = -1 }; /* reserve (don't use) some I/O region */ static int pnp_reserve_io[16] = {[0...15] = -1 }; /* reserve (don't use) some I/O region */
static int pnp_reserve_mem[16] = { [0 ... 15] = -1 }; /* reserve (don't use) some memory region */ static int pnp_reserve_mem[16] = {[0...15] = -1 }; /* reserve (don't use) some memory region */
/* /*
* option registration * option registration
*/ */
static struct pnp_option * pnp_build_option(int priority) static struct pnp_option *pnp_build_option(int priority)
{ {
struct pnp_option *option = pnp_alloc(sizeof(struct pnp_option)); struct pnp_option *option = pnp_alloc(sizeof(struct pnp_option));
...@@ -46,7 +45,7 @@ static struct pnp_option * pnp_build_option(int priority) ...@@ -46,7 +45,7 @@ static struct pnp_option * pnp_build_option(int priority)
return option; return option;
} }
struct pnp_option * pnp_register_independent_option(struct pnp_dev *dev) struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev)
{ {
struct pnp_option *option; struct pnp_option *option;
if (!dev) if (!dev)
...@@ -61,7 +60,8 @@ struct pnp_option * pnp_register_independent_option(struct pnp_dev *dev) ...@@ -61,7 +60,8 @@ struct pnp_option * pnp_register_independent_option(struct pnp_dev *dev)
return option; return option;
} }
struct pnp_option * pnp_register_dependent_option(struct pnp_dev *dev, int priority) struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev,
int priority)
{ {
struct pnp_option *option; struct pnp_option *option;
if (!dev) if (!dev)
...@@ -222,7 +222,6 @@ void pnp_free_option(struct pnp_option *option) ...@@ -222,7 +222,6 @@ void pnp_free_option(struct pnp_option *option)
} }
} }
/* /*
* resource validity checking * resource validity checking
*/ */
...@@ -236,7 +235,7 @@ void pnp_free_option(struct pnp_option *option) ...@@ -236,7 +235,7 @@ void pnp_free_option(struct pnp_option *option)
#define cannot_compare(flags) \ #define cannot_compare(flags) \
((flags) & (IORESOURCE_UNSET | IORESOURCE_DISABLED)) ((flags) & (IORESOURCE_UNSET | IORESOURCE_DISABLED))
int pnp_check_port(struct pnp_dev * dev, int idx) int pnp_check_port(struct pnp_dev *dev, int idx)
{ {
int tmp; int tmp;
struct pnp_dev *tdev; struct pnp_dev *tdev;
...@@ -250,8 +249,8 @@ int pnp_check_port(struct pnp_dev * dev, int idx) ...@@ -250,8 +249,8 @@ int pnp_check_port(struct pnp_dev * dev, int idx)
/* check if the resource is already in use, skip if the /* check if the resource is already in use, skip if the
* device is active because it itself may be in use */ * device is active because it itself may be in use */
if(!dev->active) { if (!dev->active) {
if (__check_region(&ioport_resource, *port, length(port,end))) if (__check_region(&ioport_resource, *port, length(port, end)))
return 0; return 0;
} }
...@@ -259,7 +258,7 @@ int pnp_check_port(struct pnp_dev * dev, int idx) ...@@ -259,7 +258,7 @@ int pnp_check_port(struct pnp_dev * dev, int idx)
for (tmp = 0; tmp < 8; tmp++) { for (tmp = 0; tmp < 8; tmp++) {
int rport = pnp_reserve_io[tmp << 1]; int rport = pnp_reserve_io[tmp << 1];
int rend = pnp_reserve_io[(tmp << 1) + 1] + rport - 1; int rend = pnp_reserve_io[(tmp << 1) + 1] + rport - 1;
if (ranged_conflict(port,end,&rport,&rend)) if (ranged_conflict(port, end, &rport, &rend))
return 0; return 0;
} }
...@@ -268,7 +267,7 @@ int pnp_check_port(struct pnp_dev * dev, int idx) ...@@ -268,7 +267,7 @@ int pnp_check_port(struct pnp_dev * dev, int idx)
if (dev->res.port_resource[tmp].flags & IORESOURCE_IO) { if (dev->res.port_resource[tmp].flags & IORESOURCE_IO) {
tport = &dev->res.port_resource[tmp].start; tport = &dev->res.port_resource[tmp].start;
tend = &dev->res.port_resource[tmp].end; tend = &dev->res.port_resource[tmp].end;
if (ranged_conflict(port,end,tport,tend)) if (ranged_conflict(port, end, tport, tend))
return 0; return 0;
} }
} }
...@@ -279,11 +278,12 @@ int pnp_check_port(struct pnp_dev * dev, int idx) ...@@ -279,11 +278,12 @@ int pnp_check_port(struct pnp_dev * dev, int idx)
continue; continue;
for (tmp = 0; tmp < PNP_MAX_PORT; tmp++) { for (tmp = 0; tmp < PNP_MAX_PORT; tmp++) {
if (tdev->res.port_resource[tmp].flags & IORESOURCE_IO) { if (tdev->res.port_resource[tmp].flags & IORESOURCE_IO) {
if (cannot_compare(tdev->res.port_resource[tmp].flags)) if (cannot_compare
(tdev->res.port_resource[tmp].flags))
continue; continue;
tport = &tdev->res.port_resource[tmp].start; tport = &tdev->res.port_resource[tmp].start;
tend = &tdev->res.port_resource[tmp].end; tend = &tdev->res.port_resource[tmp].end;
if (ranged_conflict(port,end,tport,tend)) if (ranged_conflict(port, end, tport, tend))
return 0; return 0;
} }
} }
...@@ -292,7 +292,7 @@ int pnp_check_port(struct pnp_dev * dev, int idx) ...@@ -292,7 +292,7 @@ int pnp_check_port(struct pnp_dev * dev, int idx)
return 1; return 1;
} }
int pnp_check_mem(struct pnp_dev * dev, int idx) int pnp_check_mem(struct pnp_dev *dev, int idx)
{ {
int tmp; int tmp;
struct pnp_dev *tdev; struct pnp_dev *tdev;
...@@ -306,8 +306,8 @@ int pnp_check_mem(struct pnp_dev * dev, int idx) ...@@ -306,8 +306,8 @@ int pnp_check_mem(struct pnp_dev * dev, int idx)
/* check if the resource is already in use, skip if the /* check if the resource is already in use, skip if the
* device is active because it itself may be in use */ * device is active because it itself may be in use */
if(!dev->active) { if (!dev->active) {
if (check_mem_region(*addr, length(addr,end))) if (check_mem_region(*addr, length(addr, end)))
return 0; return 0;
} }
...@@ -315,7 +315,7 @@ int pnp_check_mem(struct pnp_dev * dev, int idx) ...@@ -315,7 +315,7 @@ int pnp_check_mem(struct pnp_dev * dev, int idx)
for (tmp = 0; tmp < 8; tmp++) { for (tmp = 0; tmp < 8; tmp++) {
int raddr = pnp_reserve_mem[tmp << 1]; int raddr = pnp_reserve_mem[tmp << 1];
int rend = pnp_reserve_mem[(tmp << 1) + 1] + raddr - 1; int rend = pnp_reserve_mem[(tmp << 1) + 1] + raddr - 1;
if (ranged_conflict(addr,end,&raddr,&rend)) if (ranged_conflict(addr, end, &raddr, &rend))
return 0; return 0;
} }
...@@ -324,7 +324,7 @@ int pnp_check_mem(struct pnp_dev * dev, int idx) ...@@ -324,7 +324,7 @@ int pnp_check_mem(struct pnp_dev * dev, int idx)
if (dev->res.mem_resource[tmp].flags & IORESOURCE_MEM) { if (dev->res.mem_resource[tmp].flags & IORESOURCE_MEM) {
taddr = &dev->res.mem_resource[tmp].start; taddr = &dev->res.mem_resource[tmp].start;
tend = &dev->res.mem_resource[tmp].end; tend = &dev->res.mem_resource[tmp].end;
if (ranged_conflict(addr,end,taddr,tend)) if (ranged_conflict(addr, end, taddr, tend))
return 0; return 0;
} }
} }
...@@ -335,11 +335,12 @@ int pnp_check_mem(struct pnp_dev * dev, int idx) ...@@ -335,11 +335,12 @@ int pnp_check_mem(struct pnp_dev * dev, int idx)
continue; continue;
for (tmp = 0; tmp < PNP_MAX_MEM; tmp++) { for (tmp = 0; tmp < PNP_MAX_MEM; tmp++) {
if (tdev->res.mem_resource[tmp].flags & IORESOURCE_MEM) { if (tdev->res.mem_resource[tmp].flags & IORESOURCE_MEM) {
if (cannot_compare(tdev->res.mem_resource[tmp].flags)) if (cannot_compare
(tdev->res.mem_resource[tmp].flags))
continue; continue;
taddr = &tdev->res.mem_resource[tmp].start; taddr = &tdev->res.mem_resource[tmp].start;
tend = &tdev->res.mem_resource[tmp].end; tend = &tdev->res.mem_resource[tmp].end;
if (ranged_conflict(addr,end,taddr,tend)) if (ranged_conflict(addr, end, taddr, tend))
return 0; return 0;
} }
} }
...@@ -353,11 +354,11 @@ static irqreturn_t pnp_test_handler(int irq, void *dev_id) ...@@ -353,11 +354,11 @@ static irqreturn_t pnp_test_handler(int irq, void *dev_id)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
int pnp_check_irq(struct pnp_dev * dev, int idx) int pnp_check_irq(struct pnp_dev *dev, int idx)
{ {
int tmp; int tmp;
struct pnp_dev *tdev; struct pnp_dev *tdev;
resource_size_t * irq = &dev->res.irq_resource[idx].start; resource_size_t *irq = &dev->res.irq_resource[idx].start;
/* if the resource doesn't exist, don't complain about it */ /* if the resource doesn't exist, don't complain about it */
if (cannot_compare(dev->res.irq_resource[idx].flags)) if (cannot_compare(dev->res.irq_resource[idx].flags))
...@@ -394,9 +395,9 @@ int pnp_check_irq(struct pnp_dev * dev, int idx) ...@@ -394,9 +395,9 @@ int pnp_check_irq(struct pnp_dev * dev, int idx)
/* check if the resource is already in use, skip if the /* check if the resource is already in use, skip if the
* device is active because it itself may be in use */ * device is active because it itself may be in use */
if(!dev->active) { if (!dev->active) {
if (request_irq(*irq, pnp_test_handler, if (request_irq(*irq, pnp_test_handler,
IRQF_DISABLED|IRQF_PROBE_SHARED, "pnp", NULL)) IRQF_DISABLED | IRQF_PROBE_SHARED, "pnp", NULL))
return 0; return 0;
free_irq(*irq, NULL); free_irq(*irq, NULL);
} }
...@@ -407,7 +408,8 @@ int pnp_check_irq(struct pnp_dev * dev, int idx) ...@@ -407,7 +408,8 @@ int pnp_check_irq(struct pnp_dev * dev, int idx)
continue; continue;
for (tmp = 0; tmp < PNP_MAX_IRQ; tmp++) { for (tmp = 0; tmp < PNP_MAX_IRQ; tmp++) {
if (tdev->res.irq_resource[tmp].flags & IORESOURCE_IRQ) { if (tdev->res.irq_resource[tmp].flags & IORESOURCE_IRQ) {
if (cannot_compare(tdev->res.irq_resource[tmp].flags)) if (cannot_compare
(tdev->res.irq_resource[tmp].flags))
continue; continue;
if ((tdev->res.irq_resource[tmp].start == *irq)) if ((tdev->res.irq_resource[tmp].start == *irq))
return 0; return 0;
...@@ -418,12 +420,12 @@ int pnp_check_irq(struct pnp_dev * dev, int idx) ...@@ -418,12 +420,12 @@ int pnp_check_irq(struct pnp_dev * dev, int idx)
return 1; return 1;
} }
int pnp_check_dma(struct pnp_dev * dev, int idx) int pnp_check_dma(struct pnp_dev *dev, int idx)
{ {
#ifndef CONFIG_IA64 #ifndef CONFIG_IA64
int tmp; int tmp;
struct pnp_dev *tdev; struct pnp_dev *tdev;
resource_size_t * dma = &dev->res.dma_resource[idx].start; resource_size_t *dma = &dev->res.dma_resource[idx].start;
/* if the resource doesn't exist, don't complain about it */ /* if the resource doesn't exist, don't complain about it */
if (cannot_compare(dev->res.dma_resource[idx].flags)) if (cannot_compare(dev->res.dma_resource[idx].flags))
...@@ -449,7 +451,7 @@ int pnp_check_dma(struct pnp_dev * dev, int idx) ...@@ -449,7 +451,7 @@ int pnp_check_dma(struct pnp_dev * dev, int idx)
/* check if the resource is already in use, skip if the /* check if the resource is already in use, skip if the
* device is active because it itself may be in use */ * device is active because it itself may be in use */
if(!dev->active) { if (!dev->active) {
if (request_dma(*dma, "pnp")) if (request_dma(*dma, "pnp"))
return 0; return 0;
free_dma(*dma); free_dma(*dma);
...@@ -461,7 +463,8 @@ int pnp_check_dma(struct pnp_dev * dev, int idx) ...@@ -461,7 +463,8 @@ int pnp_check_dma(struct pnp_dev * dev, int idx)
continue; continue;
for (tmp = 0; tmp < PNP_MAX_DMA; tmp++) { for (tmp = 0; tmp < PNP_MAX_DMA; tmp++) {
if (tdev->res.dma_resource[tmp].flags & IORESOURCE_DMA) { if (tdev->res.dma_resource[tmp].flags & IORESOURCE_DMA) {
if (cannot_compare(tdev->res.dma_resource[tmp].flags)) if (cannot_compare
(tdev->res.dma_resource[tmp].flags))
continue; continue;
if ((tdev->res.dma_resource[tmp].start == *dma)) if ((tdev->res.dma_resource[tmp].start == *dma))
return 0; return 0;
...@@ -476,7 +479,6 @@ int pnp_check_dma(struct pnp_dev * dev, int idx) ...@@ -476,7 +479,6 @@ int pnp_check_dma(struct pnp_dev * dev, int idx)
#endif #endif
} }
#if 0 #if 0
EXPORT_SYMBOL(pnp_register_dependent_option); EXPORT_SYMBOL(pnp_register_dependent_option);
EXPORT_SYMBOL(pnp_register_independent_option); EXPORT_SYMBOL(pnp_register_independent_option);
...@@ -486,7 +488,6 @@ EXPORT_SYMBOL(pnp_register_port_resource); ...@@ -486,7 +488,6 @@ EXPORT_SYMBOL(pnp_register_port_resource);
EXPORT_SYMBOL(pnp_register_mem_resource); EXPORT_SYMBOL(pnp_register_mem_resource);
#endif /* 0 */ #endif /* 0 */
/* format is: pnp_reserve_irq=irq1[,irq2] .... */ /* format is: pnp_reserve_irq=irq1[,irq2] .... */
static int __init pnp_setup_reserve_irq(char *str) static int __init pnp_setup_reserve_irq(char *str)
...@@ -494,7 +495,7 @@ static int __init pnp_setup_reserve_irq(char *str) ...@@ -494,7 +495,7 @@ static int __init pnp_setup_reserve_irq(char *str)
int i; int i;
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
if (get_option(&str,&pnp_reserve_irq[i]) != 2) if (get_option(&str, &pnp_reserve_irq[i]) != 2)
break; break;
return 1; return 1;
} }
...@@ -508,7 +509,7 @@ static int __init pnp_setup_reserve_dma(char *str) ...@@ -508,7 +509,7 @@ static int __init pnp_setup_reserve_dma(char *str)
int i; int i;
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
if (get_option(&str,&pnp_reserve_dma[i]) != 2) if (get_option(&str, &pnp_reserve_dma[i]) != 2)
break; break;
return 1; return 1;
} }
...@@ -522,7 +523,7 @@ static int __init pnp_setup_reserve_io(char *str) ...@@ -522,7 +523,7 @@ static int __init pnp_setup_reserve_io(char *str)
int i; int i;
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
if (get_option(&str,&pnp_reserve_io[i]) != 2) if (get_option(&str, &pnp_reserve_io[i]) != 2)
break; break;
return 1; return 1;
} }
...@@ -536,7 +537,7 @@ static int __init pnp_setup_reserve_mem(char *str) ...@@ -536,7 +537,7 @@ static int __init pnp_setup_reserve_mem(char *str)
int i; int i;
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
if (get_option(&str,&pnp_reserve_mem[i]) != 2) if (get_option(&str, &pnp_reserve_mem[i]) != 2)
break; break;
return 1; return 1;
} }
......
...@@ -16,17 +16,14 @@ ...@@ -16,17 +16,14 @@
* *
*/ */
int pnp_is_active(struct pnp_dev * dev) int pnp_is_active(struct pnp_dev *dev)
{ {
if (!pnp_port_start(dev, 0) && pnp_port_len(dev, 0) <= 1 && if (!pnp_port_start(dev, 0) && pnp_port_len(dev, 0) <= 1 &&
!pnp_mem_start(dev, 0) && pnp_mem_len(dev, 0) <= 1 && !pnp_mem_start(dev, 0) && pnp_mem_len(dev, 0) <= 1 &&
pnp_irq(dev, 0) == -1 && pnp_irq(dev, 0) == -1 && pnp_dma(dev, 0) == -1)
pnp_dma(dev, 0) == -1)
return 0; return 0;
else else
return 1; return 1;
} }
EXPORT_SYMBOL(pnp_is_active); EXPORT_SYMBOL(pnp_is_active);
...@@ -16,13 +16,14 @@ ...@@ -16,13 +16,14 @@
static const struct pnp_device_id pnp_dev_table[] = { static const struct pnp_device_id pnp_dev_table[] = {
/* General ID for reserving resources */ /* General ID for reserving resources */
{ "PNP0c02", 0 }, {"PNP0c02", 0},
/* memory controller */ /* memory controller */
{ "PNP0c01", 0 }, {"PNP0c01", 0},
{ "", 0 } {"", 0}
}; };
static void reserve_range(const char *pnpid, resource_size_t start, resource_size_t end, int port) static void reserve_range(const char *pnpid, resource_size_t start,
resource_size_t end, int port)
{ {
struct resource *res; struct resource *res;
char *regionid; char *regionid;
...@@ -32,9 +33,9 @@ static void reserve_range(const char *pnpid, resource_size_t start, resource_siz ...@@ -32,9 +33,9 @@ static void reserve_range(const char *pnpid, resource_size_t start, resource_siz
return; return;
snprintf(regionid, 16, "pnp %s", pnpid); snprintf(regionid, 16, "pnp %s", pnpid);
if (port) if (port)
res = request_region(start, end-start+1, regionid); res = request_region(start, end - start + 1, regionid);
else else
res = request_mem_region(start, end-start+1, regionid); res = request_mem_region(start, end - start + 1, regionid);
if (res == NULL) if (res == NULL)
kfree(regionid); kfree(regionid);
else else
...@@ -88,7 +89,8 @@ static void reserve_resources_of_dev(const struct pnp_dev *dev) ...@@ -88,7 +89,8 @@ static void reserve_resources_of_dev(const struct pnp_dev *dev)
return; return;
} }
static int system_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id) static int system_pnp_probe(struct pnp_dev *dev,
const struct pnp_device_id *dev_id)
{ {
reserve_resources_of_dev(dev); reserve_resources_of_dev(dev);
return 0; return 0;
......
This diff is collapsed.
...@@ -133,21 +133,23 @@ struct pnp_bios_node { ...@@ -133,21 +133,23 @@ struct pnp_bios_node {
/* non-exported */ /* non-exported */
extern struct pnp_dev_node_info node_info; extern struct pnp_dev_node_info node_info;
extern int pnp_bios_dev_node_info (struct pnp_dev_node_info *data); extern int pnp_bios_dev_node_info(struct pnp_dev_node_info *data);
extern int pnp_bios_get_dev_node (u8 *nodenum, char config, struct pnp_bios_node *data); extern int pnp_bios_get_dev_node(u8 * nodenum, char config,
extern int pnp_bios_set_dev_node (u8 nodenum, char config, struct pnp_bios_node *data); struct pnp_bios_node *data);
extern int pnp_bios_get_stat_res (char *info); extern int pnp_bios_set_dev_node(u8 nodenum, char config,
extern int pnp_bios_isapnp_config (struct pnp_isa_config_struc *data); struct pnp_bios_node *data);
extern int pnp_bios_escd_info (struct escd_info_struc *data); extern int pnp_bios_get_stat_res(char *info);
extern int pnp_bios_read_escd (char *data, u32 nvram_base); extern int pnp_bios_isapnp_config(struct pnp_isa_config_struc *data);
extern int pnp_bios_escd_info(struct escd_info_struc *data);
extern int pnp_bios_read_escd(char *data, u32 nvram_base);
extern int pnp_bios_dock_station_info(struct pnp_docking_station_info *data); extern int pnp_bios_dock_station_info(struct pnp_docking_station_info *data);
#define needed 0 #define needed 0
#if needed #if needed
extern int pnp_bios_get_event (u16 *message); extern int pnp_bios_get_event(u16 * message);
extern int pnp_bios_send_message (u16 message); extern int pnp_bios_send_message(u16 message);
extern int pnp_bios_set_stat_res (char *info); extern int pnp_bios_set_stat_res(char *info);
extern int pnp_bios_apm_id_table (char *table, u16 *size); extern int pnp_bios_apm_id_table(char *table, u16 * size);
extern int pnp_bios_write_escd (char *data, u32 nvram_base); extern int pnp_bios_write_escd(char *data, u32 nvram_base);
#endif #endif
#endif /* CONFIG_PNPBIOS */ #endif /* CONFIG_PNPBIOS */
......
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