Commit 8ba3fd9a authored by Adam Belay's avatar Adam Belay

[PNPBIOS] compilation fix for pnpbios without proc support

Here's an updated patch that will correct the compile error when PROC
FS is disabled.  It also introduces better proc error recovery and
moves the local proc functions to the local include file.  Thanks to
Daniele Bellucci for finding the problem and contributing to this
patch.
parent 01660410
......@@ -431,14 +431,15 @@ int __init pnpbios_init(void)
}
/* register with the pnp layer */
pnp_register_protocol(&pnpbios_protocol);
if (pnp_register_protocol(&pnpbios_protocol)) {
printk(KERN_ERR "PnPBIOS: Unable to register driver. Aborting.\n");
return -EIO;
}
#ifdef CONFIG_PROC_FS
/* start the proc interface */
ret = pnpbios_proc_init();
if (ret)
return ret;
#endif
printk(KERN_ERR "PnPBIOS: Failed to create proc interface.\n");
/* scan for pnpbios devices */
build_devlist();
......
......@@ -9,3 +9,13 @@ extern void pnpid32_to_pnpid(u32 id, char *str);
extern void pnpbios_print_status(const char * module, u16 status);
extern int pnpbios_probe_installation(void);
#ifdef CONFIG_PROC_FS
extern int pnpbios_interface_attach_device(struct pnp_bios_node * node);
extern int pnpbios_proc_init (void);
extern void pnpbios_proc_exit (void);
#else
static inline int pnpbios_interface_attach_device(struct pnp_bios_node * node) { return 0; }
static inline int pnpbios_proc_init (void) { return 0; }
static inline void pnpbios_proc_exit (void) { ; }
#endif /* CONFIG_PROC */
......@@ -31,6 +31,8 @@
#include <asm/uaccess.h>
#include "pnpbios.h"
static struct proc_dir_entry *proc_pnp = NULL;
static struct proc_dir_entry *proc_pnp_boot = NULL;
......@@ -213,6 +215,9 @@ int pnpbios_interface_attach_device(struct pnp_bios_node * node)
struct proc_dir_entry *ent;
sprintf(name, "%02x", node->handle);
if (!proc_pnp)
return -EIO;
if ( !pnpbios_dont_use_current_config ) {
ent = create_proc_entry(name, 0, proc_pnp);
if (ent) {
......@@ -221,6 +226,9 @@ int pnpbios_interface_attach_device(struct pnp_bios_node * node)
ent->data = (void *)(long)(node->handle);
}
}
if (!proc_pnp_boot)
return -EIO;
ent = create_proc_entry(name, 0, proc_pnp_boot);
if (ent) {
ent->read_proc = proc_read_node;
......@@ -228,6 +236,7 @@ int pnpbios_interface_attach_device(struct pnp_bios_node * node)
ent->data = (void *)(long)(node->handle+0x100);
return 0;
}
return -EIO;
}
......@@ -258,7 +267,8 @@ void __exit pnpbios_proc_exit(void)
int i;
char name[3];
if (!proc_pnp) return;
if (!proc_pnp)
return;
for (i=0; i<0xff; i++) {
sprintf(name, "%02x", i);
......
......@@ -26,7 +26,7 @@
#ifdef __KERNEL__
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/pnp.h>
/*
* Return codes
......@@ -135,9 +135,6 @@ extern int pnpbios_dont_use_current_config;
extern struct pnp_dev_node_info node_info;
extern void *pnpbios_kmalloc(size_t size, int f);
extern int pnpbios_init (void);
extern int pnpbios_interface_attach_device(struct pnp_bios_node * node);
extern int pnpbios_proc_init (void);
extern void pnpbios_proc_exit (void);
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);
......
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