Skip to content

Commit

Permalink
char: update the mux handlers in class callback
Browse files Browse the repository at this point in the history
Instead of handling mux chardev in a special way in
qemu_chr_fe_set_handlers(), we may use the chr_update_read_handler
class callback instead.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20190206174328.9736-2-marcandre.lureau@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
elmarco committed Feb 13, 2019
1 parent 129263c commit 3d9e232
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
4 changes: 0 additions & 4 deletions chardev/char-fe.c
Expand Up @@ -290,10 +290,6 @@ void qemu_chr_fe_set_handlers_full(CharBackend *b,
qemu_chr_be_event(s, CHR_EVENT_OPENED);
}
}

if (CHARDEV_IS_MUX(s)) {
mux_chr_set_handlers(s, context);
}
}

void qemu_chr_fe_set_handlers(CharBackend *b,
Expand Down
5 changes: 3 additions & 2 deletions chardev/char-mux.c
Expand Up @@ -278,7 +278,7 @@ static void char_mux_finalize(Object *obj)
qemu_chr_fe_deinit(&d->chr, false);
}

void mux_chr_set_handlers(Chardev *chr, GMainContext *context)
static void mux_chr_update_read_handlers(Chardev *chr)
{
MuxChardev *d = MUX_CHARDEV(chr);

Expand All @@ -289,7 +289,7 @@ void mux_chr_set_handlers(Chardev *chr, GMainContext *context)
mux_chr_event,
NULL,
chr,
context, true, false);
chr->gcontext, true, false);
}

void mux_set_focus(Chardev *chr, int focus)
Expand Down Expand Up @@ -383,6 +383,7 @@ static void char_mux_class_init(ObjectClass *oc, void *data)
cc->chr_add_watch = mux_chr_add_watch;
cc->chr_be_event = mux_chr_be_event;
cc->chr_machine_done = open_muxes;
cc->chr_update_read_handler = mux_chr_update_read_handlers;
}

static const TypeInfo char_mux_type_info = {
Expand Down
1 change: 0 additions & 1 deletion include/chardev/char-mux.h
Expand Up @@ -55,7 +55,6 @@ typedef struct MuxChardev {
#define CHARDEV_IS_MUX(chr) \
object_dynamic_cast(OBJECT(chr), TYPE_CHARDEV_MUX)

void mux_chr_set_handlers(Chardev *chr, GMainContext *context);
void mux_set_focus(Chardev *chr, int focus);
void mux_chr_send_all_event(Chardev *chr, int event);

Expand Down

0 comments on commit 3d9e232

Please sign in to comment.