X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fpnp%2Fpnpbios%2Fcore.c;h=95738dbd5d4555cec6428595b06ce72cd32aa8be;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=0d1736c03b968400d8f6fef31fe754dff6ec799c;hpb=6a77f38946aaee1cd85eeec6cf4229b204c15071;p=linux-2.6.git diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c index 0d1736c03..95738dbd5 100644 --- a/drivers/pnp/pnpbios/core.c +++ b/drivers/pnp/pnpbios/core.c @@ -12,7 +12,7 @@ * Minor reorganizations by David Hinds * Further modifications (C) 2001, 2002 by: * Alan Cox - * Thomas Hood + * Thomas Hood * Brian Gerst * * Ported to the PnP Layer and several additional improvements (C) 2002 @@ -56,12 +56,12 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include @@ -86,16 +86,6 @@ int pnp_bios_present(void) 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 @@ -116,21 +106,20 @@ static int pnp_dock_event(int dock, struct pnp_docking_station_info *info) char *argv [3], **envp, *buf, *scratch; int i = 0, value; - if (!hotplug_path [0]) - return -ENOENT; if (!current->fs->root) { return -EAGAIN; } - if (!(envp = (char **) pnpbios_kmalloc (20 * sizeof (char *), GFP_KERNEL))) { + if (!(envp = kcalloc(20, sizeof (char *), GFP_KERNEL))) { return -ENOMEM; } - if (!(buf = pnpbios_kmalloc (256, GFP_KERNEL))) { + if (!(buf = kzalloc(256, GFP_KERNEL))) { 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; @@ -180,8 +169,12 @@ static int pnp_dock_thread(void * unused) * Poll every 2 seconds */ msleep_interruptible(2000); - if(signal_pending(current)) + + if(signal_pending(current)) { + if (try_to_freeze()) + continue; break; + } status = pnp_bios_dock_station_info(&now); @@ -227,7 +220,7 @@ static int pnpbios_get_resources(struct pnp_dev * dev, struct pnp_resource_table if(!pnpbios_is_dynamic(dev)) return -EPERM; - node = pnpbios_kmalloc(node_info.max_node_size, GFP_KERNEL); + node = kzalloc(node_info.max_node_size, GFP_KERNEL); if (!node) return -1; if (pnp_bios_get_dev_node(&nodenum, (char )PNPMODE_DYNAMIC, node)) { @@ -250,7 +243,7 @@ static int pnpbios_set_resources(struct pnp_dev * dev, struct pnp_resource_table if (!pnpbios_is_dynamic(dev)) return -EPERM; - node = pnpbios_kmalloc(node_info.max_node_size, GFP_KERNEL); + node = kzalloc(node_info.max_node_size, GFP_KERNEL); if (!node) return -1; if (pnp_bios_get_dev_node(&nodenum, (char )PNPMODE_DYNAMIC, node)) { @@ -301,7 +294,7 @@ static int pnpbios_disable_resources(struct pnp_dev *dev) if(dev->flags & PNPBIOS_NO_DISABLE || !pnpbios_is_dynamic(dev)) return -EPERM; - node = pnpbios_kmalloc(node_info.max_node_size, GFP_KERNEL); + node = kzalloc(node_info.max_node_size, GFP_KERNEL); if (!node) return -ENOMEM; @@ -343,7 +336,7 @@ static int insert_device(struct pnp_dev *dev, struct pnp_bios_node * node) } /* set the initial values for the PnP device */ - dev_id = pnpbios_kmalloc(sizeof(struct pnp_id), GFP_KERNEL); + dev_id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL); if (!dev_id) return -1; pnpid32_to_pnpid(node->eisa_id,id); @@ -354,7 +347,7 @@ static int insert_device(struct pnp_dev *dev, struct pnp_bios_node * node) dev->flags = node->flags; if (!(dev->flags & PNPBIOS_NO_CONFIG)) dev->capabilities |= PNP_CONFIGURABLE; - if (!(dev->flags & PNPBIOS_NO_DISABLE)) + if (!(dev->flags & PNPBIOS_NO_DISABLE) && pnpbios_is_dynamic(dev)) dev->capabilities |= PNP_DISABLE; dev->capabilities |= PNP_READ; if (pnpbios_is_dynamic(dev)) @@ -381,7 +374,7 @@ static void __init build_devlist(void) struct pnp_bios_node *node; struct pnp_dev *dev; - node = pnpbios_kmalloc(node_info.max_node_size, GFP_KERNEL); + node = kzalloc(node_info.max_node_size, GFP_KERNEL); if (!node) return; @@ -398,7 +391,7 @@ static void __init build_devlist(void) break; } nodes_got++; - dev = pnpbios_kmalloc(sizeof (struct pnp_dev), GFP_KERNEL); + dev = kzalloc(sizeof (struct pnp_dev), GFP_KERNEL); if (!dev) break; if(insert_device(dev,node)<0) @@ -454,7 +447,7 @@ __setup("pnpbios=", pnpbios_setup); /* 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; @@ -508,7 +501,7 @@ static int __init exploding_pnp_bios(struct dmi_system_id *d) 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", @@ -530,11 +523,16 @@ static struct dmi_system_id pnpbios_dmi_table[] = { { } }; -int __init pnpbios_init(void) +static int __init pnpbios_init(void) { int ret; - if (pnpbios_disabled || dmi_check_system(pnpbios_dmi_table)) { +#if defined(CONFIG_PPC_MERGE) + if (check_legacy_ioport(PNPBIOS_BASE)) + return -ENODEV; +#endif + if (pnpbios_disabled || dmi_check_system(pnpbios_dmi_table) || + paravirt_enabled()) { printk(KERN_INFO "PnPBIOS: Disabled\n"); return -ENODEV; } @@ -583,6 +581,10 @@ subsys_initcall(pnpbios_init); static int __init pnpbios_thread_init(void) { +#if defined(CONFIG_PPC_MERGE) + if (check_legacy_ioport(PNPBIOS_BASE)) + return 0; +#endif if (pnpbios_disabled) return 0; #ifdef CONFIG_HOTPLUG