aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/container.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/container.c')
-rw-r--r--drivers/acpi/container.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c
index e2fcef4a83df..7f7e41d40a3b 100644
--- a/drivers/acpi/container.c
+++ b/drivers/acpi/container.c
@@ -73,17 +73,16 @@ static int is_device_present(acpi_handle handle)
73 acpi_status status; 73 acpi_status status;
74 unsigned long sta; 74 unsigned long sta;
75 75
76 ACPI_FUNCTION_TRACE("is_device_present");
77 76
78 status = acpi_get_handle(handle, "_STA", &temp); 77 status = acpi_get_handle(handle, "_STA", &temp);
79 if (ACPI_FAILURE(status)) 78 if (ACPI_FAILURE(status))
80 return_VALUE(1); /* _STA not found, assmue device present */ 79 return 1; /* _STA not found, assmue device present */
81 80
82 status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); 81 status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
83 if (ACPI_FAILURE(status)) 82 if (ACPI_FAILURE(status))
84 return_VALUE(0); /* Firmware error */ 83 return 0; /* Firmware error */
85 84
86 return_VALUE((sta & ACPI_STA_PRESENT) == ACPI_STA_PRESENT); 85 return ((sta & ACPI_STA_PRESENT) == ACPI_STA_PRESENT);
87} 86}
88 87
89/*******************************************************************/ 88/*******************************************************************/
@@ -91,16 +90,15 @@ static int acpi_container_add(struct acpi_device *device)
91{ 90{
92 struct acpi_container *container; 91 struct acpi_container *container;
93 92
94 ACPI_FUNCTION_TRACE("acpi_container_add");
95 93
96 if (!device) { 94 if (!device) {
97 printk(KERN_ERR PREFIX "device is NULL\n"); 95 printk(KERN_ERR PREFIX "device is NULL\n");
98 return_VALUE(-EINVAL); 96 return -EINVAL;
99 } 97 }
100 98
101 container = kmalloc(sizeof(struct acpi_container), GFP_KERNEL); 99 container = kmalloc(sizeof(struct acpi_container), GFP_KERNEL);
102 if (!container) 100 if (!container)
103 return_VALUE(-ENOMEM); 101 return -ENOMEM;
104 102
105 memset(container, 0, sizeof(struct acpi_container)); 103 memset(container, 0, sizeof(struct acpi_container));
106 container->handle = device->handle; 104 container->handle = device->handle;
@@ -111,7 +109,7 @@ static int acpi_container_add(struct acpi_device *device)
111 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n", 109 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n",
112 acpi_device_name(device), acpi_device_bid(device))); 110 acpi_device_name(device), acpi_device_bid(device)));
113 111
114 return_VALUE(0); 112 return 0;
115} 113}
116 114
117static int acpi_container_remove(struct acpi_device *device, int type) 115static int acpi_container_remove(struct acpi_device *device, int type)
@@ -130,23 +128,22 @@ static int container_device_add(struct acpi_device **device, acpi_handle handle)
130 struct acpi_device *pdev; 128 struct acpi_device *pdev;
131 int result; 129 int result;
132 130
133 ACPI_FUNCTION_TRACE("container_device_add");
134 131
135 if (acpi_get_parent(handle, &phandle)) { 132 if (acpi_get_parent(handle, &phandle)) {
136 return_VALUE(-ENODEV); 133 return -ENODEV;
137 } 134 }
138 135
139 if (acpi_bus_get_device(phandle, &pdev)) { 136 if (acpi_bus_get_device(phandle, &pdev)) {
140 return_VALUE(-ENODEV); 137 return -ENODEV;
141 } 138 }
142 139
143 if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_DEVICE)) { 140 if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_DEVICE)) {
144 return_VALUE(-ENODEV); 141 return -ENODEV;
145 } 142 }
146 143
147 result = acpi_bus_start(*device); 144 result = acpi_bus_start(*device);
148 145
149 return_VALUE(result); 146 return result;
150} 147}
151 148
152static void container_notify_cb(acpi_handle handle, u32 type, void *context) 149static void container_notify_cb(acpi_handle handle, u32 type, void *context)
@@ -156,7 +153,6 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context)
156 int present; 153 int present;
157 acpi_status status; 154 acpi_status status;
158 155
159 ACPI_FUNCTION_TRACE("container_notify_cb");
160 156
161 present = is_device_present(handle); 157 present = is_device_present(handle);
162 158
@@ -192,7 +188,7 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context)
192 default: 188 default:
193 break; 189 break;
194 } 190 }
195 return_VOID; 191 return;
196} 192}
197 193
198static acpi_status 194static acpi_status
@@ -205,11 +201,10 @@ container_walk_namespace_cb(acpi_handle handle,
205 acpi_status status; 201 acpi_status status;
206 int *action = context; 202 int *action = context;
207 203
208 ACPI_FUNCTION_TRACE("container_walk_namespace_cb");
209 204
210 status = acpi_get_object_info(handle, &buffer); 205 status = acpi_get_object_info(handle, &buffer);
211 if (ACPI_FAILURE(status) || !buffer.pointer) { 206 if (ACPI_FAILURE(status) || !buffer.pointer) {
212 return_ACPI_STATUS(AE_OK); 207 return AE_OK;
213 } 208 }
214 209
215 info = buffer.pointer; 210 info = buffer.pointer;
@@ -243,7 +238,7 @@ container_walk_namespace_cb(acpi_handle handle,
243 end: 238 end:
244 acpi_os_free(buffer.pointer); 239 acpi_os_free(buffer.pointer);
245 240
246 return_ACPI_STATUS(AE_OK); 241 return AE_OK;
247} 242}
248 243
249static int __init acpi_container_init(void) 244static int __init acpi_container_init(void)
@@ -269,7 +264,6 @@ static void __exit acpi_container_exit(void)
269{ 264{
270 int action = UNINSTALL_NOTIFY_HANDLER; 265 int action = UNINSTALL_NOTIFY_HANDLER;
271 266
272 ACPI_FUNCTION_TRACE("acpi_container_exit");
273 267
274 acpi_walk_namespace(ACPI_TYPE_DEVICE, 268 acpi_walk_namespace(ACPI_TYPE_DEVICE,
275 ACPI_ROOT_OBJECT, 269 ACPI_ROOT_OBJECT,
@@ -278,7 +272,7 @@ static void __exit acpi_container_exit(void)
278 272
279 acpi_bus_unregister_driver(&acpi_container_driver); 273 acpi_bus_unregister_driver(&acpi_container_driver);
280 274
281 return_VOID; 275 return;
282} 276}
283 277
284module_init(acpi_container_init); 278module_init(acpi_container_init);