summaryrefslogtreecommitdiff
path: root/src/ec/lenovo
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2018-08-17 18:36:56 +0200
committerFelix Held <felix-coreboot@felixheld.de>2018-08-20 06:57:18 +0000
commit74ab031ba130bd5d655d7b6ac603013a079eb97d (patch)
tree86321d4a4039e1e444f0d1f6998e70271ae39a67 /src/ec/lenovo
parentb0622de8788c5152ec3e4dc8b48c3c51a6ad483e (diff)
downloadcoreboot-74ab031ba130bd5d655d7b6ac603013a079eb97d.tar.xz
ec/lenovo/pmh7: use read/write function in clear_bit/set_bit
Make the code simpler and improve readability. Change-Id: Ifa9308c32e4646c122254931b55fb83541a10a3c Signed-off-by: Alexander Couzens <lynxis@fe80.eu> Reviewed-on: https://review.coreboot.org/28195 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'src/ec/lenovo')
-rw-r--r--src/ec/lenovo/pmh7/pmh7.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/ec/lenovo/pmh7/pmh7.c b/src/ec/lenovo/pmh7/pmh7.c
index c9756795a0..b160fd0bc1 100644
--- a/src/ec/lenovo/pmh7/pmh7.c
+++ b/src/ec/lenovo/pmh7/pmh7.c
@@ -68,20 +68,16 @@ void pmh7_register_set_bit(int reg, int bit)
{
char val;
- outb(reg, EC_LENOVO_PMH7_ADDR);
- val = inb(EC_LENOVO_PMH7_DATA);
- outb(reg, EC_LENOVO_PMH7_ADDR);
- outb(val | (1 << bit), EC_LENOVO_PMH7_DATA);
+ val = pmh7_register_read(reg);
+ pmh7_register_write(reg, val | (1 << bit));
}
void pmh7_register_clear_bit(int reg, int bit)
{
char val;
- outb(reg, EC_LENOVO_PMH7_ADDR);
- val = inb(EC_LENOVO_PMH7_DATA);
- outb(reg, EC_LENOVO_PMH7_ADDR);
- outb(val &= ~(1 << bit), EC_LENOVO_PMH7_DATA);
+ val = pmh7_register_read(reg);
+ pmh7_register_write(reg, val & ~(1 << bit));
}
char pmh7_register_read(int reg)