summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Belay <ambx1@neo.rr.com>2003-09-21 17:55:37 +0000
committerAdam Belay <ambx1@neo.rr.com>2003-09-21 17:55:37 +0000
commit8ba3fd9adb30ea4d18a1ce9471b95cf2ffe12cfa (patch)
treea920ba5b66cc1190dfd604682bc71db730833a9b
parent0166041002b66aa77d05323ad208688f1c7fd7b7 (diff)
[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.
-rw-r--r--drivers/pnp/pnpbios/core.c9
-rw-r--r--drivers/pnp/pnpbios/pnpbios.h10
-rw-r--r--drivers/pnp/pnpbios/proc.c14
-rw-r--r--include/linux/pnpbios.h5
4 files changed, 28 insertions, 10 deletions
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
index 8097ed9120e5..3d9d2eeb34b6 100644
--- a/drivers/pnp/pnpbios/core.c
+++ b/drivers/pnp/pnpbios/core.c
@@ -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();
diff --git a/drivers/pnp/pnpbios/pnpbios.h b/drivers/pnp/pnpbios/pnpbios.h
index 419eca1bf398..c51f921a95f6 100644
--- a/drivers/pnp/pnpbios/pnpbios.h
+++ b/drivers/pnp/pnpbios/pnpbios.h
@@ -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 */
diff --git a/drivers/pnp/pnpbios/proc.c b/drivers/pnp/pnpbios/proc.c
index a42fd2081012..14eeff632c7e 100644
--- a/drivers/pnp/pnpbios/proc.c
+++ b/drivers/pnp/pnpbios/proc.c
@@ -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;
}
@@ -257,8 +266,9 @@ 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);
diff --git a/include/linux/pnpbios.h b/include/linux/pnpbios.h
index 5b0e599dd5e2..4fefc51dbbcb 100644
--- a/include/linux/pnpbios.h
+++ b/include/linux/pnpbios.h
@@ -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);