Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/sunxi sunxi_gpio_release: hold lock around call...



details:   https://anonhg.NetBSD.org/src/rev/9e4159779141
branches:  trunk
changeset: 319485:9e4159779141
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu May 31 20:52:53 2018 +0000

description:
sunxi_gpio_release: hold lock around call to sunxi_gpio_ctl

diffstat:

 sys/arch/arm/sunxi/sunxi_gpio.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r 6ed6b7d46125 -r 9e4159779141 sys/arch/arm/sunxi/sunxi_gpio.c
--- a/sys/arch/arm/sunxi/sunxi_gpio.c   Thu May 31 15:41:11 2018 +0000
+++ b/sys/arch/arm/sunxi/sunxi_gpio.c   Thu May 31 20:52:53 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_gpio.c,v 1.20 2018/04/03 16:01:25 bouyer Exp $ */
+/* $NetBSD: sunxi_gpio.c,v 1.21 2018/05/31 20:52:53 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_soc.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_gpio.c,v 1.20 2018/04/03 16:01:25 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_gpio.c,v 1.21 2018/05/31 20:52:53 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -328,9 +328,12 @@
 static void
 sunxi_gpio_release(device_t dev, void *priv)
 {
+       struct sunxi_gpio_softc * const sc = device_private(dev);
        struct sunxi_gpio_pin *pin = priv;
 
+       mutex_enter(&sc->sc_lock);
        sunxi_gpio_ctl(pin->pin_sc, pin->pin_def, GPIO_PIN_INPUT);
+       mutex_exit(&sc->sc_lock);
 
        kmem_free(pin, sizeof(*pin));
 }



Home | Main Index | Thread Index | Old Index