The next patch reuses this code, so put it in its own function.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ide_set_irq(s->bus);
}
+static void ide_flush_cache(IDEState *s)
+{
+ if (s->bs) {
+ bdrv_aio_flush(s->bs, ide_flush_cb, s);
+ } else {
+ ide_flush_cb(s, 0);
+ }
+}
+
static inline void cpu_to_ube16(uint8_t *buf, int val)
{
buf[0] = val >> 8;
break;
case WIN_FLUSH_CACHE:
case WIN_FLUSH_CACHE_EXT:
- if (s->bs)
- bdrv_aio_flush(s->bs, ide_flush_cb, s);
- else
- ide_flush_cb(s, 0);
+ ide_flush_cache(s);
break;
case WIN_STANDBY:
case WIN_STANDBY2: