zorro: Use helpers from ioport.h
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 31 Aug 2023 12:16:23 +0000 (15:16 +0300)
committerGeert Uytterhoeven <geert@linux-m68k.org>
Mon, 29 Apr 2024 14:45:53 +0000 (16:45 +0200)
We can use the DEFINE_RES_MEM_NAMED() macro and resource_contains()
helper instead of reimplementing them in the code. No functional change
intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/r/20230831121623.36293-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
drivers/zorro/zorro.c

index 1b9928648583193ca279fa033177be2c40d2d771..2196474ce6ef52d538b652b7f4a3a4df19c9ba27 100644 (file)
@@ -117,17 +117,13 @@ static struct resource __init *zorro_find_parent_resource(
        int i;
 
        for (i = 0; i < bridge->num_resources; i++) {
-               struct resource *r = &bridge->resource[i];
-
-               if (zorro_resource_start(z) >= r->start &&
-                   zorro_resource_end(z) <= r->end)
-                       return r;
+               if (resource_contains(&bridge->resource[i], &z->resource))
+                       return &bridge->resource[i];
        }
+
        return &iomem_resource;
 }
 
-
-
 static int __init amiga_zorro_probe(struct platform_device *pdev)
 {
        struct zorro_bus *bus;
@@ -176,9 +172,7 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
                z->slotsize = zi->slotsize;
                sprintf(z->name, "Zorro device %08x", z->id);
                zorro_name_device(z);
-               z->resource.start = zi->boardaddr;
-               z->resource.end = zi->boardaddr + zi->boardsize - 1;
-               z->resource.name = z->name;
+               z->resource = DEFINE_RES_MEM_NAMED(zi->boardaddr, zi->boardsize, z->name);
                r = zorro_find_parent_resource(pdev, z);
                error = request_resource(r, &z->resource);
                if (error && !(z->rom.er_Type & ERTF_MEMLIST))