Skip to contentSkip to conversation

zorro: Use helpers from ioport.h

PATCH In review Andy Shevchenko 2 participants 6 messages Aug 31, 2023 – Apr 26, 2024 m68k architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 zorro: Use helpers from ioport.h

We can use the DEFINE_RES_MEM_NAMED() macro and resource_contains() helper instead of reimplementing them in the code. No functional change intended.

---
 drivers/zorro/zorro.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/zorro/zorro.c +4 -10
index 1b9928648583..7d29586c7db5 100644
@@ -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))
Signature · 1 line
2.40.0.1.gaa8946217a0b
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi Andy,

Quoted 4 lines · Andy Shevchenko

We can use the DEFINE_RES_MEM_NAMED() macro and resource_contains() helper instead of reimplementing them in the code. No functional change intended.

Thanks for your patch!

drivers/zorro/zorro.c static struct resource __init *zorro_find_parent_resource( · line 120

Quoted 12 lines
drivers/zorro/zorro.c +1 -5
@@ -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)

Missing closing parenthesis. What happened to your cross-compiler?

i.e. will queue in the m68k for-v6.7 branch, with the above fixed.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#2 lore raw
Quoted 26 lines · Geert Uytterhoeven

Hi Andy,

Quoted 4 lines · Andy Shevchenko

We can use the DEFINE_RES_MEM_NAMED() macro and resource_contains() helper instead of reimplementing them in the code. No functional change intended.

Thanks for your patch!

drivers/zorro/zorro.c static struct resource __init *zorro_find_parent_resource( · line 120

Quoted 12 lines
drivers/zorro/zorro.c +1 -5
@@ -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)

Missing closing parenthesis. What happened to your cross-compiler?

Quoted 2 lines

i.e. will queue in the m68k for-v6.7 branch, with the above fixed.

I have usually three problems with it:
1) wrong branch to test;
2) no proper config is enabled;
3) other things due to my stupidity.

Choose one for this on your taste :-)

AFAIU you fixed that locally and applied (or going to). Thank you! Otherwise tell me if I need to resend.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
In reply to Geert Uytterhoeven
Quoted 24 lines · Geert Uytterhoeven
Quoted 4 lines · Andy Shevchenko

We can use the DEFINE_RES_MEM_NAMED() macro and resource_contains() helper instead of reimplementing them in the code. No functional change intended.

Thanks for your patch!

drivers/zorro/zorro.c static struct resource __init *zorro_find_parent_resource( · line 120

Quoted 12 lines
drivers/zorro/zorro.c +1 -5
@@ -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)

Missing closing parenthesis. What happened to your cross-compiler?

Quoted 2 lines

i.e. will queue in the m68k for-v6.7 branch, with the above fixed.

Seems never got queued, should I send a v2 with the above fixed?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw

Hi Andy,

Quoted 25 lines · Andy Shevchenko
Quoted 24 lines · Geert Uytterhoeven
Quoted 4 lines · Andy Shevchenko

We can use the DEFINE_RES_MEM_NAMED() macro and resource_contains() helper instead of reimplementing them in the code. No functional change intended.

Thanks for your patch!

drivers/zorro/zorro.c static struct resource __init *zorro_find_parent_resource( · line 120

Quoted 12 lines
drivers/zorro/zorro.c +1 -5
@@ -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)

Missing closing parenthesis. What happened to your cross-compiler?

Quoted 4 lines
Quoted 2 lines

i.e. will queue in the m68k for-v6.7 branch, with the above fixed.

Seems never got queued, should I send a v2 with the above fixed?

Oops, will queue in the m68k tree for v6.10.
No need to resend, I still have a fixed copy in my local tree.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#5 lore raw
Quoted 5 lines · Geert Uytterhoeven
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Geert Uytterhoeven

On Thu, Aug 31, 2023 at 2:16 PM Andy Shevchenko
<[email protected]> wrote:

...

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

i.e. will queue in the m68k for-v6.7 branch, with the above fixed.

Seems never got queued, should I send a v2 with the above fixed?

Oops, will queue in the m68k tree for v6.10.
No need to resend, I still have a fixed copy in my local tree.

Thank you!

It's far from (my personal experience) the record of the time from publishing in the mailing list and getting it in upstream, so we are all fine :-)

Signature · 2 lines
With Best Regards,
Andy Shevchenko