diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pnp/manager.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c index ea3eac2404ca..5e43c4719099 100644 --- a/drivers/pnp/manager.c +++ b/drivers/pnp/manager.c | |||
@@ -161,7 +161,7 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx) | |||
161 | return 0; | 161 | return 0; |
162 | } | 162 | } |
163 | 163 | ||
164 | static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx) | 164 | static void pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx) |
165 | { | 165 | { |
166 | resource_size_t *start, *end; | 166 | resource_size_t *start, *end; |
167 | unsigned long *flags; | 167 | unsigned long *flags; |
@@ -173,15 +173,14 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx) | |||
173 | }; | 173 | }; |
174 | 174 | ||
175 | if (idx >= PNP_MAX_DMA) { | 175 | if (idx >= PNP_MAX_DMA) { |
176 | pnp_err | 176 | pnp_err("More than 2 dmas is incompatible with pnp " |
177 | ("More than 2 dmas is incompatible with pnp specifications."); | 177 | "specifications."); |
178 | /* pretend we were successful so at least the manager won't try again */ | 178 | return; |
179 | return 1; | ||
180 | } | 179 | } |
181 | 180 | ||
182 | /* check if this resource has been manually set, if so skip */ | 181 | /* check if this resource has been manually set, if so skip */ |
183 | if (!(dev->res.dma_resource[idx].flags & IORESOURCE_AUTO)) | 182 | if (!(dev->res.dma_resource[idx].flags & IORESOURCE_AUTO)) |
184 | return 1; | 183 | return; |
185 | 184 | ||
186 | start = &dev->res.dma_resource[idx].start; | 185 | start = &dev->res.dma_resource[idx].start; |
187 | end = &dev->res.dma_resource[idx].end; | 186 | end = &dev->res.dma_resource[idx].end; |
@@ -191,19 +190,17 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx) | |||
191 | *flags |= rule->flags | IORESOURCE_DMA; | 190 | *flags |= rule->flags | IORESOURCE_DMA; |
192 | *flags &= ~IORESOURCE_UNSET; | 191 | *flags &= ~IORESOURCE_UNSET; |
193 | 192 | ||
194 | if (!rule->map) { | ||
195 | *flags |= IORESOURCE_DISABLED; | ||
196 | return 1; /* skip disabled resource requests */ | ||
197 | } | ||
198 | |||
199 | for (i = 0; i < 8; i++) { | 193 | for (i = 0; i < 8; i++) { |
200 | if (rule->map & (1 << xtab[i])) { | 194 | if (rule->map & (1 << xtab[i])) { |
201 | *start = *end = xtab[i]; | 195 | *start = *end = xtab[i]; |
202 | if (pnp_check_dma(dev, idx)) | 196 | if (pnp_check_dma(dev, idx)) |
203 | return 1; | 197 | return; |
204 | } | 198 | } |
205 | } | 199 | } |
206 | return 0; | 200 | #ifdef MAX_DMA_CHANNELS |
201 | *start = *end = MAX_DMA_CHANNELS; | ||
202 | #endif | ||
203 | *flags |= IORESOURCE_UNSET | IORESOURCE_DISABLED; | ||
207 | } | 204 | } |
208 | 205 | ||
209 | /** | 206 | /** |
@@ -330,8 +327,7 @@ static int pnp_assign_resources(struct pnp_dev *dev, int depnum) | |||
330 | irq = irq->next; | 327 | irq = irq->next; |
331 | } | 328 | } |
332 | while (dma) { | 329 | while (dma) { |
333 | if (!pnp_assign_dma(dev, dma, ndma)) | 330 | pnp_assign_dma(dev, dma, ndma); |
334 | goto fail; | ||
335 | ndma++; | 331 | ndma++; |
336 | dma = dma->next; | 332 | dma = dma->next; |
337 | } | 333 | } |
@@ -367,8 +363,7 @@ static int pnp_assign_resources(struct pnp_dev *dev, int depnum) | |||
367 | irq = irq->next; | 363 | irq = irq->next; |
368 | } | 364 | } |
369 | while (dma) { | 365 | while (dma) { |
370 | if (!pnp_assign_dma(dev, dma, ndma)) | 366 | pnp_assign_dma(dev, dma, ndma); |
371 | goto fail; | ||
372 | ndma++; | 367 | ndma++; |
373 | dma = dma->next; | 368 | dma = dma->next; |
374 | } | 369 | } |