diff options
author | Len Brown <len.brown@intel.com> | 2005-08-05 00:44:28 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-08-05 00:45:14 -0400 |
commit | 4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch) | |
tree | 5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/pci_link.c | |
parent | c65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff) |
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/pci_link.c')
-rw-r--r-- | drivers/acpi/pci_link.c | 477 |
1 files changed, 238 insertions, 239 deletions
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index e8334ce84d84..82292b77e5c6 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
@@ -42,30 +42,26 @@ | |||
42 | #include <acpi/acpi_bus.h> | 42 | #include <acpi/acpi_bus.h> |
43 | #include <acpi/acpi_drivers.h> | 43 | #include <acpi/acpi_drivers.h> |
44 | 44 | ||
45 | |||
46 | #define _COMPONENT ACPI_PCI_COMPONENT | 45 | #define _COMPONENT ACPI_PCI_COMPONENT |
47 | ACPI_MODULE_NAME ("pci_link") | 46 | ACPI_MODULE_NAME("pci_link") |
48 | |||
49 | #define ACPI_PCI_LINK_CLASS "pci_irq_routing" | 47 | #define ACPI_PCI_LINK_CLASS "pci_irq_routing" |
50 | #define ACPI_PCI_LINK_HID "PNP0C0F" | 48 | #define ACPI_PCI_LINK_HID "PNP0C0F" |
51 | #define ACPI_PCI_LINK_DRIVER_NAME "ACPI PCI Interrupt Link Driver" | 49 | #define ACPI_PCI_LINK_DRIVER_NAME "ACPI PCI Interrupt Link Driver" |
52 | #define ACPI_PCI_LINK_DEVICE_NAME "PCI Interrupt Link" | 50 | #define ACPI_PCI_LINK_DEVICE_NAME "PCI Interrupt Link" |
53 | #define ACPI_PCI_LINK_FILE_INFO "info" | 51 | #define ACPI_PCI_LINK_FILE_INFO "info" |
54 | #define ACPI_PCI_LINK_FILE_STATUS "state" | 52 | #define ACPI_PCI_LINK_FILE_STATUS "state" |
55 | |||
56 | #define ACPI_PCI_LINK_MAX_POSSIBLE 16 | 53 | #define ACPI_PCI_LINK_MAX_POSSIBLE 16 |
57 | 54 | static int acpi_pci_link_add(struct acpi_device *device); | |
58 | static int acpi_pci_link_add (struct acpi_device *device); | 55 | static int acpi_pci_link_remove(struct acpi_device *device, int type); |
59 | static int acpi_pci_link_remove (struct acpi_device *device, int type); | ||
60 | 56 | ||
61 | static struct acpi_driver acpi_pci_link_driver = { | 57 | static struct acpi_driver acpi_pci_link_driver = { |
62 | .name = ACPI_PCI_LINK_DRIVER_NAME, | 58 | .name = ACPI_PCI_LINK_DRIVER_NAME, |
63 | .class = ACPI_PCI_LINK_CLASS, | 59 | .class = ACPI_PCI_LINK_CLASS, |
64 | .ids = ACPI_PCI_LINK_HID, | 60 | .ids = ACPI_PCI_LINK_HID, |
65 | .ops = { | 61 | .ops = { |
66 | .add = acpi_pci_link_add, | 62 | .add = acpi_pci_link_add, |
67 | .remove = acpi_pci_link_remove, | 63 | .remove = acpi_pci_link_remove, |
68 | }, | 64 | }, |
69 | }; | 65 | }; |
70 | 66 | ||
71 | /* | 67 | /* |
@@ -73,31 +69,30 @@ static struct acpi_driver acpi_pci_link_driver = { | |||
73 | * later even the link is disable. Instead, we just repick the active irq | 69 | * later even the link is disable. Instead, we just repick the active irq |
74 | */ | 70 | */ |
75 | struct acpi_pci_link_irq { | 71 | struct acpi_pci_link_irq { |
76 | u8 active; /* Current IRQ */ | 72 | u8 active; /* Current IRQ */ |
77 | u8 edge_level; /* All IRQs */ | 73 | u8 edge_level; /* All IRQs */ |
78 | u8 active_high_low; /* All IRQs */ | 74 | u8 active_high_low; /* All IRQs */ |
79 | u8 resource_type; | 75 | u8 resource_type; |
80 | u8 possible_count; | 76 | u8 possible_count; |
81 | u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; | 77 | u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; |
82 | u8 initialized:1; | 78 | u8 initialized:1; |
83 | u8 reserved:7; | 79 | u8 reserved:7; |
84 | }; | 80 | }; |
85 | 81 | ||
86 | struct acpi_pci_link { | 82 | struct acpi_pci_link { |
87 | struct list_head node; | 83 | struct list_head node; |
88 | struct acpi_device *device; | 84 | struct acpi_device *device; |
89 | acpi_handle handle; | 85 | acpi_handle handle; |
90 | struct acpi_pci_link_irq irq; | 86 | struct acpi_pci_link_irq irq; |
91 | int refcnt; | 87 | int refcnt; |
92 | }; | 88 | }; |
93 | 89 | ||
94 | static struct { | 90 | static struct { |
95 | int count; | 91 | int count; |
96 | struct list_head entries; | 92 | struct list_head entries; |
97 | } acpi_link; | 93 | } acpi_link; |
98 | DECLARE_MUTEX(acpi_link_lock); | 94 | DECLARE_MUTEX(acpi_link_lock); |
99 | 95 | ||
100 | |||
101 | /* -------------------------------------------------------------------------- | 96 | /* -------------------------------------------------------------------------- |
102 | PCI Link Device Management | 97 | PCI Link Device Management |
103 | -------------------------------------------------------------------------- */ | 98 | -------------------------------------------------------------------------- */ |
@@ -106,12 +101,10 @@ DECLARE_MUTEX(acpi_link_lock); | |||
106 | * set context (link) possible list from resource list | 101 | * set context (link) possible list from resource list |
107 | */ | 102 | */ |
108 | static acpi_status | 103 | static acpi_status |
109 | acpi_pci_link_check_possible ( | 104 | acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) |
110 | struct acpi_resource *resource, | ||
111 | void *context) | ||
112 | { | 105 | { |
113 | struct acpi_pci_link *link = (struct acpi_pci_link *) context; | 106 | struct acpi_pci_link *link = (struct acpi_pci_link *)context; |
114 | u32 i = 0; | 107 | u32 i = 0; |
115 | 108 | ||
116 | ACPI_FUNCTION_TRACE("acpi_pci_link_check_possible"); | 109 | ACPI_FUNCTION_TRACE("acpi_pci_link_check_possible"); |
117 | 110 | ||
@@ -119,61 +112,68 @@ acpi_pci_link_check_possible ( | |||
119 | case ACPI_RSTYPE_START_DPF: | 112 | case ACPI_RSTYPE_START_DPF: |
120 | return_ACPI_STATUS(AE_OK); | 113 | return_ACPI_STATUS(AE_OK); |
121 | case ACPI_RSTYPE_IRQ: | 114 | case ACPI_RSTYPE_IRQ: |
122 | { | 115 | { |
123 | struct acpi_resource_irq *p = &resource->data.irq; | 116 | struct acpi_resource_irq *p = &resource->data.irq; |
124 | if (!p || !p->number_of_interrupts) { | 117 | if (!p || !p->number_of_interrupts) { |
125 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Blank IRQ resource\n")); | 118 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, |
126 | return_ACPI_STATUS(AE_OK); | 119 | "Blank IRQ resource\n")); |
127 | } | 120 | return_ACPI_STATUS(AE_OK); |
128 | for (i = 0; (i<p->number_of_interrupts && i<ACPI_PCI_LINK_MAX_POSSIBLE); i++) { | ||
129 | if (!p->interrupts[i]) { | ||
130 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ %d\n", p->interrupts[i])); | ||
131 | continue; | ||
132 | } | 121 | } |
133 | link->irq.possible[i] = p->interrupts[i]; | 122 | for (i = 0; |
134 | link->irq.possible_count++; | 123 | (i < p->number_of_interrupts |
124 | && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { | ||
125 | if (!p->interrupts[i]) { | ||
126 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | ||
127 | "Invalid IRQ %d\n", | ||
128 | p->interrupts[i])); | ||
129 | continue; | ||
130 | } | ||
131 | link->irq.possible[i] = p->interrupts[i]; | ||
132 | link->irq.possible_count++; | ||
133 | } | ||
134 | link->irq.edge_level = p->edge_level; | ||
135 | link->irq.active_high_low = p->active_high_low; | ||
136 | link->irq.resource_type = ACPI_RSTYPE_IRQ; | ||
137 | break; | ||
135 | } | 138 | } |
136 | link->irq.edge_level = p->edge_level; | ||
137 | link->irq.active_high_low = p->active_high_low; | ||
138 | link->irq.resource_type = ACPI_RSTYPE_IRQ; | ||
139 | break; | ||
140 | } | ||
141 | case ACPI_RSTYPE_EXT_IRQ: | 139 | case ACPI_RSTYPE_EXT_IRQ: |
142 | { | 140 | { |
143 | struct acpi_resource_ext_irq *p = &resource->data.extended_irq; | 141 | struct acpi_resource_ext_irq *p = |
144 | if (!p || !p->number_of_interrupts) { | 142 | &resource->data.extended_irq; |
145 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | 143 | if (!p || !p->number_of_interrupts) { |
146 | "Blank EXT IRQ resource\n")); | 144 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, |
147 | return_ACPI_STATUS(AE_OK); | 145 | "Blank EXT IRQ resource\n")); |
148 | } | 146 | return_ACPI_STATUS(AE_OK); |
149 | for (i = 0; (i<p->number_of_interrupts && i<ACPI_PCI_LINK_MAX_POSSIBLE); i++) { | 147 | } |
150 | if (!p->interrupts[i]) { | 148 | for (i = 0; |
151 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ %d\n", p->interrupts[i])); | 149 | (i < p->number_of_interrupts |
152 | continue; | 150 | && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { |
151 | if (!p->interrupts[i]) { | ||
152 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | ||
153 | "Invalid IRQ %d\n", | ||
154 | p->interrupts[i])); | ||
155 | continue; | ||
156 | } | ||
157 | link->irq.possible[i] = p->interrupts[i]; | ||
158 | link->irq.possible_count++; | ||
153 | } | 159 | } |
154 | link->irq.possible[i] = p->interrupts[i]; | 160 | link->irq.edge_level = p->edge_level; |
155 | link->irq.possible_count++; | 161 | link->irq.active_high_low = p->active_high_low; |
162 | link->irq.resource_type = ACPI_RSTYPE_EXT_IRQ; | ||
163 | break; | ||
156 | } | 164 | } |
157 | link->irq.edge_level = p->edge_level; | ||
158 | link->irq.active_high_low = p->active_high_low; | ||
159 | link->irq.resource_type = ACPI_RSTYPE_EXT_IRQ; | ||
160 | break; | ||
161 | } | ||
162 | default: | 165 | default: |
163 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 166 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
164 | "Resource is not an IRQ entry\n")); | 167 | "Resource is not an IRQ entry\n")); |
165 | return_ACPI_STATUS(AE_OK); | 168 | return_ACPI_STATUS(AE_OK); |
166 | } | 169 | } |
167 | 170 | ||
168 | return_ACPI_STATUS(AE_CTRL_TERMINATE); | 171 | return_ACPI_STATUS(AE_CTRL_TERMINATE); |
169 | } | 172 | } |
170 | 173 | ||
171 | 174 | static int acpi_pci_link_get_possible(struct acpi_pci_link *link) | |
172 | static int | ||
173 | acpi_pci_link_get_possible ( | ||
174 | struct acpi_pci_link *link) | ||
175 | { | 175 | { |
176 | acpi_status status; | 176 | acpi_status status; |
177 | 177 | ||
178 | ACPI_FUNCTION_TRACE("acpi_pci_link_get_possible"); | 178 | ACPI_FUNCTION_TRACE("acpi_pci_link_get_possible"); |
179 | 179 | ||
@@ -181,62 +181,60 @@ acpi_pci_link_get_possible ( | |||
181 | return_VALUE(-EINVAL); | 181 | return_VALUE(-EINVAL); |
182 | 182 | ||
183 | status = acpi_walk_resources(link->handle, METHOD_NAME__PRS, | 183 | status = acpi_walk_resources(link->handle, METHOD_NAME__PRS, |
184 | acpi_pci_link_check_possible, link); | 184 | acpi_pci_link_check_possible, link); |
185 | if (ACPI_FAILURE(status)) { | 185 | if (ACPI_FAILURE(status)) { |
186 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRS\n")); | 186 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRS\n")); |
187 | return_VALUE(-ENODEV); | 187 | return_VALUE(-ENODEV); |
188 | } | 188 | } |
189 | 189 | ||
190 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 190 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
191 | "Found %d possible IRQs\n", link->irq.possible_count)); | 191 | "Found %d possible IRQs\n", |
192 | link->irq.possible_count)); | ||
192 | 193 | ||
193 | return_VALUE(0); | 194 | return_VALUE(0); |
194 | } | 195 | } |
195 | 196 | ||
196 | |||
197 | static acpi_status | 197 | static acpi_status |
198 | acpi_pci_link_check_current ( | 198 | acpi_pci_link_check_current(struct acpi_resource *resource, void *context) |
199 | struct acpi_resource *resource, | ||
200 | void *context) | ||
201 | { | 199 | { |
202 | int *irq = (int *) context; | 200 | int *irq = (int *)context; |
203 | 201 | ||
204 | ACPI_FUNCTION_TRACE("acpi_pci_link_check_current"); | 202 | ACPI_FUNCTION_TRACE("acpi_pci_link_check_current"); |
205 | 203 | ||
206 | switch (resource->id) { | 204 | switch (resource->id) { |
207 | case ACPI_RSTYPE_IRQ: | 205 | case ACPI_RSTYPE_IRQ: |
208 | { | 206 | { |
209 | struct acpi_resource_irq *p = &resource->data.irq; | 207 | struct acpi_resource_irq *p = &resource->data.irq; |
210 | if (!p || !p->number_of_interrupts) { | 208 | if (!p || !p->number_of_interrupts) { |
211 | /* | 209 | /* |
212 | * IRQ descriptors may have no IRQ# bits set, | 210 | * IRQ descriptors may have no IRQ# bits set, |
213 | * particularly those those w/ _STA disabled | 211 | * particularly those those w/ _STA disabled |
214 | */ | 212 | */ |
215 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 213 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
216 | "Blank IRQ resource\n")); | 214 | "Blank IRQ resource\n")); |
217 | return_ACPI_STATUS(AE_OK); | 215 | return_ACPI_STATUS(AE_OK); |
216 | } | ||
217 | *irq = p->interrupts[0]; | ||
218 | break; | ||
218 | } | 219 | } |
219 | *irq = p->interrupts[0]; | ||
220 | break; | ||
221 | } | ||
222 | case ACPI_RSTYPE_EXT_IRQ: | 220 | case ACPI_RSTYPE_EXT_IRQ: |
223 | { | 221 | { |
224 | struct acpi_resource_ext_irq *p = &resource->data.extended_irq; | 222 | struct acpi_resource_ext_irq *p = |
225 | if (!p || !p->number_of_interrupts) { | 223 | &resource->data.extended_irq; |
226 | /* | 224 | if (!p || !p->number_of_interrupts) { |
227 | * extended IRQ descriptors must | 225 | /* |
228 | * return at least 1 IRQ | 226 | * extended IRQ descriptors must |
229 | */ | 227 | * return at least 1 IRQ |
230 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | 228 | */ |
231 | "Blank EXT IRQ resource\n")); | 229 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, |
232 | return_ACPI_STATUS(AE_OK); | 230 | "Blank EXT IRQ resource\n")); |
231 | return_ACPI_STATUS(AE_OK); | ||
232 | } | ||
233 | *irq = p->interrupts[0]; | ||
234 | break; | ||
233 | } | 235 | } |
234 | *irq = p->interrupts[0]; | ||
235 | break; | ||
236 | } | ||
237 | default: | 236 | default: |
238 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 237 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Resource isn't an IRQ\n")); |
239 | "Resource isn't an IRQ\n")); | ||
240 | return_ACPI_STATUS(AE_OK); | 238 | return_ACPI_STATUS(AE_OK); |
241 | } | 239 | } |
242 | return_ACPI_STATUS(AE_CTRL_TERMINATE); | 240 | return_ACPI_STATUS(AE_CTRL_TERMINATE); |
@@ -249,13 +247,11 @@ acpi_pci_link_check_current ( | |||
249 | * 0 - success | 247 | * 0 - success |
250 | * !0 - failure | 248 | * !0 - failure |
251 | */ | 249 | */ |
252 | static int | 250 | static int acpi_pci_link_get_current(struct acpi_pci_link *link) |
253 | acpi_pci_link_get_current ( | ||
254 | struct acpi_pci_link *link) | ||
255 | { | 251 | { |
256 | int result = 0; | 252 | int result = 0; |
257 | acpi_status status = AE_OK; | 253 | acpi_status status = AE_OK; |
258 | int irq = 0; | 254 | int irq = 0; |
259 | 255 | ||
260 | ACPI_FUNCTION_TRACE("acpi_pci_link_get_current"); | 256 | ACPI_FUNCTION_TRACE("acpi_pci_link_get_current"); |
261 | 257 | ||
@@ -269,7 +265,8 @@ acpi_pci_link_get_current ( | |||
269 | /* Query _STA, set link->device->status */ | 265 | /* Query _STA, set link->device->status */ |
270 | result = acpi_bus_get_status(link->device); | 266 | result = acpi_bus_get_status(link->device); |
271 | if (result) { | 267 | if (result) { |
272 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to read status\n")); | 268 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
269 | "Unable to read status\n")); | ||
273 | goto end; | 270 | goto end; |
274 | } | 271 | } |
275 | 272 | ||
@@ -284,7 +281,7 @@ acpi_pci_link_get_current ( | |||
284 | */ | 281 | */ |
285 | 282 | ||
286 | status = acpi_walk_resources(link->handle, METHOD_NAME__CRS, | 283 | status = acpi_walk_resources(link->handle, METHOD_NAME__CRS, |
287 | acpi_pci_link_check_current, &irq); | 284 | acpi_pci_link_check_current, &irq); |
288 | if (ACPI_FAILURE(status)) { | 285 | if (ACPI_FAILURE(status)) { |
289 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _CRS\n")); | 286 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _CRS\n")); |
290 | result = -ENODEV; | 287 | result = -ENODEV; |
@@ -300,58 +297,61 @@ acpi_pci_link_get_current ( | |||
300 | 297 | ||
301 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link at IRQ %d \n", link->irq.active)); | 298 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link at IRQ %d \n", link->irq.active)); |
302 | 299 | ||
303 | end: | 300 | end: |
304 | return_VALUE(result); | 301 | return_VALUE(result); |
305 | } | 302 | } |
306 | 303 | ||
307 | static int | 304 | static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) |
308 | acpi_pci_link_set ( | ||
309 | struct acpi_pci_link *link, | ||
310 | int irq) | ||
311 | { | 305 | { |
312 | int result = 0; | 306 | int result = 0; |
313 | acpi_status status = AE_OK; | 307 | acpi_status status = AE_OK; |
314 | struct { | 308 | struct { |
315 | struct acpi_resource res; | 309 | struct acpi_resource res; |
316 | struct acpi_resource end; | 310 | struct acpi_resource end; |
317 | } *resource; | 311 | } *resource; |
318 | struct acpi_buffer buffer = {0, NULL}; | 312 | struct acpi_buffer buffer = { 0, NULL }; |
319 | 313 | ||
320 | ACPI_FUNCTION_TRACE("acpi_pci_link_set"); | 314 | ACPI_FUNCTION_TRACE("acpi_pci_link_set"); |
321 | 315 | ||
322 | if (!link || !irq) | 316 | if (!link || !irq) |
323 | return_VALUE(-EINVAL); | 317 | return_VALUE(-EINVAL); |
324 | 318 | ||
325 | resource = kmalloc( sizeof(*resource)+1, GFP_KERNEL); | 319 | resource = kmalloc(sizeof(*resource) + 1, GFP_KERNEL); |
326 | if(!resource) | 320 | if (!resource) |
327 | return_VALUE(-ENOMEM); | 321 | return_VALUE(-ENOMEM); |
328 | 322 | ||
329 | memset(resource, 0, sizeof(*resource)+1); | 323 | memset(resource, 0, sizeof(*resource) + 1); |
330 | buffer.length = sizeof(*resource) +1; | 324 | buffer.length = sizeof(*resource) + 1; |
331 | buffer.pointer = resource; | 325 | buffer.pointer = resource; |
332 | 326 | ||
333 | switch(link->irq.resource_type) { | 327 | switch (link->irq.resource_type) { |
334 | case ACPI_RSTYPE_IRQ: | 328 | case ACPI_RSTYPE_IRQ: |
335 | resource->res.id = ACPI_RSTYPE_IRQ; | 329 | resource->res.id = ACPI_RSTYPE_IRQ; |
336 | resource->res.length = sizeof(struct acpi_resource); | 330 | resource->res.length = sizeof(struct acpi_resource); |
337 | resource->res.data.irq.edge_level = link->irq.edge_level; | 331 | resource->res.data.irq.edge_level = link->irq.edge_level; |
338 | resource->res.data.irq.active_high_low = link->irq.active_high_low; | 332 | resource->res.data.irq.active_high_low = |
333 | link->irq.active_high_low; | ||
339 | if (link->irq.edge_level == ACPI_EDGE_SENSITIVE) | 334 | if (link->irq.edge_level == ACPI_EDGE_SENSITIVE) |
340 | resource->res.data.irq.shared_exclusive = ACPI_EXCLUSIVE; | 335 | resource->res.data.irq.shared_exclusive = |
336 | ACPI_EXCLUSIVE; | ||
341 | else | 337 | else |
342 | resource->res.data.irq.shared_exclusive = ACPI_SHARED; | 338 | resource->res.data.irq.shared_exclusive = ACPI_SHARED; |
343 | resource->res.data.irq.number_of_interrupts = 1; | 339 | resource->res.data.irq.number_of_interrupts = 1; |
344 | resource->res.data.irq.interrupts[0] = irq; | 340 | resource->res.data.irq.interrupts[0] = irq; |
345 | break; | 341 | break; |
346 | 342 | ||
347 | case ACPI_RSTYPE_EXT_IRQ: | 343 | case ACPI_RSTYPE_EXT_IRQ: |
348 | resource->res.id = ACPI_RSTYPE_EXT_IRQ; | 344 | resource->res.id = ACPI_RSTYPE_EXT_IRQ; |
349 | resource->res.length = sizeof(struct acpi_resource); | 345 | resource->res.length = sizeof(struct acpi_resource); |
350 | resource->res.data.extended_irq.producer_consumer = ACPI_CONSUMER; | 346 | resource->res.data.extended_irq.producer_consumer = |
351 | resource->res.data.extended_irq.edge_level = link->irq.edge_level; | 347 | ACPI_CONSUMER; |
352 | resource->res.data.extended_irq.active_high_low = link->irq.active_high_low; | 348 | resource->res.data.extended_irq.edge_level = |
349 | link->irq.edge_level; | ||
350 | resource->res.data.extended_irq.active_high_low = | ||
351 | link->irq.active_high_low; | ||
353 | if (link->irq.edge_level == ACPI_EDGE_SENSITIVE) | 352 | if (link->irq.edge_level == ACPI_EDGE_SENSITIVE) |
354 | resource->res.data.irq.shared_exclusive = ACPI_EXCLUSIVE; | 353 | resource->res.data.irq.shared_exclusive = |
354 | ACPI_EXCLUSIVE; | ||
355 | else | 355 | else |
356 | resource->res.data.irq.shared_exclusive = ACPI_SHARED; | 356 | resource->res.data.irq.shared_exclusive = ACPI_SHARED; |
357 | resource->res.data.extended_irq.number_of_interrupts = 1; | 357 | resource->res.data.extended_irq.number_of_interrupts = 1; |
@@ -384,9 +384,9 @@ acpi_pci_link_set ( | |||
384 | } | 384 | } |
385 | if (!link->device->status.enabled) { | 385 | if (!link->device->status.enabled) { |
386 | printk(KERN_WARNING PREFIX | 386 | printk(KERN_WARNING PREFIX |
387 | "%s [%s] disabled and referenced, BIOS bug.\n", | 387 | "%s [%s] disabled and referenced, BIOS bug.\n", |
388 | acpi_device_name(link->device), | 388 | acpi_device_name(link->device), |
389 | acpi_device_bid(link->device)); | 389 | acpi_device_bid(link->device)); |
390 | } | 390 | } |
391 | 391 | ||
392 | /* Query _CRS, set link->irq.active */ | 392 | /* Query _CRS, set link->irq.active */ |
@@ -404,22 +404,20 @@ acpi_pci_link_set ( | |||
404 | * policy: when _CRS doesn't return what we just _SRS | 404 | * policy: when _CRS doesn't return what we just _SRS |
405 | * assume _SRS worked and override _CRS value. | 405 | * assume _SRS worked and override _CRS value. |
406 | */ | 406 | */ |
407 | printk(KERN_WARNING PREFIX | 407 | printk(KERN_WARNING PREFIX |
408 | "%s [%s] BIOS reported IRQ %d, using IRQ %d\n", | 408 | "%s [%s] BIOS reported IRQ %d, using IRQ %d\n", |
409 | acpi_device_name(link->device), | 409 | acpi_device_name(link->device), |
410 | acpi_device_bid(link->device), | 410 | acpi_device_bid(link->device), link->irq.active, irq); |
411 | link->irq.active, irq); | ||
412 | link->irq.active = irq; | 411 | link->irq.active = irq; |
413 | } | 412 | } |
414 | 413 | ||
415 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Set IRQ %d\n", link->irq.active)); | 414 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Set IRQ %d\n", link->irq.active)); |
416 | 415 | ||
417 | end: | 416 | end: |
418 | kfree(resource); | 417 | kfree(resource); |
419 | return_VALUE(result); | 418 | return_VALUE(result); |
420 | } | 419 | } |
421 | 420 | ||
422 | |||
423 | /* -------------------------------------------------------------------------- | 421 | /* -------------------------------------------------------------------------- |
424 | PCI Link IRQ Management | 422 | PCI Link IRQ Management |
425 | -------------------------------------------------------------------------- */ | 423 | -------------------------------------------------------------------------- */ |
@@ -469,8 +467,8 @@ static int acpi_irq_penalty[ACPI_MAX_IRQS] = { | |||
469 | PIRQ_PENALTY_ISA_ALWAYS, /* IRQ0 timer */ | 467 | PIRQ_PENALTY_ISA_ALWAYS, /* IRQ0 timer */ |
470 | PIRQ_PENALTY_ISA_ALWAYS, /* IRQ1 keyboard */ | 468 | PIRQ_PENALTY_ISA_ALWAYS, /* IRQ1 keyboard */ |
471 | PIRQ_PENALTY_ISA_ALWAYS, /* IRQ2 cascade */ | 469 | PIRQ_PENALTY_ISA_ALWAYS, /* IRQ2 cascade */ |
472 | PIRQ_PENALTY_ISA_TYPICAL, /* IRQ3 serial */ | 470 | PIRQ_PENALTY_ISA_TYPICAL, /* IRQ3 serial */ |
473 | PIRQ_PENALTY_ISA_TYPICAL, /* IRQ4 serial */ | 471 | PIRQ_PENALTY_ISA_TYPICAL, /* IRQ4 serial */ |
474 | PIRQ_PENALTY_ISA_TYPICAL, /* IRQ5 sometimes SoundBlaster */ | 472 | PIRQ_PENALTY_ISA_TYPICAL, /* IRQ5 sometimes SoundBlaster */ |
475 | PIRQ_PENALTY_ISA_TYPICAL, /* IRQ6 */ | 473 | PIRQ_PENALTY_ISA_TYPICAL, /* IRQ6 */ |
476 | PIRQ_PENALTY_ISA_TYPICAL, /* IRQ7 parallel, spurious */ | 474 | PIRQ_PENALTY_ISA_TYPICAL, /* IRQ7 parallel, spurious */ |
@@ -482,15 +480,14 @@ static int acpi_irq_penalty[ACPI_MAX_IRQS] = { | |||
482 | PIRQ_PENALTY_ISA_USED, /* IRQ13 fpe, sometimes */ | 480 | PIRQ_PENALTY_ISA_USED, /* IRQ13 fpe, sometimes */ |
483 | PIRQ_PENALTY_ISA_USED, /* IRQ14 ide0 */ | 481 | PIRQ_PENALTY_ISA_USED, /* IRQ14 ide0 */ |
484 | PIRQ_PENALTY_ISA_USED, /* IRQ15 ide1 */ | 482 | PIRQ_PENALTY_ISA_USED, /* IRQ15 ide1 */ |
485 | /* >IRQ15 */ | 483 | /* >IRQ15 */ |
486 | }; | 484 | }; |
487 | 485 | ||
488 | int __init | 486 | int __init acpi_irq_penalty_init(void) |
489 | acpi_irq_penalty_init(void) | ||
490 | { | 487 | { |
491 | struct list_head *node = NULL; | 488 | struct list_head *node = NULL; |
492 | struct acpi_pci_link *link = NULL; | 489 | struct acpi_pci_link *link = NULL; |
493 | int i = 0; | 490 | int i = 0; |
494 | 491 | ||
495 | ACPI_FUNCTION_TRACE("acpi_irq_penalty_init"); | 492 | ACPI_FUNCTION_TRACE("acpi_irq_penalty_init"); |
496 | 493 | ||
@@ -501,7 +498,8 @@ acpi_irq_penalty_init(void) | |||
501 | 498 | ||
502 | link = list_entry(node, struct acpi_pci_link, node); | 499 | link = list_entry(node, struct acpi_pci_link, node); |
503 | if (!link) { | 500 | if (!link) { |
504 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); | 501 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
502 | "Invalid link context\n")); | ||
505 | continue; | 503 | continue; |
506 | } | 504 | } |
507 | 505 | ||
@@ -510,15 +508,20 @@ acpi_irq_penalty_init(void) | |||
510 | * useful for breaking ties. | 508 | * useful for breaking ties. |
511 | */ | 509 | */ |
512 | if (link->irq.possible_count) { | 510 | if (link->irq.possible_count) { |
513 | int penalty = PIRQ_PENALTY_PCI_POSSIBLE / link->irq.possible_count; | 511 | int penalty = |
512 | PIRQ_PENALTY_PCI_POSSIBLE / | ||
513 | link->irq.possible_count; | ||
514 | 514 | ||
515 | for (i = 0; i < link->irq.possible_count; i++) { | 515 | for (i = 0; i < link->irq.possible_count; i++) { |
516 | if (link->irq.possible[i] < ACPI_MAX_ISA_IRQ) | 516 | if (link->irq.possible[i] < ACPI_MAX_ISA_IRQ) |
517 | acpi_irq_penalty[link->irq.possible[i]] += penalty; | 517 | acpi_irq_penalty[link->irq. |
518 | possible[i]] += | ||
519 | penalty; | ||
518 | } | 520 | } |
519 | 521 | ||
520 | } else if (link->irq.active) { | 522 | } else if (link->irq.active) { |
521 | acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_POSSIBLE; | 523 | acpi_irq_penalty[link->irq.active] += |
524 | PIRQ_PENALTY_PCI_POSSIBLE; | ||
522 | } | 525 | } |
523 | } | 526 | } |
524 | /* Add a penalty for the SCI */ | 527 | /* Add a penalty for the SCI */ |
@@ -529,10 +532,10 @@ acpi_irq_penalty_init(void) | |||
529 | 532 | ||
530 | static int acpi_irq_balance; /* 0: static, 1: balance */ | 533 | static int acpi_irq_balance; /* 0: static, 1: balance */ |
531 | 534 | ||
532 | static int acpi_pci_link_allocate(struct acpi_pci_link *link) | 535 | static int acpi_pci_link_allocate(struct acpi_pci_link *link) |
533 | { | 536 | { |
534 | int irq; | 537 | int irq; |
535 | int i; | 538 | int i; |
536 | 539 | ||
537 | ACPI_FUNCTION_TRACE("acpi_pci_link_allocate"); | 540 | ACPI_FUNCTION_TRACE("acpi_pci_link_allocate"); |
538 | 541 | ||
@@ -556,7 +559,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) | |||
556 | if (i == link->irq.possible_count) { | 559 | if (i == link->irq.possible_count) { |
557 | if (acpi_strict) | 560 | if (acpi_strict) |
558 | printk(KERN_WARNING PREFIX "_CRS %d not found" | 561 | printk(KERN_WARNING PREFIX "_CRS %d not found" |
559 | " in _PRS\n", link->irq.active); | 562 | " in _PRS\n", link->irq.active); |
560 | link->irq.active = 0; | 563 | link->irq.active = 0; |
561 | } | 564 | } |
562 | 565 | ||
@@ -575,23 +578,25 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) | |||
575 | * the use of IRQs 9, 10, 11, and >15. | 578 | * the use of IRQs 9, 10, 11, and >15. |
576 | */ | 579 | */ |
577 | for (i = (link->irq.possible_count - 1); i >= 0; i--) { | 580 | for (i = (link->irq.possible_count - 1); i >= 0; i--) { |
578 | if (acpi_irq_penalty[irq] > acpi_irq_penalty[link->irq.possible[i]]) | 581 | if (acpi_irq_penalty[irq] > |
582 | acpi_irq_penalty[link->irq.possible[i]]) | ||
579 | irq = link->irq.possible[i]; | 583 | irq = link->irq.possible[i]; |
580 | } | 584 | } |
581 | } | 585 | } |
582 | 586 | ||
583 | /* Attempt to enable the link device at this IRQ. */ | 587 | /* Attempt to enable the link device at this IRQ. */ |
584 | if (acpi_pci_link_set(link, irq)) { | 588 | if (acpi_pci_link_set(link, irq)) { |
585 | printk(PREFIX "Unable to set IRQ for %s [%s] (likely buggy ACPI BIOS).\n" | 589 | printk(PREFIX |
586 | "Try pci=noacpi or acpi=off\n", | 590 | "Unable to set IRQ for %s [%s] (likely buggy ACPI BIOS).\n" |
587 | acpi_device_name(link->device), | 591 | "Try pci=noacpi or acpi=off\n", |
588 | acpi_device_bid(link->device)); | 592 | acpi_device_name(link->device), |
593 | acpi_device_bid(link->device)); | ||
589 | return_VALUE(-ENODEV); | 594 | return_VALUE(-ENODEV); |
590 | } else { | 595 | } else { |
591 | acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING; | 596 | acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING; |
592 | printk(PREFIX "%s [%s] enabled at IRQ %d\n", | 597 | printk(PREFIX "%s [%s] enabled at IRQ %d\n", |
593 | acpi_device_name(link->device), | 598 | acpi_device_name(link->device), |
594 | acpi_device_bid(link->device), link->irq.active); | 599 | acpi_device_bid(link->device), link->irq.active); |
595 | } | 600 | } |
596 | 601 | ||
597 | link->irq.initialized = 1; | 602 | link->irq.initialized = 1; |
@@ -606,16 +611,13 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) | |||
606 | */ | 611 | */ |
607 | 612 | ||
608 | int | 613 | int |
609 | acpi_pci_link_allocate_irq ( | 614 | acpi_pci_link_allocate_irq(acpi_handle handle, |
610 | acpi_handle handle, | 615 | int index, |
611 | int index, | 616 | int *edge_level, int *active_high_low, char **name) |
612 | int *edge_level, | ||
613 | int *active_high_low, | ||
614 | char **name) | ||
615 | { | 617 | { |
616 | int result = 0; | 618 | int result = 0; |
617 | struct acpi_device *device = NULL; | 619 | struct acpi_device *device = NULL; |
618 | struct acpi_pci_link *link = NULL; | 620 | struct acpi_pci_link *link = NULL; |
619 | 621 | ||
620 | ACPI_FUNCTION_TRACE("acpi_pci_link_allocate_irq"); | 622 | ACPI_FUNCTION_TRACE("acpi_pci_link_allocate_irq"); |
621 | 623 | ||
@@ -625,7 +627,7 @@ acpi_pci_link_allocate_irq ( | |||
625 | return_VALUE(-1); | 627 | return_VALUE(-1); |
626 | } | 628 | } |
627 | 629 | ||
628 | link = (struct acpi_pci_link *) acpi_driver_data(device); | 630 | link = (struct acpi_pci_link *)acpi_driver_data(device); |
629 | if (!link) { | 631 | if (!link) { |
630 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); | 632 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); |
631 | return_VALUE(-1); | 633 | return_VALUE(-1); |
@@ -642,20 +644,24 @@ acpi_pci_link_allocate_irq ( | |||
642 | up(&acpi_link_lock); | 644 | up(&acpi_link_lock); |
643 | return_VALUE(-1); | 645 | return_VALUE(-1); |
644 | } | 646 | } |
645 | 647 | ||
646 | if (!link->irq.active) { | 648 | if (!link->irq.active) { |
647 | up(&acpi_link_lock); | 649 | up(&acpi_link_lock); |
648 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n")); | 650 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n")); |
649 | return_VALUE(-1); | 651 | return_VALUE(-1); |
650 | } | 652 | } |
651 | link->refcnt ++; | 653 | link->refcnt++; |
652 | up(&acpi_link_lock); | 654 | up(&acpi_link_lock); |
653 | 655 | ||
654 | if (edge_level) *edge_level = link->irq.edge_level; | 656 | if (edge_level) |
655 | if (active_high_low) *active_high_low = link->irq.active_high_low; | 657 | *edge_level = link->irq.edge_level; |
656 | if (name) *name = acpi_device_bid(link->device); | 658 | if (active_high_low) |
659 | *active_high_low = link->irq.active_high_low; | ||
660 | if (name) | ||
661 | *name = acpi_device_bid(link->device); | ||
657 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 662 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
658 | "Link %s is referenced\n", acpi_device_bid(link->device))); | 663 | "Link %s is referenced\n", |
664 | acpi_device_bid(link->device))); | ||
659 | return_VALUE(link->irq.active); | 665 | return_VALUE(link->irq.active); |
660 | } | 666 | } |
661 | 667 | ||
@@ -663,12 +669,11 @@ acpi_pci_link_allocate_irq ( | |||
663 | * We don't change link's irq information here. After it is reenabled, we | 669 | * We don't change link's irq information here. After it is reenabled, we |
664 | * continue use the info | 670 | * continue use the info |
665 | */ | 671 | */ |
666 | int | 672 | int acpi_pci_link_free_irq(acpi_handle handle) |
667 | acpi_pci_link_free_irq(acpi_handle handle) | ||
668 | { | 673 | { |
669 | struct acpi_device *device = NULL; | 674 | struct acpi_device *device = NULL; |
670 | struct acpi_pci_link *link = NULL; | 675 | struct acpi_pci_link *link = NULL; |
671 | acpi_status result; | 676 | acpi_status result; |
672 | 677 | ||
673 | ACPI_FUNCTION_TRACE("acpi_pci_link_free_irq"); | 678 | ACPI_FUNCTION_TRACE("acpi_pci_link_free_irq"); |
674 | 679 | ||
@@ -678,7 +683,7 @@ acpi_pci_link_free_irq(acpi_handle handle) | |||
678 | return_VALUE(-1); | 683 | return_VALUE(-1); |
679 | } | 684 | } |
680 | 685 | ||
681 | link = (struct acpi_pci_link *) acpi_driver_data(device); | 686 | link = (struct acpi_pci_link *)acpi_driver_data(device); |
682 | if (!link) { | 687 | if (!link) { |
683 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); | 688 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); |
684 | return_VALUE(-1); | 689 | return_VALUE(-1); |
@@ -690,7 +695,6 @@ acpi_pci_link_free_irq(acpi_handle handle) | |||
690 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link isn't initialized\n")); | 695 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link isn't initialized\n")); |
691 | return_VALUE(-1); | 696 | return_VALUE(-1); |
692 | } | 697 | } |
693 | |||
694 | #ifdef FUTURE_USE | 698 | #ifdef FUTURE_USE |
695 | /* | 699 | /* |
696 | * The Link reference count allows us to _DISable an unused link | 700 | * The Link reference count allows us to _DISable an unused link |
@@ -701,10 +705,11 @@ acpi_pci_link_free_irq(acpi_handle handle) | |||
701 | * to prevent duplicate acpi_pci_link_set() | 705 | * to prevent duplicate acpi_pci_link_set() |
702 | * which would harm some systems | 706 | * which would harm some systems |
703 | */ | 707 | */ |
704 | link->refcnt --; | 708 | link->refcnt--; |
705 | #endif | 709 | #endif |
706 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 710 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
707 | "Link %s is dereferenced\n", acpi_device_bid(link->device))); | 711 | "Link %s is dereferenced\n", |
712 | acpi_device_bid(link->device))); | ||
708 | 713 | ||
709 | if (link->refcnt == 0) { | 714 | if (link->refcnt == 0) { |
710 | acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); | 715 | acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); |
@@ -712,17 +717,17 @@ acpi_pci_link_free_irq(acpi_handle handle) | |||
712 | up(&acpi_link_lock); | 717 | up(&acpi_link_lock); |
713 | return_VALUE(link->irq.active); | 718 | return_VALUE(link->irq.active); |
714 | } | 719 | } |
720 | |||
715 | /* -------------------------------------------------------------------------- | 721 | /* -------------------------------------------------------------------------- |
716 | Driver Interface | 722 | Driver Interface |
717 | -------------------------------------------------------------------------- */ | 723 | -------------------------------------------------------------------------- */ |
718 | 724 | ||
719 | static int | 725 | static int acpi_pci_link_add(struct acpi_device *device) |
720 | acpi_pci_link_add(struct acpi_device *device) | ||
721 | { | 726 | { |
722 | int result = 0; | 727 | int result = 0; |
723 | struct acpi_pci_link *link = NULL; | 728 | struct acpi_pci_link *link = NULL; |
724 | int i = 0; | 729 | int i = 0; |
725 | int found = 0; | 730 | int found = 0; |
726 | 731 | ||
727 | ACPI_FUNCTION_TRACE("acpi_pci_link_add"); | 732 | ACPI_FUNCTION_TRACE("acpi_pci_link_add"); |
728 | 733 | ||
@@ -749,13 +754,12 @@ acpi_pci_link_add(struct acpi_device *device) | |||
749 | acpi_pci_link_get_current(link); | 754 | acpi_pci_link_get_current(link); |
750 | 755 | ||
751 | printk(PREFIX "%s [%s] (IRQs", acpi_device_name(device), | 756 | printk(PREFIX "%s [%s] (IRQs", acpi_device_name(device), |
752 | acpi_device_bid(device)); | 757 | acpi_device_bid(device)); |
753 | for (i = 0; i < link->irq.possible_count; i++) { | 758 | for (i = 0; i < link->irq.possible_count; i++) { |
754 | if (link->irq.active == link->irq.possible[i]) { | 759 | if (link->irq.active == link->irq.possible[i]) { |
755 | printk(" *%d", link->irq.possible[i]); | 760 | printk(" *%d", link->irq.possible[i]); |
756 | found = 1; | 761 | found = 1; |
757 | } | 762 | } else |
758 | else | ||
759 | printk(" %d", link->irq.possible[i]); | 763 | printk(" %d", link->irq.possible[i]); |
760 | } | 764 | } |
761 | 765 | ||
@@ -764,7 +768,7 @@ acpi_pci_link_add(struct acpi_device *device) | |||
764 | if (!found) | 768 | if (!found) |
765 | printk(" *%d", link->irq.active); | 769 | printk(" *%d", link->irq.active); |
766 | 770 | ||
767 | if(!link->device->status.enabled) | 771 | if (!link->device->status.enabled) |
768 | printk(", disabled."); | 772 | printk(", disabled."); |
769 | 773 | ||
770 | printk("\n"); | 774 | printk("\n"); |
@@ -773,7 +777,7 @@ acpi_pci_link_add(struct acpi_device *device) | |||
773 | list_add_tail(&link->node, &acpi_link.entries); | 777 | list_add_tail(&link->node, &acpi_link.entries); |
774 | acpi_link.count++; | 778 | acpi_link.count++; |
775 | 779 | ||
776 | end: | 780 | end: |
777 | /* disable all links -- to be activated on use */ | 781 | /* disable all links -- to be activated on use */ |
778 | acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); | 782 | acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); |
779 | up(&acpi_link_lock); | 783 | up(&acpi_link_lock); |
@@ -784,9 +788,7 @@ end: | |||
784 | return_VALUE(result); | 788 | return_VALUE(result); |
785 | } | 789 | } |
786 | 790 | ||
787 | static int | 791 | static int acpi_pci_link_resume(struct acpi_pci_link *link) |
788 | acpi_pci_link_resume( | ||
789 | struct acpi_pci_link *link) | ||
790 | { | 792 | { |
791 | ACPI_FUNCTION_TRACE("acpi_pci_link_resume"); | 793 | ACPI_FUNCTION_TRACE("acpi_pci_link_resume"); |
792 | 794 | ||
@@ -801,11 +803,10 @@ acpi_pci_link_resume( | |||
801 | * after every device calls pci_disable_device in .resume. | 803 | * after every device calls pci_disable_device in .resume. |
802 | */ | 804 | */ |
803 | int acpi_in_resume; | 805 | int acpi_in_resume; |
804 | static int | 806 | static int irqrouter_resume(struct sys_device *dev) |
805 | irqrouter_resume(struct sys_device *dev) | ||
806 | { | 807 | { |
807 | struct list_head *node = NULL; | 808 | struct list_head *node = NULL; |
808 | struct acpi_pci_link *link = NULL; | 809 | struct acpi_pci_link *link = NULL; |
809 | 810 | ||
810 | ACPI_FUNCTION_TRACE("irqrouter_resume"); | 811 | ACPI_FUNCTION_TRACE("irqrouter_resume"); |
811 | 812 | ||
@@ -814,7 +815,7 @@ irqrouter_resume(struct sys_device *dev) | |||
814 | link = list_entry(node, struct acpi_pci_link, node); | 815 | link = list_entry(node, struct acpi_pci_link, node); |
815 | if (!link) { | 816 | if (!link) { |
816 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 817 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
817 | "Invalid link context\n")); | 818 | "Invalid link context\n")); |
818 | continue; | 819 | continue; |
819 | } | 820 | } |
820 | acpi_pci_link_resume(link); | 821 | acpi_pci_link_resume(link); |
@@ -823,9 +824,7 @@ irqrouter_resume(struct sys_device *dev) | |||
823 | return_VALUE(0); | 824 | return_VALUE(0); |
824 | } | 825 | } |
825 | 826 | ||
826 | 827 | static int acpi_pci_link_remove(struct acpi_device *device, int type) | |
827 | static int | ||
828 | acpi_pci_link_remove(struct acpi_device *device, int type) | ||
829 | { | 828 | { |
830 | struct acpi_pci_link *link = NULL; | 829 | struct acpi_pci_link *link = NULL; |
831 | 830 | ||
@@ -834,7 +833,7 @@ acpi_pci_link_remove(struct acpi_device *device, int type) | |||
834 | if (!device || !acpi_driver_data(device)) | 833 | if (!device || !acpi_driver_data(device)) |
835 | return_VALUE(-EINVAL); | 834 | return_VALUE(-EINVAL); |
836 | 835 | ||
837 | link = (struct acpi_pci_link *) acpi_driver_data(device); | 836 | link = (struct acpi_pci_link *)acpi_driver_data(device); |
838 | 837 | ||
839 | down(&acpi_link_lock); | 838 | down(&acpi_link_lock); |
840 | list_del(&link->node); | 839 | list_del(&link->node); |
@@ -856,14 +855,14 @@ static int __init acpi_irq_penalty_update(char *str, int used) | |||
856 | int retval; | 855 | int retval; |
857 | int irq; | 856 | int irq; |
858 | 857 | ||
859 | retval = get_option(&str,&irq); | 858 | retval = get_option(&str, &irq); |
860 | 859 | ||
861 | if (!retval) | 860 | if (!retval) |
862 | break; /* no number found */ | 861 | break; /* no number found */ |
863 | 862 | ||
864 | if (irq < 0) | 863 | if (irq < 0) |
865 | continue; | 864 | continue; |
866 | 865 | ||
867 | if (irq >= ACPI_MAX_IRQS) | 866 | if (irq >= ACPI_MAX_IRQS) |
868 | continue; | 867 | continue; |
869 | 868 | ||
@@ -902,6 +901,7 @@ static int __init acpi_irq_isa(char *str) | |||
902 | { | 901 | { |
903 | return acpi_irq_penalty_update(str, 1); | 902 | return acpi_irq_penalty_update(str, 1); |
904 | } | 903 | } |
904 | |||
905 | __setup("acpi_irq_isa=", acpi_irq_isa); | 905 | __setup("acpi_irq_isa=", acpi_irq_isa); |
906 | 906 | ||
907 | /* | 907 | /* |
@@ -913,6 +913,7 @@ static int __init acpi_irq_pci(char *str) | |||
913 | { | 913 | { |
914 | return acpi_irq_penalty_update(str, 0); | 914 | return acpi_irq_penalty_update(str, 0); |
915 | } | 915 | } |
916 | |||
916 | __setup("acpi_irq_pci=", acpi_irq_pci); | 917 | __setup("acpi_irq_pci=", acpi_irq_pci); |
917 | 918 | ||
918 | static int __init acpi_irq_nobalance_set(char *str) | 919 | static int __init acpi_irq_nobalance_set(char *str) |
@@ -920,6 +921,7 @@ static int __init acpi_irq_nobalance_set(char *str) | |||
920 | acpi_irq_balance = 0; | 921 | acpi_irq_balance = 0; |
921 | return 1; | 922 | return 1; |
922 | } | 923 | } |
924 | |||
923 | __setup("acpi_irq_nobalance", acpi_irq_nobalance_set); | 925 | __setup("acpi_irq_nobalance", acpi_irq_nobalance_set); |
924 | 926 | ||
925 | int __init acpi_irq_balance_set(char *str) | 927 | int __init acpi_irq_balance_set(char *str) |
@@ -927,22 +929,20 @@ int __init acpi_irq_balance_set(char *str) | |||
927 | acpi_irq_balance = 1; | 929 | acpi_irq_balance = 1; |
928 | return 1; | 930 | return 1; |
929 | } | 931 | } |
930 | __setup("acpi_irq_balance", acpi_irq_balance_set); | ||
931 | 932 | ||
933 | __setup("acpi_irq_balance", acpi_irq_balance_set); | ||
932 | 934 | ||
933 | /* FIXME: we will remove this interface after all drivers call pci_disable_device */ | 935 | /* FIXME: we will remove this interface after all drivers call pci_disable_device */ |
934 | static struct sysdev_class irqrouter_sysdev_class = { | 936 | static struct sysdev_class irqrouter_sysdev_class = { |
935 | set_kset_name("irqrouter"), | 937 | set_kset_name("irqrouter"), |
936 | .resume = irqrouter_resume, | 938 | .resume = irqrouter_resume, |
937 | }; | 939 | }; |
938 | 940 | ||
939 | |||
940 | static struct sys_device device_irqrouter = { | 941 | static struct sys_device device_irqrouter = { |
941 | .id = 0, | 942 | .id = 0, |
942 | .cls = &irqrouter_sysdev_class, | 943 | .cls = &irqrouter_sysdev_class, |
943 | }; | 944 | }; |
944 | 945 | ||
945 | |||
946 | static int __init irqrouter_init_sysfs(void) | 946 | static int __init irqrouter_init_sysfs(void) |
947 | { | 947 | { |
948 | int error; | 948 | int error; |
@@ -957,12 +957,11 @@ static int __init irqrouter_init_sysfs(void) | |||
957 | error = sysdev_register(&device_irqrouter); | 957 | error = sysdev_register(&device_irqrouter); |
958 | 958 | ||
959 | return_VALUE(error); | 959 | return_VALUE(error); |
960 | } | 960 | } |
961 | 961 | ||
962 | device_initcall(irqrouter_init_sysfs); | 962 | device_initcall(irqrouter_init_sysfs); |
963 | 963 | ||
964 | 964 | static int __init acpi_pci_link_init(void) | |
965 | static int __init acpi_pci_link_init (void) | ||
966 | { | 965 | { |
967 | ACPI_FUNCTION_TRACE("acpi_pci_link_init"); | 966 | ACPI_FUNCTION_TRACE("acpi_pci_link_init"); |
968 | 967 | ||