]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/pnp/interface.c
[MIPS] cevt-txx9: Reset timer counter on initialization
[linux-2.6-omap-h63xx.git] / drivers / pnp / interface.c
index ead151242a643c45d65dff9f87e4bae741aac085..5695a79f3a5262fe3701752a41cce19b43fff937 100644 (file)
@@ -321,9 +321,9 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
 {
        struct pnp_dev *dev = to_pnp_dev(dmdev);
        struct pnp_resource *pnp_res;
-       struct resource *res;
        char *buf = (void *)ubuf;
        int retval = 0;
+       resource_size_t start, end;
 
        if (dev->status & PNP_ATTACHED) {
                retval = -EBUSY;
@@ -381,80 +381,60 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
                                buf += 2;
                                while (isspace(*buf))
                                        ++buf;
-                               pnp_res = pnp_get_pnp_resource(dev,
-                                               IORESOURCE_IO, nport);
-                               if (!pnp_res)
-                                       break;
-                               pnp_res->index = nport;
-                               res = &pnp_res->res;
-                               res->start = simple_strtoul(buf, &buf, 0);
+                               start = simple_strtoul(buf, &buf, 0);
                                while (isspace(*buf))
                                        ++buf;
                                if (*buf == '-') {
                                        buf += 1;
                                        while (isspace(*buf))
                                                ++buf;
-                                       res->end = simple_strtoul(buf, &buf, 0);
+                                       end = simple_strtoul(buf, &buf, 0);
                                } else
-                                       res->end = res->start;
-                               res->flags = IORESOURCE_IO;
-                               nport++;
+                                       end = start;
+                               pnp_res = pnp_add_io_resource(dev, start, end,
+                                                             0);
+                               if (pnp_res)
+                                       pnp_res->index = nport++;
                                continue;
                        }
                        if (!strnicmp(buf, "mem", 3)) {
                                buf += 3;
                                while (isspace(*buf))
                                        ++buf;
-                               pnp_res = pnp_get_pnp_resource(dev,
-                                               IORESOURCE_MEM, nmem);
-                               if (!pnp_res)
-                                       break;
-                               pnp_res->index = nmem;
-                               res = &pnp_res->res;
-                               res->start = simple_strtoul(buf, &buf, 0);
+                               start = simple_strtoul(buf, &buf, 0);
                                while (isspace(*buf))
                                        ++buf;
                                if (*buf == '-') {
                                        buf += 1;
                                        while (isspace(*buf))
                                                ++buf;
-                                       res->end = simple_strtoul(buf, &buf, 0);
+                                       end = simple_strtoul(buf, &buf, 0);
                                } else
-                                       res->end = res->start;
-                               res->flags = IORESOURCE_MEM;
-                               nmem++;
+                                       end = start;
+                               pnp_res = pnp_add_mem_resource(dev, start, end,
+                                                              0);
+                               if (pnp_res)
+                                       pnp_res->index = nmem++;
                                continue;
                        }
                        if (!strnicmp(buf, "irq", 3)) {
                                buf += 3;
                                while (isspace(*buf))
                                        ++buf;
-                               pnp_res = pnp_get_pnp_resource(dev,
-                                               IORESOURCE_IRQ, nirq);
-                               if (!pnp_res)
-                                       break;
-                               pnp_res->index = nirq;
-                               res = &pnp_res->res;
-                               res->start = res->end =
-                                   simple_strtoul(buf, &buf, 0);
-                               res->flags = IORESOURCE_IRQ;
-                               nirq++;
+                               start = simple_strtoul(buf, &buf, 0);
+                               pnp_res = pnp_add_irq_resource(dev, start, 0);
+                               if (pnp_res)
+                                       pnp_res->index = nirq++;
                                continue;
                        }
                        if (!strnicmp(buf, "dma", 3)) {
                                buf += 3;
                                while (isspace(*buf))
                                        ++buf;
-                               pnp_res = pnp_get_pnp_resource(dev,
-                                               IORESOURCE_DMA, ndma);
-                               if (!pnp_res)
-                                       break;
-                               pnp_res->index = ndma;
-                               res = &pnp_res->res;
-                               res->start = res->end =
-                                   simple_strtoul(buf, &buf, 0);
-                               res->flags = IORESOURCE_DMA;
-                               ndma++;
+                               start = simple_strtoul(buf, &buf, 0);
+                               pnp_res = pnp_add_dma_resource(dev, start, 0);
+                               if (pnp_res)
+                                       pnp_res->index = ndma++;
                                continue;
                        }
                        break;