Deleted Added
full compact
gpioiic.c (270236) gpioiic.c (278783)
1/*-
2 * Copyright (c) 2009 Oleksandr Tymoshenko <gonzo@freebsd.org>
3 * Copyright (c) 2010 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) 2009 Oleksandr Tymoshenko <gonzo@freebsd.org>
3 * Copyright (c) 2010 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: stable/10/sys/dev/gpio/gpioiic.c 270236 2014-08-20 17:39:53Z loos $");
29__FBSDID("$FreeBSD: stable/10/sys/dev/gpio/gpioiic.c 278783 2015-02-14 20:50:38Z loos $");
30
31#include "opt_platform.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/bus.h>
36#include <sys/conf.h>
37#include <sys/kernel.h>

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

149 GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin,
150 GPIO_PIN_INPUT);
151}
152
153static int
154gpioiic_callback(device_t dev, int index, caddr_t data)
155{
156 struct gpioiic_softc *sc = device_get_softc(dev);
30
31#include "opt_platform.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/bus.h>
36#include <sys/conf.h>
37#include <sys/kernel.h>

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

149 GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin,
150 GPIO_PIN_INPUT);
151}
152
153static int
154gpioiic_callback(device_t dev, int index, caddr_t data)
155{
156 struct gpioiic_softc *sc = device_get_softc(dev);
157 int error = 0;
157 int error, how;
158
158
159 how = GPIOBUS_DONTWAIT;
160 if (data != NULL && (int)*data == IIC_WAIT)
161 how = GPIOBUS_WAIT;
162 error = 0;
159 switch (index) {
160 case IIC_REQUEST_BUS:
163 switch (index) {
164 case IIC_REQUEST_BUS:
161 GPIOBUS_LOCK_BUS(sc->sc_busdev);
162 GPIOBUS_ACQUIRE_BUS(sc->sc_busdev, sc->sc_dev);
163 GPIOBUS_UNLOCK_BUS(sc->sc_busdev);
165 error = GPIOBUS_ACQUIRE_BUS(sc->sc_busdev, sc->sc_dev, how);
164 break;
165 case IIC_RELEASE_BUS:
166 break;
167 case IIC_RELEASE_BUS:
166 GPIOBUS_LOCK_BUS(sc->sc_busdev);
167 GPIOBUS_RELEASE_BUS(sc->sc_busdev, sc->sc_dev);
168 GPIOBUS_RELEASE_BUS(sc->sc_busdev, sc->sc_dev);
168 GPIOBUS_UNLOCK_BUS(sc->sc_busdev);
169 break;
170 default:
171 error = EINVAL;
172 }
173
174 return (error);
175}
176

--- 111 unchanged lines hidden ---
169 break;
170 default:
171 error = EINVAL;
172 }
173
174 return (error);
175}
176

--- 111 unchanged lines hidden ---