Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/samsung Use __BIT/__SHIFTOUT some more. NFCI.



details:   https://anonhg.NetBSD.org/src/rev/7f6f1cb0c4ad
branches:  trunk
changeset: 970310:7f6f1cb0c4ad
user:      skrll <skrll%NetBSD.org@localhost>
date:      Fri Mar 20 06:33:00 2020 +0000

description:
Use __BIT/__SHIFTOUT some more.  NFCI.

diffstat:

 sys/arch/arm/samsung/exynos_gpio.c |  22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diffs (55 lines):

diff -r 520851ab607b -r 7f6f1cb0c4ad sys/arch/arm/samsung/exynos_gpio.c
--- a/sys/arch/arm/samsung/exynos_gpio.c        Fri Mar 20 06:23:51 2020 +0000
+++ b/sys/arch/arm/samsung/exynos_gpio.c        Fri Mar 20 06:33:00 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exynos_gpio.c,v 1.26 2020/03/17 21:24:30 skrll Exp $ */
+/*     $NetBSD: exynos_gpio.c,v 1.27 2020/03/20 06:33:00 skrll Exp $ */
 
 /*-
 * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.26 2020/03/17 21:24:30 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.27 2020/03/20 06:33:00 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -179,11 +179,13 @@
 exynos_gpio_pin_read(void *cookie, int pin)
 {
        struct exynos_gpio_bank * const bank = cookie;
+       uint8_t val;
 
        KASSERT(pin < bank->bank_bits);
-       return (bus_space_read_1(bank->bank_sc->sc_bst,
-                                bank->bank_sc->sc_bsh,
-               EXYNOS_GPIO_DAT) >> pin) & 1;
+       val = bus_space_read_1(bank->bank_sc->sc_bst, bank->bank_sc->sc_bsh,
+           EXYNOS_GPIO_DAT);
+
+       return __SHIFTOUT(val, __BIT(pin));
 }
 
 static void
@@ -193,15 +195,13 @@
        int val;
 
        KASSERT(pin < bank->bank_bits);
-       val = bus_space_read_1(bank->bank_sc->sc_bst,
-                              bank->bank_sc->sc_bsh,
-                              EXYNOS_GPIO_DAT);
+       val = bus_space_read_1(bank->bank_sc->sc_bst, bank->bank_sc->sc_bsh,
+           EXYNOS_GPIO_DAT);
        val &= ~__BIT(pin);
        if (value)
                val |= __BIT(pin);
-       bus_space_write_1(bank->bank_sc->sc_bst,
-                         bank->bank_sc->sc_bsh,
-               EXYNOS_GPIO_DAT, val);
+       bus_space_write_1(bank->bank_sc->sc_bst, bank->bank_sc->sc_bsh,
+           EXYNOS_GPIO_DAT, val);
 }
 
 static void



Home | Main Index | Thread Index | Old Index