diff options
Diffstat (limited to 'drivers/pnp')
-rw-r--r-- | drivers/pnp/system.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/drivers/pnp/system.c b/drivers/pnp/system.c index a06f980b3ac9..55c4563986b3 100644 --- a/drivers/pnp/system.c +++ b/drivers/pnp/system.c | |||
@@ -22,36 +22,39 @@ static const struct pnp_device_id pnp_dev_table[] = { | |||
22 | {"", 0} | 22 | {"", 0} |
23 | }; | 23 | }; |
24 | 24 | ||
25 | static void reserve_range(const char *pnpid, resource_size_t start, | 25 | static void reserve_range(struct pnp_dev *dev, resource_size_t start, |
26 | resource_size_t end, int port) | 26 | resource_size_t end, int port) |
27 | { | 27 | { |
28 | struct resource *res; | ||
29 | char *regionid; | 28 | char *regionid; |
29 | const char *pnpid = dev->dev.bus_id; | ||
30 | struct resource *res; | ||
30 | 31 | ||
31 | regionid = kmalloc(16, GFP_KERNEL); | 32 | regionid = kmalloc(16, GFP_KERNEL); |
32 | if (regionid == NULL) | 33 | if (!regionid) |
33 | return; | 34 | return; |
35 | |||
34 | snprintf(regionid, 16, "pnp %s", pnpid); | 36 | snprintf(regionid, 16, "pnp %s", pnpid); |
35 | if (port) | 37 | if (port) |
36 | res = request_region(start, end - start + 1, regionid); | 38 | res = request_region(start, end - start + 1, regionid); |
37 | else | 39 | else |
38 | res = request_mem_region(start, end - start + 1, regionid); | 40 | res = request_mem_region(start, end - start + 1, regionid); |
39 | if (res == NULL) | 41 | if (res) |
40 | kfree(regionid); | ||
41 | else | ||
42 | res->flags &= ~IORESOURCE_BUSY; | 42 | res->flags &= ~IORESOURCE_BUSY; |
43 | else | ||
44 | kfree(regionid); | ||
45 | |||
43 | /* | 46 | /* |
44 | * Failures at this point are usually harmless. pci quirks for | 47 | * Failures at this point are usually harmless. pci quirks for |
45 | * example do reserve stuff they know about too, so we may well | 48 | * example do reserve stuff they know about too, so we may well |
46 | * have double reservations. | 49 | * have double reservations. |
47 | */ | 50 | */ |
48 | printk(KERN_INFO "pnp: %s: %s range 0x%llx-0x%llx %s reserved\n", | 51 | dev_info(&dev->dev, "%s range 0x%llx-0x%llx %s reserved\n", |
49 | pnpid, port ? "ioport" : "iomem", | 52 | port ? "ioport" : "iomem", |
50 | (unsigned long long)start, (unsigned long long)end, | 53 | (unsigned long long) start, (unsigned long long) end, |
51 | NULL != res ? "has been" : "could not be"); | 54 | res ? "has been" : "could not be"); |
52 | } | 55 | } |
53 | 56 | ||
54 | static void reserve_resources_of_dev(const struct pnp_dev *dev) | 57 | static void reserve_resources_of_dev(struct pnp_dev *dev) |
55 | { | 58 | { |
56 | int i; | 59 | int i; |
57 | 60 | ||
@@ -73,7 +76,7 @@ static void reserve_resources_of_dev(const struct pnp_dev *dev) | |||
73 | if (pnp_port_end(dev, i) < pnp_port_start(dev, i)) | 76 | if (pnp_port_end(dev, i) < pnp_port_start(dev, i)) |
74 | continue; /* invalid */ | 77 | continue; /* invalid */ |
75 | 78 | ||
76 | reserve_range(dev->dev.bus_id, pnp_port_start(dev, i), | 79 | reserve_range(dev, pnp_port_start(dev, i), |
77 | pnp_port_end(dev, i), 1); | 80 | pnp_port_end(dev, i), 1); |
78 | } | 81 | } |
79 | 82 | ||
@@ -81,7 +84,7 @@ static void reserve_resources_of_dev(const struct pnp_dev *dev) | |||
81 | if (!pnp_mem_valid(dev, i)) | 84 | if (!pnp_mem_valid(dev, i)) |
82 | continue; | 85 | continue; |
83 | 86 | ||
84 | reserve_range(dev->dev.bus_id, pnp_mem_start(dev, i), | 87 | reserve_range(dev, pnp_mem_start(dev, i), |
85 | pnp_mem_end(dev, i), 0); | 88 | pnp_mem_end(dev, i), 0); |
86 | } | 89 | } |
87 | } | 90 | } |