X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fpnp%2Fpnpbios%2Fcore.c;h=19a4be1a9a31afd73567724ccdf3b56a03445bc7;hb=04489eeb02a40bc15029886cef7285ada3ab0de6;hp=f7e67197a56847c9d937ab0cb2efd595ee3fc306;hpb=6e5565f949af1322f8f3d3f43d044645ae448499;p=linux-2.6 diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c index f7e67197a5..19a4be1a9a 100644 --- a/drivers/pnp/pnpbios/core.c +++ b/drivers/pnp/pnpbios/core.c @@ -50,7 +50,6 @@ #include #include #include -#include #include #include #include @@ -69,6 +68,7 @@ #include #include +#include "../base.h" #include "pnpbios.h" /* @@ -105,8 +105,6 @@ static int pnp_dock_event(int dock, struct pnp_docking_station_info *info) char *argv[3], **envp, *buf, *scratch; int i = 0, value; - if (!current->fs->root) - return -EAGAIN; if (!(envp = kcalloc(20, sizeof(char *), GFP_KERNEL))) return -ENOMEM; if (!(buf = kzalloc(256, GFP_KERNEL))) { @@ -205,8 +203,7 @@ static int pnp_dock_thread(void *unused) #endif /* CONFIG_HOTPLUG */ -static int pnpbios_get_resources(struct pnp_dev *dev, - struct pnp_resource_table *res) +static int pnpbios_get_resources(struct pnp_dev *dev) { u8 nodenum = dev->number; struct pnp_bios_node *node; @@ -214,6 +211,7 @@ static int pnpbios_get_resources(struct pnp_dev *dev, if (!pnpbios_is_dynamic(dev)) return -EPERM; + dev_dbg(&dev->dev, "get resources\n"); node = kzalloc(node_info.max_node_size, GFP_KERNEL); if (!node) return -1; @@ -221,14 +219,13 @@ static int pnpbios_get_resources(struct pnp_dev *dev, kfree(node); return -ENODEV; } - pnpbios_read_resources_from_node(res, node); + pnpbios_read_resources_from_node(dev, node); dev->active = pnp_is_active(dev); kfree(node); return 0; } -static int pnpbios_set_resources(struct pnp_dev *dev, - struct pnp_resource_table *res) +static int pnpbios_set_resources(struct pnp_dev *dev) { u8 nodenum = dev->number; struct pnp_bios_node *node; @@ -237,6 +234,7 @@ static int pnpbios_set_resources(struct pnp_dev *dev, if (!pnpbios_is_dynamic(dev)) return -EPERM; + dev_dbg(&dev->dev, "set resources\n"); node = kzalloc(node_info.max_node_size, GFP_KERNEL); if (!node) return -1; @@ -244,7 +242,7 @@ static int pnpbios_set_resources(struct pnp_dev *dev, kfree(node); return -ENODEV; } - if (pnpbios_write_resources_to_node(res, node) < 0) { + if (pnpbios_write_resources_to_node(dev, node) < 0) { kfree(node); return -1; } @@ -319,7 +317,6 @@ static int __init insert_device(struct pnp_bios_node *node) { struct list_head *pos; struct pnp_dev *dev; - struct pnp_id *dev_id; char id[8]; /* check if the device is already added */ @@ -329,20 +326,11 @@ static int __init insert_device(struct pnp_bios_node *node) return -1; } - dev = kzalloc(sizeof(struct pnp_dev), GFP_KERNEL); + pnp_eisa_id_to_string(node->eisa_id & PNP_EISA_ID_MASK, id); + dev = pnp_alloc_dev(&pnpbios_protocol, node->handle, id); if (!dev) return -1; - dev_id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL); - if (!dev_id) { - kfree(dev); - return -1; - } - - dev->number = node->handle; - pnpid32_to_pnpid(node->eisa_id, id); - memcpy(dev_id->id, id, 7); - pnp_add_id(dev_id, dev); pnpbios_parse_data_stream(dev, node); dev->active = pnp_is_active(dev); dev->flags = node->flags; @@ -355,11 +343,10 @@ static int __init insert_device(struct pnp_bios_node *node) dev->capabilities |= PNP_WRITE; if (dev->flags & PNPBIOS_REMOVABLE) dev->capabilities |= PNP_REMOVABLE; - dev->protocol = &pnpbios_protocol; /* clear out the damaged flags */ if (!dev->active) - pnp_init_resource_table(&dev->res); + pnp_init_resources(dev); pnp_add_device(dev); pnpbios_interface_attach_device(node);