| @@ -1,35 +1,35 @@ | | | @@ -1,35 +1,35 @@ |
1 | /* $NetBSD: gpio.c,v 1.33 2010/04/25 11:23:34 ad Exp $ */ | | 1 | /* $NetBSD: gpio.c,v 1.34 2011/06/09 14:46:06 joerg Exp $ */ |
2 | /* $OpenBSD: gpio.c,v 1.6 2006/01/14 12:33:49 grange Exp $ */ | | 2 | /* $OpenBSD: gpio.c,v 1.6 2006/01/14 12:33:49 grange Exp $ */ |
3 | | | 3 | |
4 | /* | | 4 | /* |
5 | * Copyright (c) 2008, 2009, 2010 Marc Balmer <marc@msys.ch> | | 5 | * Copyright (c) 2008, 2009, 2010 Marc Balmer <marc@msys.ch> |
6 | * Copyright (c) 2004, 2006 Alexander Yurchenko <grange@openbsd.org> | | 6 | * Copyright (c) 2004, 2006 Alexander Yurchenko <grange@openbsd.org> |
7 | * | | 7 | * |
8 | * Permission to use, copy, modify, and distribute this software for any | | 8 | * Permission to use, copy, modify, and distribute this software for any |
9 | * purpose with or without fee is hereby granted, provided that the above | | 9 | * purpose with or without fee is hereby granted, provided that the above |
10 | * copyright notice and this permission notice appear in all copies. | | 10 | * copyright notice and this permission notice appear in all copies. |
11 | * | | 11 | * |
12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | | 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
13 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | | 13 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
14 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | | 14 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
15 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | | 15 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
16 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | | 16 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
17 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | | 17 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
18 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | | 18 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
19 | */ | | 19 | */ |
20 | | | 20 | |
21 | #include <sys/cdefs.h> | | 21 | #include <sys/cdefs.h> |
22 | __KERNEL_RCSID(0, "$NetBSD: gpio.c,v 1.33 2010/04/25 11:23:34 ad Exp $"); | | 22 | __KERNEL_RCSID(0, "$NetBSD: gpio.c,v 1.34 2011/06/09 14:46:06 joerg Exp $"); |
23 | | | 23 | |
24 | /* | | 24 | /* |
25 | * General Purpose Input/Output framework. | | 25 | * General Purpose Input/Output framework. |
26 | */ | | 26 | */ |
27 | | | 27 | |
28 | #include <sys/param.h> | | 28 | #include <sys/param.h> |
29 | #include <sys/systm.h> | | 29 | #include <sys/systm.h> |
30 | #include <sys/conf.h> | | 30 | #include <sys/conf.h> |
31 | #include <sys/device.h> | | 31 | #include <sys/device.h> |
32 | #include <sys/fcntl.h> | | 32 | #include <sys/fcntl.h> |
33 | #include <sys/ioctl.h> | | 33 | #include <sys/ioctl.h> |
34 | #include <sys/gpio.h> | | 34 | #include <sys/gpio.h> |
35 | #include <sys/vnode.h> | | 35 | #include <sys/vnode.h> |
| @@ -352,27 +352,27 @@ gpioopen(dev_t dev, int flag, int mode, | | | @@ -352,27 +352,27 @@ gpioopen(dev_t dev, int flag, int mode, |
352 | | | 352 | |
353 | sc->sc_opened = 1; | | 353 | sc->sc_opened = 1; |
354 | | | 354 | |
355 | return 0; | | 355 | return 0; |
356 | } | | 356 | } |
357 | | | 357 | |
358 | int | | 358 | int |
359 | gpioclose(dev_t dev, int flag, int mode, struct lwp *l) | | 359 | gpioclose(dev_t dev, int flag, int mode, struct lwp *l) |
360 | { | | 360 | { |
361 | struct gpio_softc *sc; | | 361 | struct gpio_softc *sc; |
362 | | | 362 | |
363 | sc = device_lookup_private(&gpio_cd, minor(dev)); | | 363 | sc = device_lookup_private(&gpio_cd, minor(dev)); |
364 | DPRINTF(("%s: closing\n", device_xname(sc->sc_dev))); | | 364 | DPRINTF(("%s: closing\n", device_xname(sc->sc_dev))); |
365 | gpiobus_close(sc->sc_gc, sc->sc_dev); | | 365 | (void)gpiobus_close(sc->sc_gc, sc->sc_dev); |
366 | sc->sc_opened = 0; | | 366 | sc->sc_opened = 0; |
367 | | | 367 | |
368 | return 0; | | 368 | return 0; |
369 | } | | 369 | } |
370 | | | 370 | |
371 | int | | 371 | int |
372 | gpio_pinbyname(struct gpio_softc *sc, char *gp_name) | | 372 | gpio_pinbyname(struct gpio_softc *sc, char *gp_name) |
373 | { | | 373 | { |
374 | struct gpio_name *nm; | | 374 | struct gpio_name *nm; |
375 | | | 375 | |
376 | LIST_FOREACH(nm, &sc->sc_names, gp_next) | | 376 | LIST_FOREACH(nm, &sc->sc_names, gp_next) |
377 | if (!strcmp(nm->gp_name, gp_name)) | | 377 | if (!strcmp(nm->gp_name, gp_name)) |
378 | return nm->gp_pin; | | 378 | return nm->gp_pin; |