git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git]
/
drivers
/
pnp
/
pnpbios
/
core.c
diff --git
a/drivers/pnp/pnpbios/core.c
b/drivers/pnp/pnpbios/core.c
index
6c98663
..
b154b3f
100644
(file)
--- a/
drivers/pnp/pnpbios/core.c
+++ b/
drivers/pnp/pnpbios/core.c
@@
-12,7
+12,7
@@
* Minor reorganizations by David Hinds <dahinds@users.sourceforge.net>
* Further modifications (C) 2001, 2002 by:
* Alan Cox <alan@redhat.com>
* Minor reorganizations by David Hinds <dahinds@users.sourceforge.net>
* Further modifications (C) 2001, 2002 by:
* Alan Cox <alan@redhat.com>
- * Thomas Hood
<jdthood@mail.com>
+ * Thomas Hood
* Brian Gerst <bgerst@didntduck.org>
*
* Ported to the PnP Layer and several additional improvements (C) 2002
* Brian Gerst <bgerst@didntduck.org>
*
* Ported to the PnP Layer and several additional improvements (C) 2002
@@
-56,10
+56,11
@@
#include <linux/mm.h>
#include <linux/smp.h>
#include <linux/slab.h>
#include <linux/mm.h>
#include <linux/smp.h>
#include <linux/slab.h>
-#include <linux/kmod.h>
#include <linux/completion.h>
#include <linux/spinlock.h>
#include <linux/dmi.h>
#include <linux/completion.h>
#include <linux/spinlock.h>
#include <linux/dmi.h>
+#include <linux/delay.h>
+#include <linux/acpi.h>
#include <asm/page.h>
#include <asm/desc.h>
#include <asm/page.h>
#include <asm/desc.h>
@@
-84,16
+85,6
@@
int pnp_bios_present(void)
struct pnp_dev_node_info node_info;
struct pnp_dev_node_info node_info;
-void *pnpbios_kmalloc(size_t size, int f)
-{
- void *p = kmalloc( size, f );
- if ( p == NULL )
- printk(KERN_ERR "PnPBIOS: kmalloc() failed\n");
- else
- memset(p, 0, size);
- return p;
-}
-
/*
*
* DOCKING FUNCTIONS
/*
*
* DOCKING FUNCTIONS
@@
-114,21
+105,20
@@
static int pnp_dock_event(int dock, struct pnp_docking_station_info *info)
char *argv [3], **envp, *buf, *scratch;
int i = 0, value;
char *argv [3], **envp, *buf, *scratch;
int i = 0, value;
- if (!hotplug_path [0])
- return -ENOENT;
if (!current->fs->root) {
return -EAGAIN;
}
if (!current->fs->root) {
return -EAGAIN;
}
- if (!(envp = (char **)
pnpbios_kmalloc (20 *
sizeof (char *), GFP_KERNEL))) {
+ if (!(envp = (char **)
kcalloc (20,
sizeof (char *), GFP_KERNEL))) {
return -ENOMEM;
}
return -ENOMEM;
}
- if (!(buf =
pnpbios_kmalloc (
256, GFP_KERNEL))) {
+ if (!(buf =
kcalloc (1,
256, GFP_KERNEL))) {
kfree (envp);
return -ENOMEM;
}
kfree (envp);
return -ENOMEM;
}
- /* only one standardized param to hotplug command: type */
- argv [0] = hotplug_path;
+ /* FIXME: if there are actual users of this, it should be integrated into
+ * the driver core and use the usual infrastructure like sysfs and uevents */
+ argv [0] = "/sbin/pnpbios";
argv [1] = "dock";
argv [2] = NULL;
argv [1] = "dock";
argv [2] = NULL;
@@
-177,10
+167,13
@@
static int pnp_dock_thread(void * unused)
/*
* Poll every 2 seconds
*/
/*
* Poll every 2 seconds
*/
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(HZ*2);
- if(signal_pending(current))
+ msleep_interruptible(2000);
+
+ if(signal_pending(current)) {
+ if (try_to_freeze())
+ continue;
break;
break;
+ }
status = pnp_bios_dock_station_info(&now);
status = pnp_bios_dock_station_info(&now);
@@
-226,7
+219,7
@@
static int pnpbios_get_resources(struct pnp_dev * dev, struct pnp_resource_table
if(!pnpbios_is_dynamic(dev))
return -EPERM;
if(!pnpbios_is_dynamic(dev))
return -EPERM;
- node =
pnpbios_kmalloc(
node_info.max_node_size, GFP_KERNEL);
+ node =
kcalloc(1,
node_info.max_node_size, GFP_KERNEL);
if (!node)
return -1;
if (pnp_bios_get_dev_node(&nodenum, (char )PNPMODE_DYNAMIC, node)) {
if (!node)
return -1;
if (pnp_bios_get_dev_node(&nodenum, (char )PNPMODE_DYNAMIC, node)) {
@@
-249,11
+242,13
@@
static int pnpbios_set_resources(struct pnp_dev * dev, struct pnp_resource_table
if (!pnpbios_is_dynamic(dev))
return -EPERM;
if (!pnpbios_is_dynamic(dev))
return -EPERM;
- node =
pnpbios_kmalloc(
node_info.max_node_size, GFP_KERNEL);
+ node =
kcalloc(1,
node_info.max_node_size, GFP_KERNEL);
if (!node)
return -1;
if (!node)
return -1;
- if (pnp_bios_get_dev_node(&nodenum, (char )PNPMODE_DYNAMIC, node))
+ if (pnp_bios_get_dev_node(&nodenum, (char )PNPMODE_DYNAMIC, node)) {
+ kfree(node);
return -ENODEV;
return -ENODEV;
+ }
if(pnpbios_write_resources_to_node(res, node)<0) {
kfree(node);
return -1;
if(pnpbios_write_resources_to_node(res, node)<0) {
kfree(node);
return -1;
@@
-298,7
+293,7
@@
static int pnpbios_disable_resources(struct pnp_dev *dev)
if(dev->flags & PNPBIOS_NO_DISABLE || !pnpbios_is_dynamic(dev))
return -EPERM;
if(dev->flags & PNPBIOS_NO_DISABLE || !pnpbios_is_dynamic(dev))
return -EPERM;
- node =
pnpbios_kmalloc(
node_info.max_node_size, GFP_KERNEL);
+ node =
kcalloc(1,
node_info.max_node_size, GFP_KERNEL);
if (!node)
return -ENOMEM;
if (!node)
return -ENOMEM;
@@
-340,7
+335,7
@@
static int insert_device(struct pnp_dev *dev, struct pnp_bios_node * node)
}
/* set the initial values for the PnP device */
}
/* set the initial values for the PnP device */
- dev_id =
pnpbios_kmalloc(
sizeof(struct pnp_id), GFP_KERNEL);
+ dev_id =
kcalloc(1,
sizeof(struct pnp_id), GFP_KERNEL);
if (!dev_id)
return -1;
pnpid32_to_pnpid(node->eisa_id,id);
if (!dev_id)
return -1;
pnpid32_to_pnpid(node->eisa_id,id);
@@
-378,7
+373,7
@@
static void __init build_devlist(void)
struct pnp_bios_node *node;
struct pnp_dev *dev;
struct pnp_bios_node *node;
struct pnp_dev *dev;
- node =
pnpbios_kmalloc(
node_info.max_node_size, GFP_KERNEL);
+ node =
kcalloc(1,
node_info.max_node_size, GFP_KERNEL);
if (!node)
return;
if (!node)
return;
@@
-395,7
+390,7
@@
static void __init build_devlist(void)
break;
}
nodes_got++;
break;
}
nodes_got++;
- dev =
pnpbios_kmalloc(
sizeof (struct pnp_dev), GFP_KERNEL);
+ dev =
kcalloc(1,
sizeof (struct pnp_dev), GFP_KERNEL);
if (!dev)
break;
if(insert_device(dev,node)<0)
if (!dev)
break;
if(insert_device(dev,node)<0)
@@
-451,7
+446,7
@@
__setup("pnpbios=", pnpbios_setup);
/* PnP BIOS signature: "$PnP" */
#define PNP_SIGNATURE (('$' << 0) + ('P' << 8) + ('n' << 16) + ('P' << 24))
/* PnP BIOS signature: "$PnP" */
#define PNP_SIGNATURE (('$' << 0) + ('P' << 8) + ('n' << 16) + ('P' << 24))
-int __init pnpbios_probe_system(void)
+
static
int __init pnpbios_probe_system(void)
{
union pnp_bios_install_struct *check;
u8 sum;
{
union pnp_bios_install_struct *check;
u8 sum;
@@
-505,7
+500,7
@@
static int __init exploding_pnp_bios(struct dmi_system_id *d)
return 0;
}
return 0;
}
-static struct dmi_system_id pnpbios_dmi_table[] = {
+static struct dmi_system_id pnpbios_dmi_table[]
__initdata
= {
{ /* PnPBIOS GPF on boot */
.callback = exploding_pnp_bios,
.ident = "Higraded P14H",
{ /* PnPBIOS GPF on boot */
.callback = exploding_pnp_bios,
.ident = "Higraded P14H",
@@
-527,7
+522,7
@@
static struct dmi_system_id pnpbios_dmi_table[] = {
{ }
};
{ }
};
-int __init pnpbios_init(void)
+
static
int __init pnpbios_init(void)
{
int ret;
{
int ret;
@@
-536,6
+531,14
@@
int __init pnpbios_init(void)
return -ENODEV;
}
return -ENODEV;
}
+#ifdef CONFIG_PNPACPI
+ if (!acpi_disabled && !pnpacpi_disabled) {
+ pnpbios_disabled = 1;
+ printk(KERN_INFO "PnPBIOS: Disabled by ACPI PNP\n");
+ return -ENODEV;
+ }
+#endif /* CONFIG_ACPI */
+
/* scan the system for pnpbios support */
if (!pnpbios_probe_system())
return -ENODEV;
/* scan the system for pnpbios support */
if (!pnpbios_probe_system())
return -ENODEV;
@@
-572,6
+575,8
@@
subsys_initcall(pnpbios_init);
static int __init pnpbios_thread_init(void)
{
static int __init pnpbios_thread_init(void)
{
+ if (pnpbios_disabled)
+ return 0;
#ifdef CONFIG_HOTPLUG
init_completion(&unload_sem);
if (kernel_thread(pnp_dock_thread, NULL, CLONE_KERNEL) > 0)
#ifdef CONFIG_HOTPLUG
init_completion(&unload_sem);
if (kernel_thread(pnp_dock_thread, NULL, CLONE_KERNEL) > 0)