diff options
author | Joe Perches <joe@perches.com> | 2011-06-09 12:13:32 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-06-10 08:55:36 -0400 |
commit | 28f65c11f2ffb3957259dece647a24f8ad2e241b (patch) | |
tree | 6b7621d09d10df89eedd908d4506fb9f457a909f /drivers/pnp | |
parent | 140a1ef2f91a00e1d25f0878c193abdc25bf6ebe (diff) |
treewide: Convert uses of struct resource to resource_size(ptr)
Several fixes as well where the +1 was missing.
Done via coccinelle scripts like:
@@
struct resource *ptr;
@@
- ptr->end - ptr->start + 1
+ resource_size(ptr)
and some grep and typing.
Mostly uncompiled, no cross-compilers.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/pnp')
-rw-r--r-- | drivers/pnp/pnpacpi/rsparser.c | 10 | ||||
-rw-r--r-- | drivers/pnp/pnpbios/rsparser.c | 12 |
2 files changed, 11 insertions, 11 deletions
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 100e4d9372f1..1a6937d9118f 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -1018,7 +1018,7 @@ static void pnpacpi_encode_io(struct pnp_dev *dev, | |||
1018 | io->minimum = p->start; | 1018 | io->minimum = p->start; |
1019 | io->maximum = p->end; | 1019 | io->maximum = p->end; |
1020 | io->alignment = 0; /* Correct? */ | 1020 | io->alignment = 0; /* Correct? */ |
1021 | io->address_length = p->end - p->start + 1; | 1021 | io->address_length = resource_size(p); |
1022 | } else { | 1022 | } else { |
1023 | io->minimum = 0; | 1023 | io->minimum = 0; |
1024 | io->address_length = 0; | 1024 | io->address_length = 0; |
@@ -1036,7 +1036,7 @@ static void pnpacpi_encode_fixed_io(struct pnp_dev *dev, | |||
1036 | 1036 | ||
1037 | if (pnp_resource_enabled(p)) { | 1037 | if (pnp_resource_enabled(p)) { |
1038 | fixed_io->address = p->start; | 1038 | fixed_io->address = p->start; |
1039 | fixed_io->address_length = p->end - p->start + 1; | 1039 | fixed_io->address_length = resource_size(p); |
1040 | } else { | 1040 | } else { |
1041 | fixed_io->address = 0; | 1041 | fixed_io->address = 0; |
1042 | fixed_io->address_length = 0; | 1042 | fixed_io->address_length = 0; |
@@ -1059,7 +1059,7 @@ static void pnpacpi_encode_mem24(struct pnp_dev *dev, | |||
1059 | memory24->minimum = p->start; | 1059 | memory24->minimum = p->start; |
1060 | memory24->maximum = p->end; | 1060 | memory24->maximum = p->end; |
1061 | memory24->alignment = 0; | 1061 | memory24->alignment = 0; |
1062 | memory24->address_length = p->end - p->start + 1; | 1062 | memory24->address_length = resource_size(p); |
1063 | } else { | 1063 | } else { |
1064 | memory24->minimum = 0; | 1064 | memory24->minimum = 0; |
1065 | memory24->address_length = 0; | 1065 | memory24->address_length = 0; |
@@ -1083,7 +1083,7 @@ static void pnpacpi_encode_mem32(struct pnp_dev *dev, | |||
1083 | memory32->minimum = p->start; | 1083 | memory32->minimum = p->start; |
1084 | memory32->maximum = p->end; | 1084 | memory32->maximum = p->end; |
1085 | memory32->alignment = 0; | 1085 | memory32->alignment = 0; |
1086 | memory32->address_length = p->end - p->start + 1; | 1086 | memory32->address_length = resource_size(p); |
1087 | } else { | 1087 | } else { |
1088 | memory32->minimum = 0; | 1088 | memory32->minimum = 0; |
1089 | memory32->alignment = 0; | 1089 | memory32->alignment = 0; |
@@ -1106,7 +1106,7 @@ static void pnpacpi_encode_fixed_mem32(struct pnp_dev *dev, | |||
1106 | p->flags & IORESOURCE_MEM_WRITEABLE ? | 1106 | p->flags & IORESOURCE_MEM_WRITEABLE ? |
1107 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; | 1107 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; |
1108 | fixed_memory32->address = p->start; | 1108 | fixed_memory32->address = p->start; |
1109 | fixed_memory32->address_length = p->end - p->start + 1; | 1109 | fixed_memory32->address_length = resource_size(p); |
1110 | } else { | 1110 | } else { |
1111 | fixed_memory32->address = 0; | 1111 | fixed_memory32->address = 0; |
1112 | fixed_memory32->address_length = 0; | 1112 | fixed_memory32->address_length = 0; |
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c index cb1f47bfee96..cca2f9f9f3e3 100644 --- a/drivers/pnp/pnpbios/rsparser.c +++ b/drivers/pnp/pnpbios/rsparser.c | |||
@@ -505,7 +505,7 @@ static void pnpbios_encode_mem(struct pnp_dev *dev, unsigned char *p, | |||
505 | 505 | ||
506 | if (pnp_resource_enabled(res)) { | 506 | if (pnp_resource_enabled(res)) { |
507 | base = res->start; | 507 | base = res->start; |
508 | len = res->end - res->start + 1; | 508 | len = resource_size(res); |
509 | } else { | 509 | } else { |
510 | base = 0; | 510 | base = 0; |
511 | len = 0; | 511 | len = 0; |
@@ -529,7 +529,7 @@ static void pnpbios_encode_mem32(struct pnp_dev *dev, unsigned char *p, | |||
529 | 529 | ||
530 | if (pnp_resource_enabled(res)) { | 530 | if (pnp_resource_enabled(res)) { |
531 | base = res->start; | 531 | base = res->start; |
532 | len = res->end - res->start + 1; | 532 | len = resource_size(res); |
533 | } else { | 533 | } else { |
534 | base = 0; | 534 | base = 0; |
535 | len = 0; | 535 | len = 0; |
@@ -559,7 +559,7 @@ static void pnpbios_encode_fixed_mem32(struct pnp_dev *dev, unsigned char *p, | |||
559 | 559 | ||
560 | if (pnp_resource_enabled(res)) { | 560 | if (pnp_resource_enabled(res)) { |
561 | base = res->start; | 561 | base = res->start; |
562 | len = res->end - res->start + 1; | 562 | len = resource_size(res); |
563 | } else { | 563 | } else { |
564 | base = 0; | 564 | base = 0; |
565 | len = 0; | 565 | len = 0; |
@@ -617,7 +617,7 @@ static void pnpbios_encode_port(struct pnp_dev *dev, unsigned char *p, | |||
617 | 617 | ||
618 | if (pnp_resource_enabled(res)) { | 618 | if (pnp_resource_enabled(res)) { |
619 | base = res->start; | 619 | base = res->start; |
620 | len = res->end - res->start + 1; | 620 | len = resource_size(res); |
621 | } else { | 621 | } else { |
622 | base = 0; | 622 | base = 0; |
623 | len = 0; | 623 | len = 0; |
@@ -636,11 +636,11 @@ static void pnpbios_encode_fixed_port(struct pnp_dev *dev, unsigned char *p, | |||
636 | struct resource *res) | 636 | struct resource *res) |
637 | { | 637 | { |
638 | unsigned long base = res->start; | 638 | unsigned long base = res->start; |
639 | unsigned long len = res->end - res->start + 1; | 639 | unsigned long len = resource_size(res); |
640 | 640 | ||
641 | if (pnp_resource_enabled(res)) { | 641 | if (pnp_resource_enabled(res)) { |
642 | base = res->start; | 642 | base = res->start; |
643 | len = res->end - res->start + 1; | 643 | len = resource_size(res); |
644 | } else { | 644 | } else { |
645 | base = 0; | 645 | base = 0; |
646 | len = 0; | 646 | len = 0; |