[coreboot-gerrit] Change in coreboot[master]: ec/pmh7: use read/write function in clear_bit/set_bit

Alexander Couzens (Code Review) gerrit at coreboot.org
Fri Aug 17 18:49:17 CEST 2018


Alexander Couzens has uploaded this change for review. ( https://review.coreboot.org/28195


Change subject: ec/pmh7: use read/write function in clear_bit/set_bit
......................................................................

ec/pmh7: use read/write function in clear_bit/set_bit

Make the code simpler and improve readability.

Change-Id: Ifa9308c32e4646c122254931b55fb83541a10a3c
---
M src/ec/lenovo/pmh7/pmh7.c
1 file changed, 4 insertions(+), 8 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/28195/1

diff --git a/src/ec/lenovo/pmh7/pmh7.c b/src/ec/lenovo/pmh7/pmh7.c
index c975679..b160fd0 100644
--- a/src/ec/lenovo/pmh7/pmh7.c
+++ b/src/ec/lenovo/pmh7/pmh7.c
@@ -68,20 +68,16 @@
 {
 	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)

-- 
To view, visit https://review.coreboot.org/28195
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifa9308c32e4646c122254931b55fb83541a10a3c
Gerrit-Change-Number: 28195
Gerrit-PatchSet: 1
Gerrit-Owner: Alexander Couzens <lynxis at fe80.eu>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180817/2721c588/attachment.html>


More information about the coreboot-gerrit mailing list