diff options
| author | riastradh <riastradh@NetBSD.org> | 2023-04-21 18:26:35 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2023-04-21 18:26:35 +0000 |
| commit | 7db941f2bf4b1d6b06fdc42468810ef0817f098c (patch) | |
| tree | cf695da664ced601fab0277476ffecffe96d888e /sys/dev/dkwedge/dk.c | |
| parent | 8e49b221bf5f4f2dbfd24421373b3b4f0aa996ca (diff) | |
dk(4): Move CFDRIVER_DECL and CFATTACH_DECL3_NEW earlier in file.
Follows the pattern of most drivers, and will be necessary for
referencing dk_cd in dk_bdevsw and dk_cdevsw soon, to prevent
open/detach races.
No functional change intended.
Diffstat (limited to 'sys/dev/dkwedge/dk.c')
| -rw-r--r-- | sys/dev/dkwedge/dk.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/sys/dev/dkwedge/dk.c b/sys/dev/dkwedge/dk.c index 23e867ea284..354d695abde 100644 --- a/sys/dev/dkwedge/dk.c +++ b/sys/dev/dkwedge/dk.c @@ -1,4 +1,4 @@ -/* $NetBSD: dk.c,v 1.135 2023/04/21 18:25:49 riastradh Exp $ */ +/* $NetBSD: dk.c,v 1.136 2023/04/21 18:26:35 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.135 2023/04/21 18:25:49 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.136 2023/04/21 18:26:35 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_dkwedge.h" @@ -96,6 +96,10 @@ struct dkwedge_softc { int sc_mode; /* parent open mode */ }; +static int dkwedge_match(device_t, cfdata_t, void *); +static void dkwedge_attach(device_t, device_t, void *); +static int dkwedge_detach(device_t, int); + static void dkstart(struct dkwedge_softc *); static void dkiodone(struct buf *); static void dkrestart(void *); @@ -120,6 +124,11 @@ static dev_type_dump(dkdump); static dev_type_size(dksize); static dev_type_discard(dkdiscard); +CFDRIVER_DECL(dk, DV_DISK, NULL); +CFATTACH_DECL3_NEW(dk, 0, + dkwedge_match, dkwedge_attach, dkwedge_detach, NULL, NULL, NULL, + DVF_DETACH_SHUTDOWN); + const struct bdevsw dk_bdevsw = { .d_open = dkopen, .d_close = dkclose, @@ -179,11 +188,6 @@ dkwedge_attach(device_t parent, device_t self, void *aux) aprint_error_dev(self, "couldn't establish power handler\n"); } -CFDRIVER_DECL(dk, DV_DISK, NULL); -CFATTACH_DECL3_NEW(dk, 0, - dkwedge_match, dkwedge_attach, dkwedge_detach, NULL, NULL, NULL, - DVF_DETACH_SHUTDOWN); - /* * dkwedge_wait_drain: * |
