| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: flash.c,v 1.3 2011/04/04 14:25:09 ahoka Exp $ */ | | 1 | /* $NetBSD: flash.c,v 1.4 2011/04/26 17:42:20 ahoka Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2011 Department of Software Engineering, | | 4 | * Copyright (c) 2011 Department of Software Engineering, |
5 | * University of Szeged, Hungary | | 5 | * University of Szeged, Hungary |
6 | * Copyright (c) 2011 Adam Hoka <ahoka@NetBSD.org> | | 6 | * Copyright (c) 2011 Adam Hoka <ahoka@NetBSD.org> |
7 | * Copyright (c) 2010 David Tengeri <dtengeri@inf.u-szeged.hu> | | 7 | * Copyright (c) 2010 David Tengeri <dtengeri@inf.u-szeged.hu> |
8 | * All rights reserved. | | 8 | * All rights reserved. |
9 | * | | 9 | * |
10 | * This code is derived from software contributed to The NetBSD Foundation | | 10 | * This code is derived from software contributed to The NetBSD Foundation |
11 | * by the Department of Software Engineering, University of Szeged, Hungary | | 11 | * by the Department of Software Engineering, University of Szeged, Hungary |
12 | * | | 12 | * |
13 | * Redistribution and use in source and binary forms, with or without | | 13 | * Redistribution and use in source and binary forms, with or without |
14 | * modification, are permitted provided that the following conditions | | 14 | * modification, are permitted provided that the following conditions |
| @@ -27,27 +27,27 @@ | | | @@ -27,27 +27,27 @@ |
27 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | | 27 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
28 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | | 28 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
29 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | | 29 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
32 | * SUCH DAMAGE. | | 32 | * SUCH DAMAGE. |
33 | */ | | 33 | */ |
34 | | | 34 | |
35 | /*- | | 35 | /*- |
36 | * Framework for storage devices based on Flash technology | | 36 | * Framework for storage devices based on Flash technology |
37 | */ | | 37 | */ |
38 | | | 38 | |
39 | #include <sys/cdefs.h> | | 39 | #include <sys/cdefs.h> |
40 | __KERNEL_RCSID(0, "$NetBSD: flash.c,v 1.3 2011/04/04 14:25:09 ahoka Exp $"); | | 40 | __KERNEL_RCSID(0, "$NetBSD: flash.c,v 1.4 2011/04/26 17:42:20 ahoka Exp $"); |
41 | | | 41 | |
42 | #include <sys/param.h> | | 42 | #include <sys/param.h> |
43 | #include <sys/types.h> | | 43 | #include <sys/types.h> |
44 | #include <sys/proc.h> | | 44 | #include <sys/proc.h> |
45 | #include <sys/errno.h> | | 45 | #include <sys/errno.h> |
46 | #include <sys/ioctl.h> | | 46 | #include <sys/ioctl.h> |
47 | #include <sys/device.h> | | 47 | #include <sys/device.h> |
48 | #include <sys/conf.h> | | 48 | #include <sys/conf.h> |
49 | #include <sys/kmem.h> | | 49 | #include <sys/kmem.h> |
50 | #include <sys/uio.h> | | 50 | #include <sys/uio.h> |
51 | #include <sys/kernel.h> | | 51 | #include <sys/kernel.h> |
52 | | | 52 | |
53 | #include <sys/atomic.h> | | 53 | #include <sys/atomic.h> |
| @@ -206,29 +206,27 @@ flash_attach(device_t parent, device_t s | | | @@ -206,29 +206,27 @@ flash_attach(device_t parent, device_t s |
206 | if (!pmf_device_register1(sc->sc_dev, NULL, NULL, flash_shutdown)) | | 206 | if (!pmf_device_register1(sc->sc_dev, NULL, NULL, flash_shutdown)) |
207 | aprint_error_dev(sc->sc_dev, | | 207 | aprint_error_dev(sc->sc_dev, |
208 | "couldn't establish power handler\n"); | | 208 | "couldn't establish power handler\n"); |
209 | } | | 209 | } |
210 | | | 210 | |
211 | int | | 211 | int |
212 | flash_detach(device_t device, int flags) | | 212 | flash_detach(device_t device, int flags) |
213 | { | | 213 | { |
214 | struct flash_softc *sc = device_private(device); | | 214 | struct flash_softc *sc = device_private(device); |
215 | | | 215 | |
216 | pmf_device_deregister(sc->sc_dev); | | 216 | pmf_device_deregister(sc->sc_dev); |
217 | | | 217 | |
218 | /* freeing flash_if is our responsibility */ | | 218 | /* freeing flash_if is our responsibility */ |
219 | printf("freeing flash_if..."); | | | |
220 | kmem_free(sc->flash_if, sizeof(*sc->flash_if)); | | 219 | kmem_free(sc->flash_if, sizeof(*sc->flash_if)); |
221 | printf("done!\n"); | | | |
222 | | | 220 | |
223 | return 0; | | 221 | return 0; |
224 | } | | 222 | } |
225 | | | 223 | |
226 | int | | 224 | int |
227 | flash_print(void *aux, const char *pnp) | | 225 | flash_print(void *aux, const char *pnp) |
228 | { | | 226 | { |
229 | struct flash_attach_args *arg; | | 227 | struct flash_attach_args *arg; |
230 | const char *type; | | 228 | const char *type; |
231 | | | 229 | |
232 | if (pnp != NULL) { | | 230 | if (pnp != NULL) { |
233 | arg = aux; | | 231 | arg = aux; |
234 | switch (arg->flash_if->type) { | | 232 | switch (arg->flash_if->type) { |