diff options
Diffstat (limited to 'drivers/ata/libata-acpi.c')
-rw-r--r-- | drivers/ata/libata-acpi.c | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index 97727be7e158..c012307d0ba6 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -209,6 +209,46 @@ static void ata_acpi_ap_notify_dock(acpi_handle handle, u32 event, void *data) | |||
209 | ata_acpi_handle_hotplug(ap, NULL, event); | 209 | ata_acpi_handle_hotplug(ap, NULL, event); |
210 | } | 210 | } |
211 | 211 | ||
212 | static void ata_acpi_uevent(struct ata_port *ap, struct ata_device *dev, | ||
213 | u32 event) | ||
214 | { | ||
215 | struct kobject *kobj = NULL; | ||
216 | char event_string[20]; | ||
217 | char *envp[] = { event_string, NULL }; | ||
218 | |||
219 | if (dev) { | ||
220 | if (dev->sdev) | ||
221 | kobj = &dev->sdev->sdev_gendev.kobj; | ||
222 | } else | ||
223 | kobj = &ap->dev->kobj; | ||
224 | |||
225 | if (kobj) { | ||
226 | snprintf(event_string, 20, "BAY_EVENT=%d", event); | ||
227 | kobject_uevent_env(kobj, KOBJ_CHANGE, envp); | ||
228 | } | ||
229 | } | ||
230 | |||
231 | static void ata_acpi_ap_uevent(acpi_handle handle, u32 event, void *data) | ||
232 | { | ||
233 | ata_acpi_uevent(data, NULL, event); | ||
234 | } | ||
235 | |||
236 | static void ata_acpi_dev_uevent(acpi_handle handle, u32 event, void *data) | ||
237 | { | ||
238 | struct ata_device *dev = data; | ||
239 | ata_acpi_uevent(dev->link->ap, dev, event); | ||
240 | } | ||
241 | |||
242 | static struct acpi_dock_ops ata_acpi_dev_dock_ops = { | ||
243 | .handler = ata_acpi_dev_notify_dock, | ||
244 | .uevent = ata_acpi_dev_uevent, | ||
245 | }; | ||
246 | |||
247 | static struct acpi_dock_ops ata_acpi_ap_dock_ops = { | ||
248 | .handler = ata_acpi_ap_notify_dock, | ||
249 | .uevent = ata_acpi_ap_uevent, | ||
250 | }; | ||
251 | |||
212 | /** | 252 | /** |
213 | * ata_acpi_associate - associate ATA host with ACPI objects | 253 | * ata_acpi_associate - associate ATA host with ACPI objects |
214 | * @host: target ATA host | 254 | * @host: target ATA host |
@@ -244,7 +284,7 @@ void ata_acpi_associate(struct ata_host *host) | |||
244 | if (ap->acpi_handle) { | 284 | if (ap->acpi_handle) { |
245 | /* we might be on a docking station */ | 285 | /* we might be on a docking station */ |
246 | register_hotplug_dock_device(ap->acpi_handle, | 286 | register_hotplug_dock_device(ap->acpi_handle, |
247 | ata_acpi_ap_notify_dock, ap); | 287 | &ata_acpi_ap_dock_ops, ap); |
248 | } | 288 | } |
249 | 289 | ||
250 | for (j = 0; j < ata_link_max_devices(&ap->link); j++) { | 290 | for (j = 0; j < ata_link_max_devices(&ap->link); j++) { |
@@ -253,7 +293,7 @@ void ata_acpi_associate(struct ata_host *host) | |||
253 | if (dev->acpi_handle) { | 293 | if (dev->acpi_handle) { |
254 | /* we might be on a docking station */ | 294 | /* we might be on a docking station */ |
255 | register_hotplug_dock_device(dev->acpi_handle, | 295 | register_hotplug_dock_device(dev->acpi_handle, |
256 | ata_acpi_dev_notify_dock, dev); | 296 | &ata_acpi_dev_dock_ops, dev); |
257 | } | 297 | } |
258 | } | 298 | } |
259 | } | 299 | } |