Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F139364755
D6222.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D6222.diff
View Options
Index: head/sys/mips/mediatek/mtk_gpio_v1.c
===================================================================
--- head/sys/mips/mediatek/mtk_gpio_v1.c
+++ head/sys/mips/mediatek/mtk_gpio_v1.c
@@ -290,7 +290,7 @@
else
sc->num_pins = MTK_GPIO_PINS;
- for (i = 0; i < num_pins; i++) {
+ for (i = 0; i < sc->num_pins; i++) {
sc->pins[i].pin_caps |= GPIO_PIN_INPUT | GPIO_PIN_OUTPUT |
GPIO_PIN_INVIN | GPIO_PIN_INVOUT;
sc->pins[i].intr_polarity = INTR_POLARITY_HIGH;
@@ -444,18 +444,12 @@
return (EINVAL);
MTK_GPIO_LOCK(sc);
- if(!(sc->pins[pin].pin_flags & GPIO_PIN_OUTPUT)) {
- ret = EINVAL;
- goto out;
- }
-
if (value)
MTK_WRITE_4(sc, GPIO_PIOSET, (1u << pin));
else
MTK_WRITE_4(sc, GPIO_PIORESET, (1u << pin));
-
-out:
MTK_GPIO_UNLOCK(sc);
+
return (ret);
}
@@ -473,15 +467,10 @@
return (EINVAL);
MTK_GPIO_LOCK(sc);
- if(!(sc->pins[pin].pin_flags & GPIO_PIN_INPUT)) {
- ret = EINVAL;
- goto out;
- }
data = MTK_READ_4(sc, GPIO_PIODATA);
*val = (data & (1u << pin)) ? 1 : 0;
-
-out:
MTK_GPIO_UNLOCK(sc);
+
return (ret);
}
@@ -491,12 +480,12 @@
struct mtk_gpio_softc *sc;
int ret;
- if (pin >= sc->num_pins)
- return (EINVAL);
-
sc = device_get_softc(dev);
ret = 0;
+ if (pin >= sc->num_pins)
+ return (EINVAL);
+
MTK_GPIO_LOCK(sc);
if (!(sc->pins[pin].pin_flags & GPIO_PIN_OUTPUT)) {
ret = EINVAL;
Index: head/sys/mips/mediatek/mtk_gpio_v2.c
===================================================================
--- head/sys/mips/mediatek/mtk_gpio_v2.c
+++ head/sys/mips/mediatek/mtk_gpio_v2.c
@@ -428,23 +428,17 @@
struct mtk_gpio_softc *sc;
int ret;
- if (pin >= sc->num_pins)
- return (EINVAL);
-
sc = device_get_softc(dev);
ret = 0;
+ if (pin >= sc->num_pins)
+ return (EINVAL);
+
MTK_GPIO_LOCK(sc);
- if (!(sc->pins[pin].pin_flags & GPIO_PIN_OUTPUT)) {
- ret = EINVAL;
- goto out;
- }
if (value)
MTK_WRITE_4(sc, GPIO_PIOSET(sc), (1u << pin));
else
MTK_WRITE_4(sc, GPIO_PIORESET(sc), (1u << pin));
-
-out:
MTK_GPIO_UNLOCK(sc);
return (ret);
@@ -457,22 +451,17 @@
uint32_t data;
int ret;
- if (pin >= sc->num_pins)
- return (EINVAL);
-
sc = device_get_softc(dev);
ret = 0;
+ if (pin >= sc->num_pins)
+ return (EINVAL);
+
MTK_GPIO_LOCK(sc);
- if (!(sc->pins[pin].pin_flags & GPIO_PIN_INPUT)) {
- ret = EINVAL;
- goto out;
- }
data = MTK_READ_4(sc, GPIO_PIODATA(sc));
*val = (data & (1u << pin)) ? 1 : 0;
-
-out:
MTK_GPIO_UNLOCK(sc);
+
return (ret);
}
@@ -483,12 +472,12 @@
uint32_t val;
int ret;
- if (pin >= sc->num_pins)
- return (EINVAL);
-
sc = device_get_softc(dev);
ret = 0;
+ if (pin >= sc->num_pins)
+ return (EINVAL);
+
MTK_GPIO_LOCK(sc);
if(!(sc->pins[pin].pin_flags & GPIO_PIN_OUTPUT)) {
ret = EINVAL;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 12, 7:05 AM (2 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26891347
Default Alt Text
D6222.diff (2 KB)
Attached To
Mode
D6222: mtk_gpio fixes
Attached
Detach File
Event Timeline
Log In to Comment