Commit bd328acd authored by Giel van Schijndel's avatar Giel van Schijndel Committed by Jean Delvare

hwmon: (f71882fg) Code cleanup

Some code cleanup: properly use previously defined functions, rather
than duplicating their code.
Signed-off-by: default avatarGiel van Schijndel <me@mortis.eu>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
parent e8a4eaca
...@@ -856,10 +856,8 @@ static inline int superio_inb(int base, int reg) ...@@ -856,10 +856,8 @@ static inline int superio_inb(int base, int reg)
static int superio_inw(int base, int reg) static int superio_inw(int base, int reg)
{ {
int val; int val;
outb(reg++, base); val = superio_inb(base, reg) << 8;
val = inb(base + 1) << 8; val |= superio_inb(base, reg + 1);
outb(reg, base);
val |= inb(base + 1);
return val; return val;
} }
...@@ -905,10 +903,8 @@ static u16 f71882fg_read16(struct f71882fg_data *data, u8 reg) ...@@ -905,10 +903,8 @@ static u16 f71882fg_read16(struct f71882fg_data *data, u8 reg)
{ {
u16 val; u16 val;
outb(reg++, data->addr + ADDR_REG_OFFSET); val = f71882fg_read8(data, reg) << 8;
val = inb(data->addr + DATA_REG_OFFSET) << 8; val |= f71882fg_read8(data, reg + 1);
outb(reg, data->addr + ADDR_REG_OFFSET);
val |= inb(data->addr + DATA_REG_OFFSET);
return val; return val;
} }
...@@ -921,10 +917,8 @@ static void f71882fg_write8(struct f71882fg_data *data, u8 reg, u8 val) ...@@ -921,10 +917,8 @@ static void f71882fg_write8(struct f71882fg_data *data, u8 reg, u8 val)
static void f71882fg_write16(struct f71882fg_data *data, u8 reg, u16 val) static void f71882fg_write16(struct f71882fg_data *data, u8 reg, u16 val)
{ {
outb(reg++, data->addr + ADDR_REG_OFFSET); f71882fg_write8(data, reg, val >> 8);
outb(val >> 8, data->addr + DATA_REG_OFFSET); f71882fg_write8(data, reg + 1, val & 0xff);
outb(reg, data->addr + ADDR_REG_OFFSET);
outb(val & 255, data->addr + DATA_REG_OFFSET);
} }
static u16 f71882fg_read_temp(struct f71882fg_data *data, int nr) static u16 f71882fg_read_temp(struct f71882fg_data *data, int nr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment