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.c43
1 files changed, 28 insertions, 15 deletions
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c
index 45cd03b4630e..1f9f7d7d7bc5 100644
--- a/drivers/acpi/container.c
+++ b/drivers/acpi/container.c
@@ -158,9 +158,7 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context)
158 int result; 158 int result;
159 int present; 159 int present;
160 acpi_status status; 160 acpi_status status;
161 161 u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */
162
163 present = is_device_present(handle);
164 162
165 switch (type) { 163 switch (type) {
166 case ACPI_NOTIFY_BUS_CHECK: 164 case ACPI_NOTIFY_BUS_CHECK:
@@ -169,32 +167,47 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context)
169 printk(KERN_WARNING "Container driver received %s event\n", 167 printk(KERN_WARNING "Container driver received %s event\n",
170 (type == ACPI_NOTIFY_BUS_CHECK) ? 168 (type == ACPI_NOTIFY_BUS_CHECK) ?
171 "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK"); 169 "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK");
170
171 present = is_device_present(handle);
172 status = acpi_bus_get_device(handle, &device); 172 status = acpi_bus_get_device(handle, &device);
173 if (present) { 173 if (!present) {
174 if (ACPI_FAILURE(status) || !device) {
175 result = container_device_add(&device, handle);
176 if (!result)
177 kobject_uevent(&device->dev.kobj,
178 KOBJ_ONLINE);
179 else
180 printk(KERN_WARNING
181 "Failed to add container\n");
182 }
183 } else {
184 if (ACPI_SUCCESS(status)) { 174 if (ACPI_SUCCESS(status)) {
185 /* device exist and this is a remove request */ 175 /* device exist and this is a remove request */
176 device->flags.eject_pending = 1;
186 kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); 177 kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
178 return;
187 } 179 }
180 break;
181 }
182
183 if (!ACPI_FAILURE(status) || device)
184 break;
185
186 result = container_device_add(&device, handle);
187 if (result) {
188 printk(KERN_WARNING "Failed to add container\n");
189 break;
188 } 190 }
191
192 kobject_uevent(&device->dev.kobj, KOBJ_ONLINE);
193 ost_code = ACPI_OST_SC_SUCCESS;
189 break; 194 break;
195
190 case ACPI_NOTIFY_EJECT_REQUEST: 196 case ACPI_NOTIFY_EJECT_REQUEST:
191 if (!acpi_bus_get_device(handle, &device) && device) { 197 if (!acpi_bus_get_device(handle, &device) && device) {
198 device->flags.eject_pending = 1;
192 kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); 199 kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
200 return;
193 } 201 }
194 break; 202 break;
203
195 default: 204 default:
196 break; 205 /* non-hotplug event; possibly handled by other handler */
206 return;
197 } 207 }
208
209 /* Inform firmware that the hotplug operation has completed */
210 (void) acpi_evaluate_hotplug_ost(handle, type, ost_code, NULL);
198 return; 211 return;
199} 212}
200 213