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>
This commit is contained in:
parent
b0622de878
commit
74ab031ba1
|
@ -68,20 +68,16 @@ void pmh7_register_set_bit(int reg, int bit)
|
||||||
{
|
{
|
||||||
char val;
|
char val;
|
||||||
|
|
||||||
outb(reg, EC_LENOVO_PMH7_ADDR);
|
val = pmh7_register_read(reg);
|
||||||
val = inb(EC_LENOVO_PMH7_DATA);
|
pmh7_register_write(reg, val | (1 << bit));
|
||||||
outb(reg, EC_LENOVO_PMH7_ADDR);
|
|
||||||
outb(val | (1 << bit), EC_LENOVO_PMH7_DATA);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pmh7_register_clear_bit(int reg, int bit)
|
void pmh7_register_clear_bit(int reg, int bit)
|
||||||
{
|
{
|
||||||
char val;
|
char val;
|
||||||
|
|
||||||
outb(reg, EC_LENOVO_PMH7_ADDR);
|
val = pmh7_register_read(reg);
|
||||||
val = inb(EC_LENOVO_PMH7_DATA);
|
pmh7_register_write(reg, val & ~(1 << bit));
|
||||||
outb(reg, EC_LENOVO_PMH7_ADDR);
|
|
||||||
outb(val &= ~(1 << bit), EC_LENOVO_PMH7_DATA);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char pmh7_register_read(int reg)
|
char pmh7_register_read(int reg)
|
||||||
|
|
Loading…
Reference in New Issue