aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp')
-rw-r--r--drivers/pnp/Makefile6
-rw-r--r--drivers/pnp/base.h7
-rw-r--r--drivers/pnp/card.c4
-rw-r--r--drivers/pnp/core.c15
-rw-r--r--drivers/pnp/driver.c9
-rw-r--r--drivers/pnp/isapnp/Makefile6
-rw-r--r--drivers/pnp/isapnp/proc.c16
-rw-r--r--drivers/pnp/manager.c7
-rw-r--r--drivers/pnp/pnpacpi/Makefile3
-rw-r--r--drivers/pnp/pnpacpi/core.c124
-rw-r--r--drivers/pnp/pnpbios/Makefile5
-rw-r--r--drivers/pnp/pnpbios/bioscalls.c2
-rw-r--r--drivers/pnp/pnpbios/proc.c1
-rw-r--r--drivers/pnp/resource.c17
14 files changed, 145 insertions, 77 deletions
diff --git a/drivers/pnp/Makefile b/drivers/pnp/Makefile
index 8de3775ec242..bfba893cb321 100644
--- a/drivers/pnp/Makefile
+++ b/drivers/pnp/Makefile
@@ -2,11 +2,13 @@
2# Makefile for the Linux Plug-and-Play Support. 2# Makefile for the Linux Plug-and-Play Support.
3# 3#
4 4
5obj-y := core.o card.o driver.o resource.o manager.o support.o interface.o quirks.o 5obj-y := pnp.o
6
7pnp-y := core.o card.o driver.o resource.o manager.o support.o interface.o quirks.o
6 8
7obj-$(CONFIG_PNPACPI) += pnpacpi/ 9obj-$(CONFIG_PNPACPI) += pnpacpi/
8obj-$(CONFIG_PNPBIOS) += pnpbios/ 10obj-$(CONFIG_PNPBIOS) += pnpbios/
9obj-$(CONFIG_ISAPNP) += isapnp/ 11obj-$(CONFIG_ISAPNP) += isapnp/
10 12
11# pnp_system_init goes after pnpacpi/pnpbios init 13# pnp_system_init goes after pnpacpi/pnpbios init
12obj-y += system.o 14pnp-y += system.o
diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h
index 0bab84ebb15d..fa4e0a5db3f8 100644
--- a/drivers/pnp/base.h
+++ b/drivers/pnp/base.h
@@ -12,11 +12,12 @@ void pnp_unregister_protocol(struct pnp_protocol *protocol);
12 12
13#define PNP_EISA_ID_MASK 0x7fffffff 13#define PNP_EISA_ID_MASK 0x7fffffff
14void pnp_eisa_id_to_string(u32 id, char *str); 14void pnp_eisa_id_to_string(u32 id, char *str);
15struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *, int id, char *pnpid); 15struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *, int id,
16 const char *pnpid);
16struct pnp_card *pnp_alloc_card(struct pnp_protocol *, int id, char *pnpid); 17struct pnp_card *pnp_alloc_card(struct pnp_protocol *, int id, char *pnpid);
17 18
18int pnp_add_device(struct pnp_dev *dev); 19int pnp_add_device(struct pnp_dev *dev);
19struct pnp_id *pnp_add_id(struct pnp_dev *dev, char *id); 20struct pnp_id *pnp_add_id(struct pnp_dev *dev, const char *id);
20 21
21int pnp_add_card(struct pnp_card *card); 22int pnp_add_card(struct pnp_card *card);
22void pnp_remove_card(struct pnp_card *card); 23void pnp_remove_card(struct pnp_card *card);
@@ -141,7 +142,9 @@ void __pnp_remove_device(struct pnp_dev *dev);
141int pnp_check_port(struct pnp_dev *dev, struct resource *res); 142int pnp_check_port(struct pnp_dev *dev, struct resource *res);
142int pnp_check_mem(struct pnp_dev *dev, struct resource *res); 143int pnp_check_mem(struct pnp_dev *dev, struct resource *res);
143int pnp_check_irq(struct pnp_dev *dev, struct resource *res); 144int pnp_check_irq(struct pnp_dev *dev, struct resource *res);
145#ifdef CONFIG_ISA_DMA_API
144int pnp_check_dma(struct pnp_dev *dev, struct resource *res); 146int pnp_check_dma(struct pnp_dev *dev, struct resource *res);
147#endif
145 148
146char *pnp_resource_type_name(struct resource *res); 149char *pnp_resource_type_name(struct resource *res);
147void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc); 150void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc);
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c
index 4a651f69e17c..bc00693d0c79 100644
--- a/drivers/pnp/card.c
+++ b/drivers/pnp/card.c
@@ -320,7 +320,7 @@ void pnp_remove_card_device(struct pnp_dev *dev)
320 * pnp_request_card_device - Searches for a PnP device under the specified card 320 * pnp_request_card_device - Searches for a PnP device under the specified card
321 * @clink: pointer to the card link, cannot be NULL 321 * @clink: pointer to the card link, cannot be NULL
322 * @id: pointer to a PnP ID structure that explains the rules for finding the device 322 * @id: pointer to a PnP ID structure that explains the rules for finding the device
323 * @from: Starting place to search from. If NULL it will start from the begining. 323 * @from: Starting place to search from. If NULL it will start from the beginning.
324 */ 324 */
325struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, 325struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
326 const char *id, struct pnp_dev *from) 326 const char *id, struct pnp_dev *from)
@@ -369,7 +369,7 @@ err_out:
369 369
370/** 370/**
371 * pnp_release_card_device - call this when the driver no longer needs the device 371 * pnp_release_card_device - call this when the driver no longer needs the device
372 * @dev: pointer to the PnP device stucture 372 * @dev: pointer to the PnP device structure
373 */ 373 */
374void pnp_release_card_device(struct pnp_dev *dev) 374void pnp_release_card_device(struct pnp_dev *dev)
375{ 375{
diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c
index 88b3cde52596..cb6ce42f8e77 100644
--- a/drivers/pnp/core.c
+++ b/drivers/pnp/core.c
@@ -124,7 +124,8 @@ static void pnp_release_device(struct device *dmdev)
124 kfree(dev); 124 kfree(dev);
125} 125}
126 126
127struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *protocol, int id, char *pnpid) 127struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *protocol, int id,
128 const char *pnpid)
128{ 129{
129 struct pnp_dev *dev; 130 struct pnp_dev *dev;
130 struct pnp_id *dev_id; 131 struct pnp_id *dev_id;
@@ -194,8 +195,9 @@ int pnp_add_device(struct pnp_dev *dev)
194 for (id = dev->id; id; id = id->next) 195 for (id = dev->id; id; id = id->next)
195 len += scnprintf(buf + len, sizeof(buf) - len, " %s", id->id); 196 len += scnprintf(buf + len, sizeof(buf) - len, " %s", id->id);
196 197
197 pnp_dbg(&dev->dev, "%s device, IDs%s (%s)\n", 198 dev_printk(KERN_DEBUG, &dev->dev, "%s device, IDs%s (%s)\n",
198 dev->protocol->name, buf, dev->active ? "active" : "disabled"); 199 dev->protocol->name, buf,
200 dev->active ? "active" : "disabled");
199 return 0; 201 return 0;
200} 202}
201 203
@@ -218,10 +220,5 @@ subsys_initcall(pnp_init);
218int pnp_debug; 220int pnp_debug;
219 221
220#if defined(CONFIG_PNP_DEBUG_MESSAGES) 222#if defined(CONFIG_PNP_DEBUG_MESSAGES)
221static int __init pnp_debug_setup(char *__unused) 223module_param_named(debug, pnp_debug, int, 0644);
222{
223 pnp_debug = 1;
224 return 1;
225}
226__setup("pnp.debug", pnp_debug_setup);
227#endif 224#endif
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
index cd11b113494f..00e94032531a 100644
--- a/drivers/pnp/driver.c
+++ b/drivers/pnp/driver.c
@@ -189,8 +189,11 @@ static int pnp_bus_resume(struct device *dev)
189 if (!pnp_drv) 189 if (!pnp_drv)
190 return 0; 190 return 0;
191 191
192 if (pnp_dev->protocol->resume) 192 if (pnp_dev->protocol->resume) {
193 pnp_dev->protocol->resume(pnp_dev); 193 error = pnp_dev->protocol->resume(pnp_dev);
194 if (error)
195 return error;
196 }
194 197
195 if (pnp_can_write(pnp_dev)) { 198 if (pnp_can_write(pnp_dev)) {
196 error = pnp_start_dev(pnp_dev); 199 error = pnp_start_dev(pnp_dev);
@@ -236,7 +239,7 @@ void pnp_unregister_driver(struct pnp_driver *drv)
236 * @dev: pointer to the desired device 239 * @dev: pointer to the desired device
237 * @id: pointer to an EISA id string 240 * @id: pointer to an EISA id string
238 */ 241 */
239struct pnp_id *pnp_add_id(struct pnp_dev *dev, char *id) 242struct pnp_id *pnp_add_id(struct pnp_dev *dev, const char *id)
240{ 243{
241 struct pnp_id *dev_id, *ptr; 244 struct pnp_id *dev_id, *ptr;
242 245
diff --git a/drivers/pnp/isapnp/Makefile b/drivers/pnp/isapnp/Makefile
index cac18bbfb817..6e607aa33aa3 100644
--- a/drivers/pnp/isapnp/Makefile
+++ b/drivers/pnp/isapnp/Makefile
@@ -1,7 +1,7 @@
1# 1#
2# Makefile for the kernel ISAPNP driver. 2# Makefile for the kernel ISAPNP driver.
3# 3#
4obj-y += pnp.o
5pnp-y := core.o compat.o
4 6
5isapnp-proc-$(CONFIG_PROC_FS) = proc.o 7pnp-$(CONFIG_PROC_FS) += proc.o
6
7obj-y := core.o compat.o $(isapnp-proc-y)
diff --git a/drivers/pnp/isapnp/proc.c b/drivers/pnp/isapnp/proc.c
index 3f94edab25fa..315b3112aca8 100644
--- a/drivers/pnp/isapnp/proc.c
+++ b/drivers/pnp/isapnp/proc.c
@@ -21,7 +21,6 @@
21#include <linux/isapnp.h> 21#include <linux/isapnp.h>
22#include <linux/proc_fs.h> 22#include <linux/proc_fs.h>
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/smp_lock.h>
25#include <asm/uaccess.h> 24#include <asm/uaccess.h>
26 25
27extern struct pnp_protocol isapnp_protocol; 26extern struct pnp_protocol isapnp_protocol;
@@ -31,8 +30,9 @@ static struct proc_dir_entry *isapnp_proc_bus_dir = NULL;
31static loff_t isapnp_proc_bus_lseek(struct file *file, loff_t off, int whence) 30static loff_t isapnp_proc_bus_lseek(struct file *file, loff_t off, int whence)
32{ 31{
33 loff_t new = -1; 32 loff_t new = -1;
33 struct inode *inode = file->f_path.dentry->d_inode;
34 34
35 lock_kernel(); 35 mutex_lock(&inode->i_mutex);
36 switch (whence) { 36 switch (whence) {
37 case 0: 37 case 0:
38 new = off; 38 new = off;
@@ -44,12 +44,12 @@ static loff_t isapnp_proc_bus_lseek(struct file *file, loff_t off, int whence)
44 new = 256 + off; 44 new = 256 + off;
45 break; 45 break;
46 } 46 }
47 if (new < 0 || new > 256) { 47 if (new < 0 || new > 256)
48 unlock_kernel(); 48 new = -EINVAL;
49 return -EINVAL; 49 else
50 } 50 file->f_pos = new;
51 unlock_kernel(); 51 mutex_unlock(&inode->i_mutex);
52 return (file->f_pos = new); 52 return new;
53} 53}
54 54
55static ssize_t isapnp_proc_bus_read(struct file *file, char __user * buf, 55static ssize_t isapnp_proc_bus_read(struct file *file, char __user * buf,
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c
index 0a15664eef1c..ed9ce507149a 100644
--- a/drivers/pnp/manager.c
+++ b/drivers/pnp/manager.c
@@ -171,6 +171,7 @@ __add:
171 return 0; 171 return 0;
172} 172}
173 173
174#ifdef CONFIG_ISA_DMA_API
174static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx) 175static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
175{ 176{
176 struct resource *res, local_res; 177 struct resource *res, local_res;
@@ -210,6 +211,7 @@ __add:
210 pnp_add_dma_resource(dev, res->start, res->flags); 211 pnp_add_dma_resource(dev, res->start, res->flags);
211 return 0; 212 return 0;
212} 213}
214#endif /* CONFIG_ISA_DMA_API */
213 215
214void pnp_init_resources(struct pnp_dev *dev) 216void pnp_init_resources(struct pnp_dev *dev)
215{ 217{
@@ -234,7 +236,8 @@ static void pnp_clean_resource_table(struct pnp_dev *dev)
234static int pnp_assign_resources(struct pnp_dev *dev, int set) 236static int pnp_assign_resources(struct pnp_dev *dev, int set)
235{ 237{
236 struct pnp_option *option; 238 struct pnp_option *option;
237 int nport = 0, nmem = 0, nirq = 0, ndma = 0; 239 int nport = 0, nmem = 0, nirq = 0;
240 int ndma __maybe_unused = 0;
238 int ret = 0; 241 int ret = 0;
239 242
240 pnp_dbg(&dev->dev, "pnp_assign_resources, try dependent set %d\n", set); 243 pnp_dbg(&dev->dev, "pnp_assign_resources, try dependent set %d\n", set);
@@ -256,9 +259,11 @@ static int pnp_assign_resources(struct pnp_dev *dev, int set)
256 case IORESOURCE_IRQ: 259 case IORESOURCE_IRQ:
257 ret = pnp_assign_irq(dev, &option->u.irq, nirq++); 260 ret = pnp_assign_irq(dev, &option->u.irq, nirq++);
258 break; 261 break;
262#ifdef CONFIG_ISA_DMA_API
259 case IORESOURCE_DMA: 263 case IORESOURCE_DMA:
260 ret = pnp_assign_dma(dev, &option->u.dma, ndma++); 264 ret = pnp_assign_dma(dev, &option->u.dma, ndma++);
261 break; 265 break;
266#endif
262 default: 267 default:
263 ret = -EINVAL; 268 ret = -EINVAL;
264 break; 269 break;
diff --git a/drivers/pnp/pnpacpi/Makefile b/drivers/pnp/pnpacpi/Makefile
index 905326fcca85..40c93da18252 100644
--- a/drivers/pnp/pnpacpi/Makefile
+++ b/drivers/pnp/pnpacpi/Makefile
@@ -1,5 +1,6 @@
1# 1#
2# Makefile for the kernel PNPACPI driver. 2# Makefile for the kernel PNPACPI driver.
3# 3#
4obj-y += pnp.o
4 5
5obj-y := core.o rsparser.o 6pnp-y := core.o rsparser.o
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index dc4e32e031e9..ca84d5099ce7 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -28,7 +28,7 @@
28#include "../base.h" 28#include "../base.h"
29#include "pnpacpi.h" 29#include "pnpacpi.h"
30 30
31static int num = 0; 31static int num;
32 32
33/* We need only to blacklist devices that have already an acpi driver that 33/* We need only to blacklist devices that have already an acpi driver that
34 * can't use pnp layer. We don't need to blacklist device that are directly 34 * can't use pnp layer. We don't need to blacklist device that are directly
@@ -59,7 +59,7 @@ static inline int __init is_exclusive_device(struct acpi_device *dev)
59#define TEST_ALPHA(c) \ 59#define TEST_ALPHA(c) \
60 if (!('@' <= (c) || (c) <= 'Z')) \ 60 if (!('@' <= (c) || (c) <= 'Z')) \
61 return 0 61 return 0
62static int __init ispnpidacpi(char *id) 62static int __init ispnpidacpi(const char *id)
63{ 63{
64 TEST_ALPHA(id[0]); 64 TEST_ALPHA(id[0]);
65 TEST_ALPHA(id[1]); 65 TEST_ALPHA(id[1]);
@@ -81,12 +81,19 @@ static int pnpacpi_get_resources(struct pnp_dev *dev)
81 81
82static int pnpacpi_set_resources(struct pnp_dev *dev) 82static int pnpacpi_set_resources(struct pnp_dev *dev)
83{ 83{
84 struct acpi_device *acpi_dev = dev->data; 84 struct acpi_device *acpi_dev;
85 acpi_handle handle = acpi_dev->handle; 85 acpi_handle handle;
86 struct acpi_buffer buffer; 86 struct acpi_buffer buffer;
87 int ret; 87 int ret;
88 88
89 pnp_dbg(&dev->dev, "set resources\n"); 89 pnp_dbg(&dev->dev, "set resources\n");
90
91 handle = DEVICE_ACPI_HANDLE(&dev->dev);
92 if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &acpi_dev))) {
93 dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__);
94 return -ENODEV;
95 }
96
90 ret = pnpacpi_build_resource_template(dev, &buffer); 97 ret = pnpacpi_build_resource_template(dev, &buffer);
91 if (ret) 98 if (ret)
92 return ret; 99 return ret;
@@ -105,12 +112,18 @@ static int pnpacpi_set_resources(struct pnp_dev *dev)
105 112
106static int pnpacpi_disable_resources(struct pnp_dev *dev) 113static int pnpacpi_disable_resources(struct pnp_dev *dev)
107{ 114{
108 struct acpi_device *acpi_dev = dev->data; 115 struct acpi_device *acpi_dev;
109 acpi_handle handle = acpi_dev->handle; 116 acpi_handle handle;
110 int ret; 117 int ret;
111 118
112 dev_dbg(&dev->dev, "disable resources\n"); 119 dev_dbg(&dev->dev, "disable resources\n");
113 120
121 handle = DEVICE_ACPI_HANDLE(&dev->dev);
122 if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &acpi_dev))) {
123 dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__);
124 return 0;
125 }
126
114 /* acpi_unregister_gsi(pnp_irq(dev, 0)); */ 127 /* acpi_unregister_gsi(pnp_irq(dev, 0)); */
115 ret = 0; 128 ret = 0;
116 if (acpi_bus_power_manageable(handle)) 129 if (acpi_bus_power_manageable(handle))
@@ -124,46 +137,74 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev)
124#ifdef CONFIG_ACPI_SLEEP 137#ifdef CONFIG_ACPI_SLEEP
125static bool pnpacpi_can_wakeup(struct pnp_dev *dev) 138static bool pnpacpi_can_wakeup(struct pnp_dev *dev)
126{ 139{
127 struct acpi_device *acpi_dev = dev->data; 140 struct acpi_device *acpi_dev;
128 acpi_handle handle = acpi_dev->handle; 141 acpi_handle handle;
142
143 handle = DEVICE_ACPI_HANDLE(&dev->dev);
144 if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &acpi_dev))) {
145 dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__);
146 return false;
147 }
129 148
130 return acpi_bus_can_wakeup(handle); 149 return acpi_bus_can_wakeup(handle);
131} 150}
132 151
133static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state) 152static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state)
134{ 153{
135 struct acpi_device *acpi_dev = dev->data; 154 struct acpi_device *acpi_dev;
136 acpi_handle handle = acpi_dev->handle; 155 acpi_handle handle;
137 int power_state; 156 int error = 0;
157
158 handle = DEVICE_ACPI_HANDLE(&dev->dev);
159 if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &acpi_dev))) {
160 dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__);
161 return 0;
162 }
138 163
139 if (device_can_wakeup(&dev->dev)) { 164 if (device_can_wakeup(&dev->dev)) {
140 int rc = acpi_pm_device_sleep_wake(&dev->dev, 165 error = acpi_pm_device_sleep_wake(&dev->dev,
141 device_may_wakeup(&dev->dev)); 166 device_may_wakeup(&dev->dev));
167 if (error)
168 return error;
169 }
170
171 if (acpi_bus_power_manageable(handle)) {
172 int power_state = acpi_pm_device_sleep_state(&dev->dev, NULL);
142 173
143 if (rc) 174 if (power_state < 0)
144 return rc; 175 power_state = (state.event == PM_EVENT_ON) ?
176 ACPI_STATE_D0 : ACPI_STATE_D3;
177
178 /*
179 * acpi_bus_set_power() often fails (keyboard port can't be
180 * powered-down?), and in any case, our return value is ignored
181 * by pnp_bus_suspend(). Hence we don't revert the wakeup
182 * setting if the set_power fails.
183 */
184 error = acpi_bus_set_power(handle, power_state);
145 } 185 }
146 power_state = acpi_pm_device_sleep_state(&dev->dev, NULL); 186
147 if (power_state < 0) 187 return error;
148 power_state = (state.event == PM_EVENT_ON) ?
149 ACPI_STATE_D0 : ACPI_STATE_D3;
150
151 /* acpi_bus_set_power() often fails (keyboard port can't be
152 * powered-down?), and in any case, our return value is ignored
153 * by pnp_bus_suspend(). Hence we don't revert the wakeup
154 * setting if the set_power fails.
155 */
156 return acpi_bus_set_power(handle, power_state);
157} 188}
158 189
159static int pnpacpi_resume(struct pnp_dev *dev) 190static int pnpacpi_resume(struct pnp_dev *dev)
160{ 191{
161 struct acpi_device *acpi_dev = dev->data; 192 struct acpi_device *acpi_dev;
162 acpi_handle handle = acpi_dev->handle; 193 acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev);
194 int error = 0;
195
196 if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &acpi_dev))) {
197 dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__);
198 return -ENODEV;
199 }
163 200
164 if (device_may_wakeup(&dev->dev)) 201 if (device_may_wakeup(&dev->dev))
165 acpi_pm_device_sleep_wake(&dev->dev, false); 202 acpi_pm_device_sleep_wake(&dev->dev, false);
166 return acpi_bus_set_power(handle, ACPI_STATE_D0); 203
204 if (acpi_bus_power_manageable(handle))
205 error = acpi_bus_set_power(handle, ACPI_STATE_D0);
206
207 return error;
167} 208}
168#endif 209#endif
169 210
@@ -180,11 +221,24 @@ struct pnp_protocol pnpacpi_protocol = {
180}; 221};
181EXPORT_SYMBOL(pnpacpi_protocol); 222EXPORT_SYMBOL(pnpacpi_protocol);
182 223
224static char *__init pnpacpi_get_id(struct acpi_device *device)
225{
226 struct acpi_hardware_id *id;
227
228 list_for_each_entry(id, &device->pnp.ids, list) {
229 if (ispnpidacpi(id->id))
230 return id->id;
231 }
232
233 return NULL;
234}
235
183static int __init pnpacpi_add_device(struct acpi_device *device) 236static int __init pnpacpi_add_device(struct acpi_device *device)
184{ 237{
185 acpi_handle temp = NULL; 238 acpi_handle temp = NULL;
186 acpi_status status; 239 acpi_status status;
187 struct pnp_dev *dev; 240 struct pnp_dev *dev;
241 char *pnpid;
188 struct acpi_hardware_id *id; 242 struct acpi_hardware_id *id;
189 243
190 /* 244 /*
@@ -192,11 +246,17 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
192 * driver should not be loaded. 246 * driver should not be loaded.
193 */ 247 */
194 status = acpi_get_handle(device->handle, "_CRS", &temp); 248 status = acpi_get_handle(device->handle, "_CRS", &temp);
195 if (ACPI_FAILURE(status) || !ispnpidacpi(acpi_device_hid(device)) || 249 if (ACPI_FAILURE(status))
196 is_exclusive_device(device) || (!device->status.present)) 250 return 0;
251
252 pnpid = pnpacpi_get_id(device);
253 if (!pnpid)
254 return 0;
255
256 if (is_exclusive_device(device) || !device->status.present)
197 return 0; 257 return 0;
198 258
199 dev = pnp_alloc_dev(&pnpacpi_protocol, num, acpi_device_hid(device)); 259 dev = pnp_alloc_dev(&pnpacpi_protocol, num, pnpid);
200 if (!dev) 260 if (!dev)
201 return -ENOMEM; 261 return -ENOMEM;
202 262
@@ -227,7 +287,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
227 pnpacpi_parse_resource_option_data(dev); 287 pnpacpi_parse_resource_option_data(dev);
228 288
229 list_for_each_entry(id, &device->pnp.ids, list) { 289 list_for_each_entry(id, &device->pnp.ids, list) {
230 if (!strcmp(id->id, acpi_device_hid(device))) 290 if (!strcmp(id->id, pnpid))
231 continue; 291 continue;
232 if (!ispnpidacpi(id->id)) 292 if (!ispnpidacpi(id->id))
233 continue; 293 continue;
diff --git a/drivers/pnp/pnpbios/Makefile b/drivers/pnp/pnpbios/Makefile
index 3cd3ed760605..240b0ffb83ca 100644
--- a/drivers/pnp/pnpbios/Makefile
+++ b/drivers/pnp/pnpbios/Makefile
@@ -1,7 +1,8 @@
1# 1#
2# Makefile for the kernel PNPBIOS driver. 2# Makefile for the kernel PNPBIOS driver.
3# 3#
4obj-y := pnp.o
4 5
5pnpbios-proc-$(CONFIG_PNPBIOS_PROC_FS) = proc.o 6pnp-y := core.o bioscalls.o rsparser.o
6 7
7obj-y := core.o bioscalls.o rsparser.o $(pnpbios-proc-y) 8pnp-$(CONFIG_PNPBIOS_PROC_FS) += proc.o
diff --git a/drivers/pnp/pnpbios/bioscalls.c b/drivers/pnp/pnpbios/bioscalls.c
index 8591f6ab1b35..b859d16cf78c 100644
--- a/drivers/pnp/pnpbios/bioscalls.c
+++ b/drivers/pnp/pnpbios/bioscalls.c
@@ -219,7 +219,7 @@ void pnpbios_print_status(const char *module, u16 status)
219 module); 219 module);
220 break; 220 break;
221 case PNP_HARDWARE_ERROR: 221 case PNP_HARDWARE_ERROR:
222 printk(KERN_ERR "PnPBIOS: %s: a hardware failure has occured\n", 222 printk(KERN_ERR "PnPBIOS: %s: a hardware failure has occurred\n",
223 module); 223 module);
224 break; 224 break;
225 default: 225 default:
diff --git a/drivers/pnp/pnpbios/proc.c b/drivers/pnp/pnpbios/proc.c
index 2d8ac43f78e8..bc89f392a629 100644
--- a/drivers/pnp/pnpbios/proc.c
+++ b/drivers/pnp/pnpbios/proc.c
@@ -11,7 +11,6 @@
11 * 11 *
12 * The .../escd file is utilized by the lsescd utility written by 12 * The .../escd file is utilized by the lsescd utility written by
13 * Gunther Mayer. 13 * Gunther Mayer.
14 * http://home.t-online.de/home/gunther.mayer/lsescd
15 * 14 *
16 * The .../legacy_device_resources file is not used yet. 15 * The .../legacy_device_resources file is not used yet.
17 * 16 *
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index e3446ab8b563..b0ecacbe53b1 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -409,9 +409,9 @@ int pnp_check_irq(struct pnp_dev *dev, struct resource *res)
409 return 1; 409 return 1;
410} 410}
411 411
412#ifdef CONFIG_ISA_DMA_API
412int pnp_check_dma(struct pnp_dev *dev, struct resource *res) 413int pnp_check_dma(struct pnp_dev *dev, struct resource *res)
413{ 414{
414#ifndef CONFIG_IA64
415 int i; 415 int i;
416 struct pnp_dev *tdev; 416 struct pnp_dev *tdev;
417 struct resource *tres; 417 struct resource *tres;
@@ -466,11 +466,8 @@ int pnp_check_dma(struct pnp_dev *dev, struct resource *res)
466 } 466 }
467 467
468 return 1; 468 return 1;
469#else
470 /* IA64 does not have legacy DMA */
471 return 0;
472#endif
473} 469}
470#endif /* CONFIG_ISA_DMA_API */
474 471
475unsigned long pnp_resource_type(struct resource *res) 472unsigned long pnp_resource_type(struct resource *res)
476{ 473{
@@ -523,7 +520,7 @@ struct pnp_resource *pnp_add_irq_resource(struct pnp_dev *dev, int irq,
523 res->start = irq; 520 res->start = irq;
524 res->end = irq; 521 res->end = irq;
525 522
526 pnp_dbg(&dev->dev, " add %pr\n", res); 523 dev_printk(KERN_DEBUG, &dev->dev, "%pR\n", res);
527 return pnp_res; 524 return pnp_res;
528} 525}
529 526
@@ -544,7 +541,7 @@ struct pnp_resource *pnp_add_dma_resource(struct pnp_dev *dev, int dma,
544 res->start = dma; 541 res->start = dma;
545 res->end = dma; 542 res->end = dma;
546 543
547 pnp_dbg(&dev->dev, " add %pr\n", res); 544 dev_printk(KERN_DEBUG, &dev->dev, "%pR\n", res);
548 return pnp_res; 545 return pnp_res;
549} 546}
550 547
@@ -568,7 +565,7 @@ struct pnp_resource *pnp_add_io_resource(struct pnp_dev *dev,
568 res->start = start; 565 res->start = start;
569 res->end = end; 566 res->end = end;
570 567
571 pnp_dbg(&dev->dev, " add %pr\n", res); 568 dev_printk(KERN_DEBUG, &dev->dev, "%pR\n", res);
572 return pnp_res; 569 return pnp_res;
573} 570}
574 571
@@ -592,7 +589,7 @@ struct pnp_resource *pnp_add_mem_resource(struct pnp_dev *dev,
592 res->start = start; 589 res->start = start;
593 res->end = end; 590 res->end = end;
594 591
595 pnp_dbg(&dev->dev, " add %pr\n", res); 592 dev_printk(KERN_DEBUG, &dev->dev, "%pR\n", res);
596 return pnp_res; 593 return pnp_res;
597} 594}
598 595
@@ -616,7 +613,7 @@ struct pnp_resource *pnp_add_bus_resource(struct pnp_dev *dev,
616 res->start = start; 613 res->start = start;
617 res->end = end; 614 res->end = end;
618 615
619 pnp_dbg(&dev->dev, " add %pr\n", res); 616 dev_printk(KERN_DEBUG, &dev->dev, "%pR\n", res);
620 return pnp_res; 617 return pnp_res;
621} 618}
622 619