Module Name:    src
Committed By:   riastradh
Date:           Mon May 22 14:58:51 UTC 2023

Modified Files:
        src/sys/dev/dkwedge: dk.c

Log Message:
dk(4): Use device_lookup_private for dkwedge_lookup.

No longer necessary to go through the dkwedges array.

Currently device_lookup_private still involves touching other global
locks, but that will change eventually to a lockless pserialized fast
path.


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/sys/dev/dkwedge/dk.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/dev/dkwedge/dk.c
diff -u src/sys/dev/dkwedge/dk.c:1.160 src/sys/dev/dkwedge/dk.c:1.161
--- src/sys/dev/dkwedge/dk.c:1.160	Mon May 22 14:58:41 2023
+++ src/sys/dev/dkwedge/dk.c	Mon May 22 14:58:50 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: dk.c,v 1.160 2023/05/22 14:58:41 riastradh Exp $	*/
+/*	$NetBSD: dk.c,v 1.161 2023/05/22 14:58:50 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.160 2023/05/22 14:58:41 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.161 2023/05/22 14:58:50 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dkwedge.h"
@@ -1164,17 +1164,8 @@ dkwedge_read(struct disk *pdk, struct vn
 static struct dkwedge_softc *
 dkwedge_lookup(dev_t dev)
 {
-	const int unit = minor(dev);
-	struct dkwedge_softc *sc;
-
-	rw_enter(&dkwedges_lock, RW_READER);
-	if (unit < 0 || unit >= ndkwedges)
-		sc = NULL;
-	else
-		sc = dkwedges[unit];
-	rw_exit(&dkwedges_lock);
 
-	return sc;
+	return device_lookup_private(&dk_cd, minor(dev));
 }
 
 static int

Reply via email to