aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToshi Kani <toshi.kani@hp.com>2012-05-23 22:25:23 -0400
committerLen Brown <len.brown@intel.com>2012-06-04 01:09:22 -0400
commit0c67dc242cf73b9c99a05bfd0122fc9ba1970d37 (patch)
tree004cde133fa98f3b0a5e3a41575c3722a71befd7
parentb1f00de66f8809b451a33ce47e461ef0e33c09e8 (diff)
ACPI: Add _OST support for ACPI container hotplug
Changed container_notify_cb() to call ACPI _OST method when ACPI container hotplug operation has completed. Slightly restructured the code with the same logic. The function sets eject_pending bit for an eject request since it does not initiate hot-remove operation. This bit is checked by the sysfs eject handler to determine if the request is originated from an ACPI eject notification. Signed-off-by: Toshi Kani <toshi.kani@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
-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