aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpi_memhotplug.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-08-05 00:44:28 -0400
committerLen Brown <len.brown@intel.com>2005-08-05 00:45:14 -0400
commit4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch)
tree5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/acpi_memhotplug.c
parentc65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff)
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/acpi_memhotplug.c')
-rw-r--r--drivers/acpi/acpi_memhotplug.c176
1 files changed, 80 insertions, 96 deletions
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index 77285ffe41c5..01a1bd239263 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -32,7 +32,6 @@
32#include <linux/memory_hotplug.h> 32#include <linux/memory_hotplug.h>
33#include <acpi/acpi_drivers.h> 33#include <acpi/acpi_drivers.h>
34 34
35
36#define ACPI_MEMORY_DEVICE_COMPONENT 0x08000000UL 35#define ACPI_MEMORY_DEVICE_COMPONENT 0x08000000UL
37#define ACPI_MEMORY_DEVICE_CLASS "memory" 36#define ACPI_MEMORY_DEVICE_CLASS "memory"
38#define ACPI_MEMORY_DEVICE_HID "PNP0C80" 37#define ACPI_MEMORY_DEVICE_HID "PNP0C80"
@@ -41,8 +40,8 @@
41 40
42#define _COMPONENT ACPI_MEMORY_DEVICE_COMPONENT 41#define _COMPONENT ACPI_MEMORY_DEVICE_COMPONENT
43 42
44ACPI_MODULE_NAME ("acpi_memory") 43ACPI_MODULE_NAME("acpi_memory")
45MODULE_AUTHOR("Naveen B S <naveen.b.s@intel.com>"); 44 MODULE_AUTHOR("Naveen B S <naveen.b.s@intel.com>");
46MODULE_DESCRIPTION(ACPI_MEMORY_DEVICE_DRIVER_NAME); 45MODULE_DESCRIPTION(ACPI_MEMORY_DEVICE_DRIVER_NAME);
47MODULE_LICENSE("GPL"); 46MODULE_LICENSE("GPL");
48 47
@@ -56,34 +55,33 @@ MODULE_LICENSE("GPL");
56#define MEMORY_POWER_ON_STATE 1 55#define MEMORY_POWER_ON_STATE 1
57#define MEMORY_POWER_OFF_STATE 2 56#define MEMORY_POWER_OFF_STATE 2
58 57
59static int acpi_memory_device_add (struct acpi_device *device); 58static int acpi_memory_device_add(struct acpi_device *device);
60static int acpi_memory_device_remove (struct acpi_device *device, int type); 59static int acpi_memory_device_remove(struct acpi_device *device, int type);
61 60
62static struct acpi_driver acpi_memory_device_driver = { 61static struct acpi_driver acpi_memory_device_driver = {
63 .name = ACPI_MEMORY_DEVICE_DRIVER_NAME, 62 .name = ACPI_MEMORY_DEVICE_DRIVER_NAME,
64 .class = ACPI_MEMORY_DEVICE_CLASS, 63 .class = ACPI_MEMORY_DEVICE_CLASS,
65 .ids = ACPI_MEMORY_DEVICE_HID, 64 .ids = ACPI_MEMORY_DEVICE_HID,
66 .ops = { 65 .ops = {
67 .add = acpi_memory_device_add, 66 .add = acpi_memory_device_add,
68 .remove = acpi_memory_device_remove, 67 .remove = acpi_memory_device_remove,
69 }, 68 },
70}; 69};
71 70
72struct acpi_memory_device { 71struct acpi_memory_device {
73 acpi_handle handle; 72 acpi_handle handle;
74 unsigned int state; /* State of the memory device */ 73 unsigned int state; /* State of the memory device */
75 unsigned short cache_attribute; /* memory cache attribute */ 74 unsigned short cache_attribute; /* memory cache attribute */
76 unsigned short read_write_attribute;/* memory read/write attribute */ 75 unsigned short read_write_attribute; /* memory read/write attribute */
77 u64 start_addr; /* Memory Range start physical addr */ 76 u64 start_addr; /* Memory Range start physical addr */
78 u64 end_addr; /* Memory Range end physical addr */ 77 u64 end_addr; /* Memory Range end physical addr */
79}; 78};
80 79
81
82static int 80static int
83acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) 81acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
84{ 82{
85 acpi_status status; 83 acpi_status status;
86 struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; 84 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
87 struct acpi_resource *resource = NULL; 85 struct acpi_resource *resource = NULL;
88 struct acpi_resource_address64 address64; 86 struct acpi_resource_address64 address64;
89 87
@@ -94,15 +92,15 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
94 if (ACPI_FAILURE(status)) 92 if (ACPI_FAILURE(status))
95 return_VALUE(-EINVAL); 93 return_VALUE(-EINVAL);
96 94
97 resource = (struct acpi_resource *) buffer.pointer; 95 resource = (struct acpi_resource *)buffer.pointer;
98 status = acpi_resource_to_address64(resource, &address64); 96 status = acpi_resource_to_address64(resource, &address64);
99 if (ACPI_SUCCESS(status)) { 97 if (ACPI_SUCCESS(status)) {
100 if (address64.resource_type == ACPI_MEMORY_RANGE) { 98 if (address64.resource_type == ACPI_MEMORY_RANGE) {
101 /* Populate the structure */ 99 /* Populate the structure */
102 mem_device->cache_attribute = 100 mem_device->cache_attribute =
103 address64.attribute.memory.cache_attribute; 101 address64.attribute.memory.cache_attribute;
104 mem_device->read_write_attribute = 102 mem_device->read_write_attribute =
105 address64.attribute.memory.read_write_attribute; 103 address64.attribute.memory.read_write_attribute;
106 mem_device->start_addr = address64.min_address_range; 104 mem_device->start_addr = address64.min_address_range;
107 mem_device->end_addr = address64.max_address_range; 105 mem_device->end_addr = address64.max_address_range;
108 } 106 }
@@ -114,7 +112,7 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
114 112
115static int 113static int
116acpi_memory_get_device(acpi_handle handle, 114acpi_memory_get_device(acpi_handle handle,
117 struct acpi_memory_device **mem_device) 115 struct acpi_memory_device **mem_device)
118{ 116{
119 acpi_status status; 117 acpi_status status;
120 acpi_handle phandle; 118 acpi_handle phandle;
@@ -128,8 +126,7 @@ acpi_memory_get_device(acpi_handle handle,
128 126
129 status = acpi_get_parent(handle, &phandle); 127 status = acpi_get_parent(handle, &phandle);
130 if (ACPI_FAILURE(status)) { 128 if (ACPI_FAILURE(status)) {
131 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 129 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_get_parent\n"));
132 "Error in acpi_get_parent\n"));
133 return_VALUE(-EINVAL); 130 return_VALUE(-EINVAL);
134 } 131 }
135 132
@@ -137,7 +134,7 @@ acpi_memory_get_device(acpi_handle handle,
137 status = acpi_bus_get_device(phandle, &pdevice); 134 status = acpi_bus_get_device(phandle, &pdevice);
138 if (ACPI_FAILURE(status)) { 135 if (ACPI_FAILURE(status)) {
139 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 136 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
140 "Error in acpi_bus_get_device\n")); 137 "Error in acpi_bus_get_device\n"));
141 return_VALUE(-EINVAL); 138 return_VALUE(-EINVAL);
142 } 139 }
143 140
@@ -147,23 +144,21 @@ acpi_memory_get_device(acpi_handle handle,
147 */ 144 */
148 status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE); 145 status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);
149 if (ACPI_FAILURE(status)) { 146 if (ACPI_FAILURE(status)) {
150 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 147 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_bus_add\n"));
151 "Error in acpi_bus_add\n"));
152 return_VALUE(-EINVAL); 148 return_VALUE(-EINVAL);
153 } 149 }
154 150
155end: 151 end:
156 *mem_device = acpi_driver_data(device); 152 *mem_device = acpi_driver_data(device);
157 if (!(*mem_device)) { 153 if (!(*mem_device)) {
158 printk(KERN_ERR "\n driver data not found" ); 154 printk(KERN_ERR "\n driver data not found");
159 return_VALUE(-ENODEV); 155 return_VALUE(-ENODEV);
160 } 156 }
161 157
162 return_VALUE(0); 158 return_VALUE(0);
163} 159}
164 160
165static int 161static int acpi_memory_check_device(struct acpi_memory_device *mem_device)
166acpi_memory_check_device(struct acpi_memory_device *mem_device)
167{ 162{
168 unsigned long current_status; 163 unsigned long current_status;
169 164
@@ -171,22 +166,21 @@ acpi_memory_check_device(struct acpi_memory_device *mem_device)
171 166
172 /* Get device present/absent information from the _STA */ 167 /* Get device present/absent information from the _STA */
173 if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->handle, "_STA", 168 if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->handle, "_STA",
174 NULL, &current_status))) 169 NULL, &current_status)))
175 return_VALUE(-ENODEV); 170 return_VALUE(-ENODEV);
176 /* 171 /*
177 * Check for device status. Device should be 172 * Check for device status. Device should be
178 * present/enabled/functioning. 173 * present/enabled/functioning.
179 */ 174 */
180 if (!((current_status & ACPI_MEMORY_STA_PRESENT) 175 if (!((current_status & ACPI_MEMORY_STA_PRESENT)
181 && (current_status & ACPI_MEMORY_STA_ENABLED) 176 && (current_status & ACPI_MEMORY_STA_ENABLED)
182 && (current_status & ACPI_MEMORY_STA_FUNCTIONAL))) 177 && (current_status & ACPI_MEMORY_STA_FUNCTIONAL)))
183 return_VALUE(-ENODEV); 178 return_VALUE(-ENODEV);
184 179
185 return_VALUE(0); 180 return_VALUE(0);
186} 181}
187 182
188static int 183static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
189acpi_memory_enable_device(struct acpi_memory_device *mem_device)
190{ 184{
191 int result; 185 int result;
192 186
@@ -196,7 +190,7 @@ acpi_memory_enable_device(struct acpi_memory_device *mem_device)
196 result = acpi_memory_get_device_resources(mem_device); 190 result = acpi_memory_get_device_resources(mem_device);
197 if (result) { 191 if (result) {
198 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 192 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
199 "\nget_device_resources failed\n")); 193 "\nget_device_resources failed\n"));
200 mem_device->state = MEMORY_INVALID_STATE; 194 mem_device->state = MEMORY_INVALID_STATE;
201 return result; 195 return result;
202 } 196 }
@@ -206,11 +200,10 @@ acpi_memory_enable_device(struct acpi_memory_device *mem_device)
206 * Note: Assume that this function returns zero on success 200 * Note: Assume that this function returns zero on success
207 */ 201 */
208 result = add_memory(mem_device->start_addr, 202 result = add_memory(mem_device->start_addr,
209 (mem_device->end_addr - mem_device->start_addr) + 1, 203 (mem_device->end_addr - mem_device->start_addr) + 1,
210 mem_device->read_write_attribute); 204 mem_device->read_write_attribute);
211 if (result) { 205 if (result) {
212 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 206 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n"));
213 "\nadd_memory failed\n"));
214 mem_device->state = MEMORY_INVALID_STATE; 207 mem_device->state = MEMORY_INVALID_STATE;
215 return result; 208 return result;
216 } 209 }
@@ -218,11 +211,10 @@ acpi_memory_enable_device(struct acpi_memory_device *mem_device)
218 return result; 211 return result;
219} 212}
220 213
221static int 214static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
222acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
223{ 215{
224 acpi_status status; 216 acpi_status status;
225 struct acpi_object_list arg_list; 217 struct acpi_object_list arg_list;
226 union acpi_object arg; 218 union acpi_object arg;
227 unsigned long current_status; 219 unsigned long current_status;
228 220
@@ -234,16 +226,16 @@ acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
234 arg.type = ACPI_TYPE_INTEGER; 226 arg.type = ACPI_TYPE_INTEGER;
235 arg.integer.value = 1; 227 arg.integer.value = 1;
236 status = acpi_evaluate_object(mem_device->handle, 228 status = acpi_evaluate_object(mem_device->handle,
237 "_EJ0", &arg_list, NULL); 229 "_EJ0", &arg_list, NULL);
238 /* Return on _EJ0 failure */ 230 /* Return on _EJ0 failure */
239 if (ACPI_FAILURE(status)) { 231 if (ACPI_FAILURE(status)) {
240 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"_EJ0 failed.\n")); 232 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "_EJ0 failed.\n"));
241 return_VALUE(-ENODEV); 233 return_VALUE(-ENODEV);
242 } 234 }
243 235
244 /* Evalute _STA to check if the device is disabled */ 236 /* Evalute _STA to check if the device is disabled */
245 status = acpi_evaluate_integer(mem_device->handle, "_STA", 237 status = acpi_evaluate_integer(mem_device->handle, "_STA",
246 NULL, &current_status); 238 NULL, &current_status);
247 if (ACPI_FAILURE(status)) 239 if (ACPI_FAILURE(status))
248 return_VALUE(-ENODEV); 240 return_VALUE(-ENODEV);
249 241
@@ -254,8 +246,7 @@ acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
254 return_VALUE(0); 246 return_VALUE(0);
255} 247}
256 248
257static int 249static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
258acpi_memory_disable_device(struct acpi_memory_device *mem_device)
259{ 250{
260 int result; 251 int result;
261 u64 start = mem_device->start_addr; 252 u64 start = mem_device->start_addr;
@@ -278,7 +269,7 @@ acpi_memory_disable_device(struct acpi_memory_device *mem_device)
278 result = acpi_memory_powerdown_device(mem_device); 269 result = acpi_memory_powerdown_device(mem_device);
279 if (result) { 270 if (result) {
280 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 271 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
281 "Device Power Down failed.\n")); 272 "Device Power Down failed.\n"));
282 /* Set the status of the device to invalid */ 273 /* Set the status of the device to invalid */
283 mem_device->state = MEMORY_INVALID_STATE; 274 mem_device->state = MEMORY_INVALID_STATE;
284 return result; 275 return result;
@@ -288,8 +279,7 @@ acpi_memory_disable_device(struct acpi_memory_device *mem_device)
288 return result; 279 return result;
289} 280}
290 281
291static void 282static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
292acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
293{ 283{
294 struct acpi_memory_device *mem_device; 284 struct acpi_memory_device *mem_device;
295 struct acpi_device *device; 285 struct acpi_device *device;
@@ -299,37 +289,37 @@ acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
299 switch (event) { 289 switch (event) {
300 case ACPI_NOTIFY_BUS_CHECK: 290 case ACPI_NOTIFY_BUS_CHECK:
301 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 291 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
302 "\nReceived BUS CHECK notification for device\n")); 292 "\nReceived BUS CHECK notification for device\n"));
303 /* Fall Through */ 293 /* Fall Through */
304 case ACPI_NOTIFY_DEVICE_CHECK: 294 case ACPI_NOTIFY_DEVICE_CHECK:
305 if (event == ACPI_NOTIFY_DEVICE_CHECK) 295 if (event == ACPI_NOTIFY_DEVICE_CHECK)
306 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 296 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
307 "\nReceived DEVICE CHECK notification for device\n")); 297 "\nReceived DEVICE CHECK notification for device\n"));
308 if (acpi_memory_get_device(handle, &mem_device)) { 298 if (acpi_memory_get_device(handle, &mem_device)) {
309 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 299 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
310 "Error in finding driver data\n")); 300 "Error in finding driver data\n"));
311 return_VOID; 301 return_VOID;
312 } 302 }
313 303
314 if (!acpi_memory_check_device(mem_device)) { 304 if (!acpi_memory_check_device(mem_device)) {
315 if (acpi_memory_enable_device(mem_device)) 305 if (acpi_memory_enable_device(mem_device))
316 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 306 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
317 "Error in acpi_memory_enable_device\n")); 307 "Error in acpi_memory_enable_device\n"));
318 } 308 }
319 break; 309 break;
320 case ACPI_NOTIFY_EJECT_REQUEST: 310 case ACPI_NOTIFY_EJECT_REQUEST:
321 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 311 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
322 "\nReceived EJECT REQUEST notification for device\n")); 312 "\nReceived EJECT REQUEST notification for device\n"));
323 313
324 if (acpi_bus_get_device(handle, &device)) { 314 if (acpi_bus_get_device(handle, &device)) {
325 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 315 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
326 "Device doesn't exist\n")); 316 "Device doesn't exist\n"));
327 break; 317 break;
328 } 318 }
329 mem_device = acpi_driver_data(device); 319 mem_device = acpi_driver_data(device);
330 if (!mem_device) { 320 if (!mem_device) {
331 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 321 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
332 "Driver Data is NULL\n")); 322 "Driver Data is NULL\n"));
333 break; 323 break;
334 } 324 }
335 325
@@ -337,26 +327,25 @@ acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
337 * Currently disabling memory device from kernel mode 327 * Currently disabling memory device from kernel mode
338 * TBD: Can also be disabled from user mode scripts 328 * TBD: Can also be disabled from user mode scripts
339 * TBD: Can also be disabled by Callback registration 329 * TBD: Can also be disabled by Callback registration
340 * with generic sysfs driver 330 * with generic sysfs driver
341 */ 331 */
342 if (acpi_memory_disable_device(mem_device)) 332 if (acpi_memory_disable_device(mem_device))
343 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 333 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
344 "Error in acpi_memory_disable_device\n")); 334 "Error in acpi_memory_disable_device\n"));
345 /* 335 /*
346 * TBD: Invoke acpi_bus_remove to cleanup data structures 336 * TBD: Invoke acpi_bus_remove to cleanup data structures
347 */ 337 */
348 break; 338 break;
349 default: 339 default:
350 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 340 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
351 "Unsupported event [0x%x]\n", event)); 341 "Unsupported event [0x%x]\n", event));
352 break; 342 break;
353 } 343 }
354 344
355 return_VOID; 345 return_VOID;
356} 346}
357 347
358static int 348static int acpi_memory_device_add(struct acpi_device *device)
359acpi_memory_device_add(struct acpi_device *device)
360{ 349{
361 int result; 350 int result;
362 struct acpi_memory_device *mem_device = NULL; 351 struct acpi_memory_device *mem_device = NULL;
@@ -391,8 +380,7 @@ acpi_memory_device_add(struct acpi_device *device)
391 return_VALUE(result); 380 return_VALUE(result);
392} 381}
393 382
394static int 383static int acpi_memory_device_remove(struct acpi_device *device, int type)
395acpi_memory_device_remove (struct acpi_device *device, int type)
396{ 384{
397 struct acpi_memory_device *mem_device = NULL; 385 struct acpi_memory_device *mem_device = NULL;
398 386
@@ -401,7 +389,7 @@ acpi_memory_device_remove (struct acpi_device *device, int type)
401 if (!device || !acpi_driver_data(device)) 389 if (!device || !acpi_driver_data(device))
402 return_VALUE(-EINVAL); 390 return_VALUE(-EINVAL);
403 391
404 mem_device = (struct acpi_memory_device *) acpi_driver_data(device); 392 mem_device = (struct acpi_memory_device *)acpi_driver_data(device);
405 kfree(mem_device); 393 kfree(mem_device);
406 394
407 return_VALUE(0); 395 return_VALUE(0);
@@ -410,12 +398,11 @@ acpi_memory_device_remove (struct acpi_device *device, int type)
410/* 398/*
411 * Helper function to check for memory device 399 * Helper function to check for memory device
412 */ 400 */
413static acpi_status 401static acpi_status is_memory_device(acpi_handle handle)
414is_memory_device(acpi_handle handle)
415{ 402{
416 char *hardware_id; 403 char *hardware_id;
417 acpi_status status; 404 acpi_status status;
418 struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; 405 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
419 struct acpi_device_info *info; 406 struct acpi_device_info *info;
420 407
421 ACPI_FUNCTION_TRACE("is_memory_device"); 408 ACPI_FUNCTION_TRACE("is_memory_device");
@@ -432,7 +419,7 @@ is_memory_device(acpi_handle handle)
432 419
433 hardware_id = info->hardware_id.value; 420 hardware_id = info->hardware_id.value;
434 if ((hardware_id == NULL) || 421 if ((hardware_id == NULL) ||
435 (strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID))) 422 (strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID)))
436 status = AE_ERROR; 423 status = AE_ERROR;
437 424
438 acpi_os_free(buffer.pointer); 425 acpi_os_free(buffer.pointer);
@@ -440,8 +427,8 @@ is_memory_device(acpi_handle handle)
440} 427}
441 428
442static acpi_status 429static acpi_status
443acpi_memory_register_notify_handler (acpi_handle handle, 430acpi_memory_register_notify_handler(acpi_handle handle,
444 u32 level, void *ctxt, void **retv) 431 u32 level, void *ctxt, void **retv)
445{ 432{
446 acpi_status status; 433 acpi_status status;
447 434
@@ -452,10 +439,10 @@ acpi_memory_register_notify_handler (acpi_handle handle,
452 return_ACPI_STATUS(AE_OK); /* continue */ 439 return_ACPI_STATUS(AE_OK); /* continue */
453 440
454 status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, 441 status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
455 acpi_memory_device_notify, NULL); 442 acpi_memory_device_notify, NULL);
456 if (ACPI_FAILURE(status)) { 443 if (ACPI_FAILURE(status)) {
457 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 444 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
458 "Error installing notify handler\n")); 445 "Error installing notify handler\n"));
459 return_ACPI_STATUS(AE_OK); /* continue */ 446 return_ACPI_STATUS(AE_OK); /* continue */
460 } 447 }
461 448
@@ -463,8 +450,8 @@ acpi_memory_register_notify_handler (acpi_handle handle,
463} 450}
464 451
465static acpi_status 452static acpi_status
466acpi_memory_deregister_notify_handler (acpi_handle handle, 453acpi_memory_deregister_notify_handler(acpi_handle handle,
467 u32 level, void *ctxt, void **retv) 454 u32 level, void *ctxt, void **retv)
468{ 455{
469 acpi_status status; 456 acpi_status status;
470 457
@@ -475,18 +462,18 @@ acpi_memory_deregister_notify_handler (acpi_handle handle,
475 return_ACPI_STATUS(AE_OK); /* continue */ 462 return_ACPI_STATUS(AE_OK); /* continue */
476 463
477 status = acpi_remove_notify_handler(handle, 464 status = acpi_remove_notify_handler(handle,
478 ACPI_SYSTEM_NOTIFY, acpi_memory_device_notify); 465 ACPI_SYSTEM_NOTIFY,
466 acpi_memory_device_notify);
479 if (ACPI_FAILURE(status)) { 467 if (ACPI_FAILURE(status)) {
480 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 468 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
481 "Error removing notify handler\n")); 469 "Error removing notify handler\n"));
482 return_ACPI_STATUS(AE_OK); /* continue */ 470 return_ACPI_STATUS(AE_OK); /* continue */
483 } 471 }
484 472
485 return_ACPI_STATUS(status); 473 return_ACPI_STATUS(status);
486} 474}
487 475
488static int __init 476static int __init acpi_memory_device_init(void)
489acpi_memory_device_init (void)
490{ 477{
491 int result; 478 int result;
492 acpi_status status; 479 acpi_status status;
@@ -499,21 +486,20 @@ acpi_memory_device_init (void)
499 return_VALUE(-ENODEV); 486 return_VALUE(-ENODEV);
500 487
501 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 488 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
502 ACPI_UINT32_MAX, 489 ACPI_UINT32_MAX,
503 acpi_memory_register_notify_handler, 490 acpi_memory_register_notify_handler,
504 NULL, NULL); 491 NULL, NULL);
505 492
506 if (ACPI_FAILURE (status)) { 493 if (ACPI_FAILURE(status)) {
507 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed\n")); 494 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n"));
508 acpi_bus_unregister_driver(&acpi_memory_device_driver); 495 acpi_bus_unregister_driver(&acpi_memory_device_driver);
509 return_VALUE(-ENODEV); 496 return_VALUE(-ENODEV);
510 } 497 }
511 498
512 return_VALUE(0); 499 return_VALUE(0);
513} 500}
514 501
515static void __exit 502static void __exit acpi_memory_device_exit(void)
516acpi_memory_device_exit (void)
517{ 503{
518 acpi_status status; 504 acpi_status status;
519 505
@@ -524,12 +510,12 @@ acpi_memory_device_exit (void)
524 * handles. 510 * handles.
525 */ 511 */
526 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 512 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
527 ACPI_UINT32_MAX, 513 ACPI_UINT32_MAX,
528 acpi_memory_deregister_notify_handler, 514 acpi_memory_deregister_notify_handler,
529 NULL, NULL); 515 NULL, NULL);
530 516
531 if (ACPI_FAILURE (status)) 517 if (ACPI_FAILURE(status))
532 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed\n")); 518 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n"));
533 519
534 acpi_bus_unregister_driver(&acpi_memory_device_driver); 520 acpi_bus_unregister_driver(&acpi_memory_device_driver);
535 521
@@ -538,5 +524,3 @@ acpi_memory_device_exit (void)
538 524
539module_init(acpi_memory_device_init); 525module_init(acpi_memory_device_init);
540module_exit(acpi_memory_device_exit); 526module_exit(acpi_memory_device_exit);
541
542