From a7830346e211b77c30d237f402e7086f8e363b10 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Fri, 24 Sep 2004 06:43:20 +0000 Subject: [PATCH] Assert topology is held in g_dev_getprovider(). Don't call devsw(). It is not necessary, and we do not need to hold dev_lock to compare the devsw pointer to our own since we do not dereference it. --- sys/geom/geom_dev.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c index 8d0b7035b657..261e1f297b6d 100644 --- a/sys/geom/geom_dev.c +++ b/sys/geom/geom_dev.c @@ -99,11 +99,13 @@ g_dev_getprovider(struct cdev *dev) { struct g_consumer *cp; + g_topology_assert(); if (dev == NULL) return (NULL); - if (devsw(dev) != &g_dev_cdevsw) - return (NULL); - cp = dev->si_drv2; + if (dev->si_devsw != &g_dev_cdevsw) + cp = NULL; + else + cp = dev->si_drv2; return (cp->provider); }