Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Dec 2016 02:23:15 +0000 (UTC)
From:      Luiz Otavio O Souza <loos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r310887 - head/sys/dev/rccgpio
Message-ID:  <201612310223.uBV2NF25029469@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: loos
Date: Sat Dec 31 02:23:15 2016
New Revision: 310887
URL: https://svnweb.freebsd.org/changeset/base/310887

Log:
  Fix rcc_gpio_modify_bits().  Obviously (1 << 0) is not the same as 0.
  
  Pointy hat to:	loos
  MFC after:	3 days

Modified:
  head/sys/dev/rccgpio/rccgpio.c

Modified: head/sys/dev/rccgpio/rccgpio.c
==============================================================================
--- head/sys/dev/rccgpio/rccgpio.c	Sat Dec 31 02:18:08 2016	(r310886)
+++ head/sys/dev/rccgpio/rccgpio.c	Sat Dec 31 02:23:15 2016	(r310887)
@@ -57,12 +57,12 @@ struct rcc_gpio_pin {
 };
 
 static struct rcc_gpio_pin rcc_pins[] = {
-	{ .pin = 11, .name = "reset switch", .caps = GPIO_PIN_INPUT },
-	{ .pin = 15, .name = "red LED", .caps = GPIO_PIN_OUTPUT },
-	{ .pin = 17, .name = "green LED", .caps = GPIO_PIN_OUTPUT },
+	{ .pin = (1 << 11), .name = "reset switch", .caps = GPIO_PIN_INPUT },
+	{ .pin = (1 << 15), .name = "red LED", .caps = GPIO_PIN_OUTPUT },
+	{ .pin = (1 << 17), .name = "green LED", .caps = GPIO_PIN_OUTPUT },
 #if 0
-	{ .pin = 16, .name = "HD1 LED", .caps = GPIO_PIN_OUTPUT },
-	{ .pin = 18, .name = "HD2 LED", .caps = GPIO_PIN_OUTPUT },
+	{ .pin = (1 << 16), .name = "HD1 LED", .caps = GPIO_PIN_OUTPUT },
+	{ .pin = (1 << 18), .name = "HD2 LED", .caps = GPIO_PIN_OUTPUT },
 #endif
 };
 
@@ -87,14 +87,14 @@ struct rcc_gpio_softc {
 
 static void
 rcc_gpio_modify_bits(struct rcc_gpio_softc *sc, uint32_t reg, uint32_t mask,
-	uint32_t bit)
+	uint32_t writebits)
 {
 	uint32_t value;
 
 	RCC_GPIO_LOCK(sc);
 	value = RCC_READ(sc, reg);
-	value &= ~(1 << mask);
-	value |= (1 << bit);
+	value &= ~mask;
+	value |= writebits;
 	RCC_WRITE(sc, reg, value);
 	RCC_GPIO_UNLOCK(sc);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612310223.uBV2NF25029469>