Module Name:    src
Committed By:   riastradh
Date:           Sun Dec 19 00:56:01 UTC 2021

Modified Files:
        src/sys/external/bsd/drm2/dist/drm: drm_connector.c

Log Message:
Make it build.

- mutex_init/destroy -> linux_mutex_init/destroy
- refcount_dec_and_test -> kref_put
  (until we implement Linux refcount(9))
- LIST_HEAD(x) -> struct list_head x = LIST_HEAD_INIT(x)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/dist/drm/drm_connector.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/drm_connector.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_connector.c:1.2 src/sys/external/bsd/drm2/dist/drm/drm_connector.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/drm_connector.c:1.2	Sat Dec 18 23:44:57 2021
+++ src/sys/external/bsd/drm2/dist/drm/drm_connector.c	Sun Dec 19 00:56:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_connector.c,v 1.2 2021/12/18 23:44:57 riastradh Exp $	*/
+/*	$NetBSD: drm_connector.c,v 1.3 2021/12/19 00:56:01 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2016 Intel Corporation
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_connector.c,v 1.2 2021/12/18 23:44:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_connector.c,v 1.3 2021/12/19 00:56:01 riastradh Exp $");
 
 #include <drm/drm_connector.h>
 #include <drm/drm_edid.h>
@@ -256,7 +256,11 @@ int drm_connector_init(struct drm_device
 
 	INIT_LIST_HEAD(&connector->probed_modes);
 	INIT_LIST_HEAD(&connector->modes);
+#ifdef __NetBSD__
+	linux_mutex_init(&connector->mutex);
+#else
 	mutex_init(&connector->mutex);
+#endif
 	connector->edid_blob_ptr = NULL;
 	connector->tile_blob_ptr = NULL;
 	connector->status = connector_status_unknown;
@@ -469,7 +473,11 @@ void drm_connector_cleanup(struct drm_co
 		connector->funcs->atomic_destroy_state(connector,
 						       connector->state);
 
+#ifdef __NetBSD__
+	linux_mutex_destroy(&connector->mutex);
+#else
 	mutex_destroy(&connector->mutex);
+#endif
 
 	memset(connector, 0, sizeof(*connector));
 }
@@ -659,7 +667,8 @@ __drm_connector_put_safe(struct drm_conn
 
 	lockdep_assert_held(&config->connector_list_lock);
 
-	if (!refcount_dec_and_test(&conn->base.refcount.refcount))
+	/* XXX sketchy function pointer cast */
+	if (!kref_put(&conn->base.refcount, (void (*)(struct kref *))voidop))
 		return;
 
 	llist_add(&conn->free_node, &config->connector_free_list);
@@ -2196,7 +2205,7 @@ int drm_mode_getconnector(struct drm_dev
 	struct drm_mode_modeinfo u_mode;
 	struct drm_mode_modeinfo __user *mode_ptr;
 	uint32_t __user *encoder_ptr;
-	LIST_HEAD(export_list);
+	struct list_head export_list = LIST_HEAD_INIT(export_list);
 
 	if (!drm_core_check_feature(dev, DRIVER_MODESET))
 		return -EOPNOTSUPP;

Reply via email to