Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 996f5a08 authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nouveau/core: pass related object into notify constructor



The event source types/index might need to be derived from it.

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent e94654e2
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -91,9 +91,10 @@ nvkm_client_notify_del(struct nouveau_client *client, int index)
}
}


int
int
nvkm_client_notify_new(struct nouveau_client *client,
nvkm_client_notify_new(struct nouveau_object *object,
		       struct nvkm_event *event, void *data, u32 size)
		       struct nvkm_event *event, void *data, u32 size)
{
{
	struct nouveau_client *client = nouveau_client(object);
	struct nvkm_client_notify *notify;
	struct nvkm_client_notify *notify;
	union {
	union {
		struct nvif_notify_req_v0 v0;
		struct nvif_notify_req_v0 v0;
@@ -127,8 +128,8 @@ nvkm_client_notify_new(struct nouveau_client *client,
	}
	}


	if (ret == 0) {
	if (ret == 0) {
		ret = nvkm_notify_init(event, nvkm_client_notify, false,
		ret = nvkm_notify_init(object, event, nvkm_client_notify,
				       data, size, reply, &notify->n);
				       false, data, size, reply, &notify->n);
		if (ret == 0) {
		if (ret == 0) {
			client->notify[index] = notify;
			client->notify[index] = notify;
			notify->client = client;
			notify->client = client;
+1 −1
Original line number Original line Diff line number Diff line
@@ -20,7 +20,7 @@
 * OTHER DEALINGS IN THE SOFTWARE.
 * OTHER DEALINGS IN THE SOFTWARE.
 */
 */


#include <core/os.h>
#include <core/object.h>
#include <core/event.h>
#include <core/event.h>


void
void
+1 −2
Original line number Original line Diff line number Diff line
@@ -349,7 +349,6 @@ nvkm_ioctl_unmap(struct nouveau_handle *handle, void *data, u32 size)
static int
static int
nvkm_ioctl_ntfy_new(struct nouveau_handle *handle, void *data, u32 size)
nvkm_ioctl_ntfy_new(struct nouveau_handle *handle, void *data, u32 size)
{
{
	struct nouveau_client *client = nouveau_client(handle->object);
	struct nouveau_object *object = handle->object;
	struct nouveau_object *object = handle->object;
	struct nouveau_ofuncs *ofuncs = object->oclass->ofuncs;
	struct nouveau_ofuncs *ofuncs = object->oclass->ofuncs;
	union {
	union {
@@ -365,7 +364,7 @@ nvkm_ioctl_ntfy_new(struct nouveau_handle *handle, void *data, u32 size)
		if (ret = -ENODEV, ofuncs->ntfy)
		if (ret = -ENODEV, ofuncs->ntfy)
			ret = ofuncs->ntfy(object, args->v0.event, &event);
			ret = ofuncs->ntfy(object, args->v0.event, &event);
		if (ret == 0) {
		if (ret == 0) {
			ret = nvkm_client_notify_new(client, event, data, size);
			ret = nvkm_client_notify_new(object, event, data, size);
			if (ret >= 0) {
			if (ret >= 0) {
				args->v0.index = ret;
				args->v0.index = ret;
				ret = 0;
				ret = 0;
+4 −3
Original line number Original line Diff line number Diff line
@@ -134,14 +134,15 @@ nvkm_notify_fini(struct nvkm_notify *notify)
}
}


int
int
nvkm_notify_init(struct nvkm_event *event, int (*func)(struct nvkm_notify *),
nvkm_notify_init(struct nouveau_object *object, struct nvkm_event *event,
		 bool work, void *data, u32 size, u32 reply,
		 int (*func)(struct nvkm_notify *), bool work,
		 void *data, u32 size, u32 reply,
		 struct nvkm_notify *notify)
		 struct nvkm_notify *notify)
{
{
	unsigned long flags;
	unsigned long flags;
	int ret = -ENODEV;
	int ret = -ENODEV;
	if ((notify->event = event), event->refs) {
	if ((notify->event = event), event->refs) {
		ret = event->func->ctor(data, size, notify);
		ret = event->func->ctor(object, data, size, notify);
		if (ret == 0 && (ret = -EINVAL, notify->size == reply)) {
		if (ret == 0 && (ret = -EINVAL, notify->size == reply)) {
			notify->flags = 0;
			notify->flags = 0;
			notify->block = 1;
			notify->block = 1;
+2 −1
Original line number Original line Diff line number Diff line
@@ -505,7 +505,8 @@ nouveau_device_sclass[] = {
};
};


static int
static int
nouveau_device_event_ctor(void *data, u32 size, struct nvkm_notify *notify)
nouveau_device_event_ctor(struct nouveau_object *object, void *data, u32 size,
			  struct nvkm_notify *notify)
{
{
	if (!WARN_ON(size != 0)) {
	if (!WARN_ON(size != 0)) {
		notify->size  = 0;
		notify->size  = 0;
Loading