diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2014-08-10 04:10:20 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2014-08-10 04:43:27 +1000 |
commit | 737a951e675b0b0bdd96423b762e2e5b26c3aeb3 (patch) | |
tree | 993752b32238c0cc9bce7cd4725a42a6767d4e07 /nvkm/engine/device | |
parent | 7a6217d8dd327130e937a5235e14742eaf04bc6f (diff) | |
download | nouveau-737a951e675b0b0bdd96423b762e2e5b26c3aeb3.tar.gz |
core: rework event interface
This is a lot of prep-work for being able to send event notifications
back to userspace. Events now contain data, rather than a "something
just happened" signal.
Handler data is now embedded into a containing structure, rather than
being kmalloc()'d, and can optionally have the notify routine handled
in a workqueue.
Various races between suspend/unload with display HPD/DP IRQ handlers
automagically solved as a result.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'nvkm/engine/device')
-rw-r--r-- | nvkm/engine/device/acpi.c | 2 | ||||
-rw-r--r-- | nvkm/engine/device/base.c | 23 |
2 files changed, 22 insertions, 3 deletions
diff --git a/nvkm/engine/device/acpi.c b/nvkm/engine/device/acpi.c index 79a2e4d47..4dbf0ba89 100644 --- a/nvkm/engine/device/acpi.c +++ b/nvkm/engine/device/acpi.c @@ -33,7 +33,7 @@ nvkm_acpi_ntfy(struct notifier_block *nb, unsigned long val, void *data) struct acpi_bus_event *info = data; if (!strcmp(info->device_class, "ac_adapter")) - nouveau_event_trigger(device->ntfy, 1, NVKM_DEVICE_NTFY_POWER); + nvkm_event_send(&device->event, 1, 0, NULL, 0); return NOTIFY_DONE; } diff --git a/nvkm/engine/device/base.c b/nvkm/engine/device/base.c index 6c16dabe1..ac31a6d68 100644 --- a/nvkm/engine/device/base.c +++ b/nvkm/engine/device/base.c @@ -364,6 +364,7 @@ nouveau_devobj_ofuncs = { /****************************************************************************** * nouveau_device: engine functions *****************************************************************************/ + static struct nouveau_oclass nouveau_device_sclass[] = { { 0x0080, &nouveau_devobj_ofuncs }, @@ -371,6 +372,23 @@ nouveau_device_sclass[] = { }; static int +nouveau_device_event_ctor(void *data, u32 size, struct nvkm_notify *notify) +{ + if (!WARN_ON(size != 0)) { + notify->size = 0; + notify->types = 1; + notify->index = 0; + return 0; + } + return -EINVAL; +} + +static const struct nvkm_event_func +nouveau_device_event_func = { + .ctor = nouveau_device_event_ctor, +}; + +static int nouveau_device_fini(struct nouveau_object *object, bool suspend) { struct nouveau_device *device = (void *)object; @@ -445,7 +463,7 @@ nouveau_device_dtor(struct nouveau_object *object) { struct nouveau_device *device = (void *)object; - nouveau_event_destroy(&device->ntfy); + nvkm_event_fini(&device->event); mutex_lock(&nv_devices_mutex); list_del(&device->head); @@ -545,7 +563,8 @@ nouveau_device_create_(void *dev, enum nv_bus_type type, u64 name, nv_engine(device)->sclass = nouveau_device_sclass; list_add(&device->head, &nv_devices); - ret = nouveau_event_create(1, NVKM_DEVICE_NTFY, &device->ntfy); + ret = nvkm_event_init(&nouveau_device_event_func, 1, 1, + &device->event); done: mutex_unlock(&nv_devices_mutex); return ret; |