Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/pgoyette-localcount]: src/sys/dev Remove cgd_release() - it's not needed...
details: https://anonhg.NetBSD.org/src/rev/f5c6c010c14c
branches: pgoyette-localcount
changeset: 852855:f5c6c010c14c
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Sun Jul 24 00:14:08 2016 +0000
description:
Remove cgd_release() - it's not needed now that getcgd_softc() provides
access to the device_t
Restore original cgdattach() - seems to be needed after all.
Remove some debug printf's from GETCGD_SOFTC() macro.
diffstat:
sys/dev/cgd.c | 40 +++++-----------------------------------
1 files changed, 5 insertions(+), 35 deletions(-)
diffs (142 lines):
diff -r 2a80dee4934b -r f5c6c010c14c sys/dev/cgd.c
--- a/sys/dev/cgd.c Sat Jul 23 21:54:50 2016 +0000
+++ b/sys/dev/cgd.c Sun Jul 24 00:14:08 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.108.2.11 2016/07/23 03:20:37 pgoyette Exp $ */
+/* $NetBSD: cgd.c,v 1.108.2.12 2016/07/24 00:14:08 pgoyette Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.108.2.11 2016/07/23 03:20:37 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.108.2.12 2016/07/24 00:14:08 pgoyette Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -173,25 +173,12 @@
#define CGDUNIT(x) DISKUNIT(x)
#define GETCGD_SOFTC(_cs, x, _dv) \
- printf("%s: GETCGD_SOFTC\n", __func__); \
- if (!((_cs) = getcgd_softc(x, &_dv))) { \
- printf("%s: cs NULL\n", __func__); \
+ if (((_cs) = getcgd_softc(x, &_dv)) == NULL) { \
return ENXIO; \
}
/* The code */
-static void
-cgd_release(dev_t dev)
-{
- int unit = CGDUNIT(dev);
- device_t self;
-
- self = device_lookup_acquire(&cgd_cd, unit);
- if (self != NULL)
- device_release(self);
-}
-
static struct cgd_softc *
getcgd_softc(dev_t dev, device_t *self)
{
@@ -257,18 +244,12 @@
void
cgdattach(int num)
{
-/*
- * We don't need to do anything here - the config database is updated
- * in module initialization code.
-
int error;
error = config_cfattach_attach(cgd_cd.cd_name, &cgd_ca);
if (error != 0)
aprint_error("%s: unable to register cfattach\n",
cgd_cd.cd_name);
- *
- */
}
static struct cgd_softc *
@@ -349,7 +330,7 @@
}
}
device_release(self);
- return error;
+ return 0;
}
static void
@@ -374,14 +355,12 @@
bp->b_error = EINVAL;
bp->b_resid = bp->b_bcount;
biodone(bp);
- cgd_release(bp->b_dev);
device_release(self);
return;
}
/* XXXrcd: Should we test for (cs != NULL)? */
dk_strategy(&cs->sc_dksc, bp);
- cgd_release(bp->b_dev);
device_release(self);
return;
}
@@ -399,7 +378,6 @@
else
retval = dk_size(&cs->sc_dksc, dev);
- cgd_release(dev);
device_release(self);
return retval;
}
@@ -510,7 +488,6 @@
static void
cgdiodone(struct buf *nbp)
{
- dev_t dev;
device_t self;
struct buf *obp = nbp->b_private;
struct cgd_softc *cs = getcgd_softc(obp->b_dev, &self);
@@ -555,13 +532,7 @@
if (obp->b_error != 0)
obp->b_resid = obp->b_bcount;
- /*
- * copy the dev_t, finish the disk operation, and release the
- * reference we're holding on to (from getcgd_softc() earlier)
- */
- dev = obp->b_dev;
dk_done(dksc, obp);
- cgd_release(dev);
device_release(self);
dk_start(dksc, NULL);
@@ -917,7 +888,6 @@
cgu->cgu_unit = unit;
if (cgu->cgu_unit < 0) {
- cgd_release(dev);
device_release(self);
return EINVAL; /* XXX: should this be ENXIO? */
}
@@ -938,7 +908,6 @@
cgu->cgu_mode = cs->sc_cdata.cf_mode;
cgu->cgu_keylen = cs->sc_cdata.cf_keylen;
}
- cgd_release(dev);
device_release(self);
return 0;
}
@@ -1175,6 +1144,7 @@
config_cfdriver_detach(&cgd_cd);
aprint_error("%s: unable to attach %s devsw, "
"error %d", __func__, cgd_cd.cd_name, error);
+ break;
}
#endif
break;
Home |
Main Index |
Thread Index |
Old Index