vt82c686: Simplify by returning earlier
By returning earlier we can remove the 'can_write' boolean variable. Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Message-Id: <15b2968fd300a12d06b42368d084f6f80d3c3be5.1610223397.git.balaton@eik.bme.hu> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> [PMD: Split original patch in 5, this is part 3/5] Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
This commit is contained in:
parent
2b98dca957
commit
b7741b7742
|
@ -258,7 +258,6 @@ static void superio_cfg_write(void *opaque, hwaddr addr, uint64_t data,
|
||||||
{
|
{
|
||||||
SuperIOConfig *sc = opaque;
|
SuperIOConfig *sc = opaque;
|
||||||
uint8_t idx = sc->regs[0];
|
uint8_t idx = sc->regs[0];
|
||||||
bool can_write = true;
|
|
||||||
|
|
||||||
if (addr == 0x3f0) { /* config index register */
|
if (addr == 0x3f0) { /* config index register */
|
||||||
idx = data & 0xff;
|
idx = data & 0xff;
|
||||||
|
@ -276,16 +275,14 @@ static void superio_cfg_write(void *opaque, hwaddr addr, uint64_t data,
|
||||||
case 0xf7:
|
case 0xf7:
|
||||||
case 0xf9 ... 0xfb:
|
case 0xf9 ... 0xfb:
|
||||||
case 0xfd ... 0xff:
|
case 0xfd ... 0xff:
|
||||||
can_write = false;
|
/* ignore write to read only registers */
|
||||||
break;
|
return;
|
||||||
/* case 0xe6 ... 0xe8: Should set base port of parallel and serial */
|
/* case 0xe6 ... 0xe8: Should set base port of parallel and serial */
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (can_write) {
|
|
||||||
sc->regs[idx] = data & 0xff;
|
sc->regs[idx] = data & 0xff;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static uint64_t superio_cfg_read(void *opaque, hwaddr addr, unsigned size)
|
static uint64_t superio_cfg_read(void *opaque, hwaddr addr, unsigned size)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue