]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/pnp/interface.c
ntfs: le*_add_cpu conversion
[linux-2.6-omap-h63xx.git] / drivers / pnp / interface.c
index 00c8a970a97e909e94c740cec8b4cb0b1666ab46..5695a79f3a5262fe3701752a41cce19b43fff937 100644 (file)
@@ -321,10 +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;
+       resource_size_t start, end;
 
        if (dev->status & PNP_ATTACHED) {
                retval = -EBUSY;
@@ -382,48 +381,40 @@ 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)) {
@@ -433,7 +424,7 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
                                start = simple_strtoul(buf, &buf, 0);
                                pnp_res = pnp_add_irq_resource(dev, start, 0);
                                if (pnp_res)
-                                       nirq++;
+                                       pnp_res->index = nirq++;
                                continue;
                        }
                        if (!strnicmp(buf, "dma", 3)) {