Use mutex_trylock() rather than mixing Linux APIs with OpenBSD ones.
authormpi <mpi@openbsd.org>
Tue, 28 Nov 2017 13:38:11 +0000 (13:38 +0000)
committermpi <mpi@openbsd.org>
Tue, 28 Nov 2017 13:38:11 +0000 (13:38 +0000)
ok kettenis@

sys/dev/pci/drm/i915/i915_gem.c

index 676a2e6..306db1b 100644 (file)
@@ -2216,7 +2216,7 @@ i915_gem_fault(struct drm_gem_object *gem_obj, struct uvm_faultinfo *ufi,
 
        offset -= drm_vma_node_offset_addr(&obj->base.vma_node);
 
-       if (rw_enter(&dev->struct_mutex, RW_NOSLEEP | RW_WRITE) != 0) {
+       if (!mutex_trylock(&dev->struct_mutex)) {
                uvmfault_unlockall(ufi, NULL, &obj->base.uobj, NULL);
                mutex_lock(&dev->struct_mutex);
                locked = uvmfault_relock(ufi);