Deleted Added
full compact
bcm2835_gpio.c (244412) bcm2835_gpio.c (249449)
1/*-
2 * Copyright (c) 2012 Oleksandr Tymoshenko <gonzo@freebsd.org>
3 * Copyright (c) 2012 Luiz Otavio O Souza.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 12 unchanged lines hidden (view full) ---

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2012 Oleksandr Tymoshenko <gonzo@freebsd.org>
3 * Copyright (c) 2012 Luiz Otavio O Souza.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 12 unchanged lines hidden (view full) ---

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c 244412 2012-12-18 22:18:54Z gonzo $");
29__FBSDID("$FreeBSD: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c 249449 2013-04-13 21:21:13Z dim $");
30
31#include <sys/param.h>
32#include <sys/systm.h>
33#include <sys/bus.h>
34
35#include <sys/kernel.h>
36#include <sys/module.h>
37#include <sys/rman.h>

--- 342 unchanged lines hidden (view full) ---

380
381 if (i >= sc->sc_gpio_npins)
382 return (EINVAL);
383
384 /* We never touch on read-only/reserved pins. */
385 if (bcm_gpio_pin_is_ro(sc, pin))
386 return (EINVAL);
387
30
31#include <sys/param.h>
32#include <sys/systm.h>
33#include <sys/bus.h>
34
35#include <sys/kernel.h>
36#include <sys/module.h>
37#include <sys/rman.h>

--- 342 unchanged lines hidden (view full) ---

380
381 if (i >= sc->sc_gpio_npins)
382 return (EINVAL);
383
384 /* We never touch on read-only/reserved pins. */
385 if (bcm_gpio_pin_is_ro(sc, pin))
386 return (EINVAL);
387
388 /* Filter out unwanted flags. */
389 if ((flags &= sc->sc_gpio_pins[i].gp_caps) != flags)
388 /* Check for unwanted flags. */
389 if ((flags & sc->sc_gpio_pins[i].gp_caps) != flags)
390 return (EINVAL);
391
392 /* Can't mix input/output together. */
393 if ((flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) ==
394 (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT))
395 return (EINVAL);
396
397 /* Can't mix pull-up/pull-down together. */

--- 396 unchanged lines hidden ---
390 return (EINVAL);
391
392 /* Can't mix input/output together. */
393 if ((flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) ==
394 (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT))
395 return (EINVAL);
396
397 /* Can't mix pull-up/pull-down together. */

--- 396 unchanged lines hidden ---