aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp')
-rw-r--r--drivers/pnp/manager.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c
index c706dd2ddb02..1adc83fdabb6 100644
--- a/drivers/pnp/manager.c
+++ b/drivers/pnp/manager.c
@@ -26,7 +26,7 @@ static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx)
26 dev_dbg(&dev->dev, " io %d already set to %#llx-%#llx " 26 dev_dbg(&dev->dev, " io %d already set to %#llx-%#llx "
27 "flags %#lx\n", idx, (unsigned long long) res->start, 27 "flags %#lx\n", idx, (unsigned long long) res->start,
28 (unsigned long long) res->end, res->flags); 28 (unsigned long long) res->end, res->flags);
29 return 1; 29 return 0;
30 } 30 }
31 31
32 res = &local_res; 32 res = &local_res;
@@ -51,13 +51,13 @@ static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx)
51 "(min %#llx max %#llx)\n", idx, 51 "(min %#llx max %#llx)\n", idx,
52 (unsigned long long) rule->min, 52 (unsigned long long) rule->min,
53 (unsigned long long) rule->max); 53 (unsigned long long) rule->max);
54 return 0; 54 return -EBUSY;
55 } 55 }
56 } 56 }
57 57
58__add: 58__add:
59 pnp_add_io_resource(dev, res->start, res->end, res->flags); 59 pnp_add_io_resource(dev, res->start, res->end, res->flags);
60 return 1; 60 return 0;
61} 61}
62 62
63static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx) 63static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
@@ -69,7 +69,7 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
69 dev_dbg(&dev->dev, " mem %d already set to %#llx-%#llx " 69 dev_dbg(&dev->dev, " mem %d already set to %#llx-%#llx "
70 "flags %#lx\n", idx, (unsigned long long) res->start, 70 "flags %#lx\n", idx, (unsigned long long) res->start,
71 (unsigned long long) res->end, res->flags); 71 (unsigned long long) res->end, res->flags);
72 return 1; 72 return 0;
73 } 73 }
74 74
75 res = &local_res; 75 res = &local_res;
@@ -103,13 +103,13 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
103 "(min %#llx max %#llx)\n", idx, 103 "(min %#llx max %#llx)\n", idx,
104 (unsigned long long) rule->min, 104 (unsigned long long) rule->min,
105 (unsigned long long) rule->max); 105 (unsigned long long) rule->max);
106 return 0; 106 return -EBUSY;
107 } 107 }
108 } 108 }
109 109
110__add: 110__add:
111 pnp_add_mem_resource(dev, res->start, res->end, res->flags); 111 pnp_add_mem_resource(dev, res->start, res->end, res->flags);
112 return 1; 112 return 0;
113} 113}
114 114
115static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx) 115static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx)
@@ -126,7 +126,7 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx)
126 if (res) { 126 if (res) {
127 dev_dbg(&dev->dev, " irq %d already set to %d flags %#lx\n", 127 dev_dbg(&dev->dev, " irq %d already set to %d flags %#lx\n",
128 idx, (int) res->start, res->flags); 128 idx, (int) res->start, res->flags);
129 return 1; 129 return 0;
130 } 130 }
131 131
132 res = &local_res; 132 res = &local_res;
@@ -154,14 +154,14 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx)
154 } 154 }
155 } 155 }
156 dev_dbg(&dev->dev, " couldn't assign irq %d\n", idx); 156 dev_dbg(&dev->dev, " couldn't assign irq %d\n", idx);
157 return 0; 157 return -EBUSY;
158 158
159__add: 159__add:
160 pnp_add_irq_resource(dev, res->start, res->flags); 160 pnp_add_irq_resource(dev, res->start, res->flags);
161 return 1; 161 return 0;
162} 162}
163 163
164static void pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx) 164static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
165{ 165{
166 struct resource *res, local_res; 166 struct resource *res, local_res;
167 int i; 167 int i;
@@ -175,7 +175,7 @@ static void pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
175 if (res) { 175 if (res) {
176 dev_dbg(&dev->dev, " dma %d already set to %d flags %#lx\n", 176 dev_dbg(&dev->dev, " dma %d already set to %d flags %#lx\n",
177 idx, (int) res->start, res->flags); 177 idx, (int) res->start, res->flags);
178 return; 178 return 0;
179 } 179 }
180 180
181 res = &local_res; 181 res = &local_res;
@@ -198,6 +198,7 @@ static void pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
198 198
199__add: 199__add:
200 pnp_add_dma_resource(dev, res->start, res->flags); 200 pnp_add_dma_resource(dev, res->start, res->flags);
201 return 0;
201} 202}
202 203
203void pnp_init_resources(struct pnp_dev *dev) 204void pnp_init_resources(struct pnp_dev *dev)
@@ -243,25 +244,26 @@ static int pnp_assign_resources(struct pnp_dev *dev, int depnum)
243 irq = dev->independent->irq; 244 irq = dev->independent->irq;
244 dma = dev->independent->dma; 245 dma = dev->independent->dma;
245 while (port) { 246 while (port) {
246 if (!pnp_assign_port(dev, port, nport)) 247 if (pnp_assign_port(dev, port, nport) < 0)
247 goto fail; 248 goto fail;
248 nport++; 249 nport++;
249 port = port->next; 250 port = port->next;
250 } 251 }
251 while (mem) { 252 while (mem) {
252 if (!pnp_assign_mem(dev, mem, nmem)) 253 if (pnp_assign_mem(dev, mem, nmem) < 0)
253 goto fail; 254 goto fail;
254 nmem++; 255 nmem++;
255 mem = mem->next; 256 mem = mem->next;
256 } 257 }
257 while (irq) { 258 while (irq) {
258 if (!pnp_assign_irq(dev, irq, nirq)) 259 if (pnp_assign_irq(dev, irq, nirq) < 0)
259 goto fail; 260 goto fail;
260 nirq++; 261 nirq++;
261 irq = irq->next; 262 irq = irq->next;
262 } 263 }
263 while (dma) { 264 while (dma) {
264 pnp_assign_dma(dev, dma, ndma); 265 if (pnp_assign_dma(dev, dma, ndma) < 0)
266 goto fail;
265 ndma++; 267 ndma++;
266 dma = dma->next; 268 dma = dma->next;
267 } 269 }
@@ -281,25 +283,26 @@ static int pnp_assign_resources(struct pnp_dev *dev, int depnum)
281 irq = dep->irq; 283 irq = dep->irq;
282 dma = dep->dma; 284 dma = dep->dma;
283 while (port) { 285 while (port) {
284 if (!pnp_assign_port(dev, port, nport)) 286 if (pnp_assign_port(dev, port, nport) < 0)
285 goto fail; 287 goto fail;
286 nport++; 288 nport++;
287 port = port->next; 289 port = port->next;
288 } 290 }
289 while (mem) { 291 while (mem) {
290 if (!pnp_assign_mem(dev, mem, nmem)) 292 if (pnp_assign_mem(dev, mem, nmem) < 0)
291 goto fail; 293 goto fail;
292 nmem++; 294 nmem++;
293 mem = mem->next; 295 mem = mem->next;
294 } 296 }
295 while (irq) { 297 while (irq) {
296 if (!pnp_assign_irq(dev, irq, nirq)) 298 if (pnp_assign_irq(dev, irq, nirq) < 0)
297 goto fail; 299 goto fail;
298 nirq++; 300 nirq++;
299 irq = irq->next; 301 irq = irq->next;
300 } 302 }
301 while (dma) { 303 while (dma) {
302 pnp_assign_dma(dev, dma, ndma); 304 if (pnp_assign_dma(dev, dma, ndma) < 0)
305 goto fail;
303 ndma++; 306 ndma++;
304 dma = dma->next; 307 dma = dma->next;
305 } 308 }