aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorHanjun Guo <hanjun.guo@linaro.org>2014-01-16 23:37:02 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-01-27 16:51:44 -0500
commit038d7b593563818c5e9bc61e05c7f5ce1ce8e3ef (patch)
treead794691e171fa262ebbd861a1c0eac0c38dc4af /drivers/acpi
parentb981513f806d26b2cc971eb65ced14bede67558b (diff)
ACPI / processor: Return specific error value when mapping lapic id
Usually, 0 is returned for success in int-returning functions and negative value are returned on failure, but in processor_core.c, some function return 1 for success and 0 for failure which causes confusion to happen sometimes, so modify the functions in question to follow the common convention.. Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> [rjw: Changelog] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/processor_core.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index b3171f30b319..24c87efbc1cf 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -45,13 +45,13 @@ static int map_lapic_id(struct acpi_subtable_header *entry,
45 (struct acpi_madt_local_apic *)entry; 45 (struct acpi_madt_local_apic *)entry;
46 46
47 if (!(lapic->lapic_flags & ACPI_MADT_ENABLED)) 47 if (!(lapic->lapic_flags & ACPI_MADT_ENABLED))
48 return 0; 48 return -ENODEV;
49 49
50 if (lapic->processor_id != acpi_id) 50 if (lapic->processor_id != acpi_id)
51 return 0; 51 return -EINVAL;
52 52
53 *apic_id = lapic->id; 53 *apic_id = lapic->id;
54 return 1; 54 return 0;
55} 55}
56 56
57static int map_x2apic_id(struct acpi_subtable_header *entry, 57static int map_x2apic_id(struct acpi_subtable_header *entry,
@@ -61,14 +61,14 @@ static int map_x2apic_id(struct acpi_subtable_header *entry,
61 (struct acpi_madt_local_x2apic *)entry; 61 (struct acpi_madt_local_x2apic *)entry;
62 62
63 if (!(apic->lapic_flags & ACPI_MADT_ENABLED)) 63 if (!(apic->lapic_flags & ACPI_MADT_ENABLED))
64 return 0; 64 return -ENODEV;
65 65
66 if (device_declaration && (apic->uid == acpi_id)) { 66 if (device_declaration && (apic->uid == acpi_id)) {
67 *apic_id = apic->local_apic_id; 67 *apic_id = apic->local_apic_id;
68 return 1; 68 return 0;
69 } 69 }
70 70
71 return 0; 71 return -EINVAL;
72} 72}
73 73
74static int map_lsapic_id(struct acpi_subtable_header *entry, 74static int map_lsapic_id(struct acpi_subtable_header *entry,
@@ -78,16 +78,16 @@ static int map_lsapic_id(struct acpi_subtable_header *entry,
78 (struct acpi_madt_local_sapic *)entry; 78 (struct acpi_madt_local_sapic *)entry;
79 79
80 if (!(lsapic->lapic_flags & ACPI_MADT_ENABLED)) 80 if (!(lsapic->lapic_flags & ACPI_MADT_ENABLED))
81 return 0; 81 return -ENODEV;
82 82
83 if (device_declaration) { 83 if (device_declaration) {
84 if ((entry->length < 16) || (lsapic->uid != acpi_id)) 84 if ((entry->length < 16) || (lsapic->uid != acpi_id))
85 return 0; 85 return -EINVAL;
86 } else if (lsapic->processor_id != acpi_id) 86 } else if (lsapic->processor_id != acpi_id)
87 return 0; 87 return -EINVAL;
88 88
89 *apic_id = (lsapic->id << 8) | lsapic->eid; 89 *apic_id = (lsapic->id << 8) | lsapic->eid;
90 return 1; 90 return 0;
91} 91}
92 92
93static int map_madt_entry(int type, u32 acpi_id) 93static int map_madt_entry(int type, u32 acpi_id)
@@ -117,13 +117,13 @@ static int map_madt_entry(int type, u32 acpi_id)
117 struct acpi_subtable_header *header = 117 struct acpi_subtable_header *header =
118 (struct acpi_subtable_header *)entry; 118 (struct acpi_subtable_header *)entry;
119 if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) { 119 if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) {
120 if (map_lapic_id(header, acpi_id, &apic_id)) 120 if (!map_lapic_id(header, acpi_id, &apic_id))
121 break; 121 break;
122 } else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC) { 122 } else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC) {
123 if (map_x2apic_id(header, type, acpi_id, &apic_id)) 123 if (!map_x2apic_id(header, type, acpi_id, &apic_id))
124 break; 124 break;
125 } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { 125 } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) {
126 if (map_lsapic_id(header, type, acpi_id, &apic_id)) 126 if (!map_lsapic_id(header, type, acpi_id, &apic_id))
127 break; 127 break;
128 } 128 }
129 entry += header->length; 129 entry += header->length;