]> Git Repo - qemu.git/blame - hw/core/hotplug.c
Merge remote-tracking branch 'remotes/agraf/tags/signed-ppc-for-upstream' into staging
[qemu.git] / hw / core / hotplug.c
CommitLineData
9f117d41
IM
1/*
2 * Hotplug handler interface.
3 *
4 * Copyright (c) 2014 Red Hat Inc.
5 *
6 * Authors:
7 * Igor Mammedov <[email protected]>,
8 *
9 * This work is licensed under the terms of the GNU GPL, version 2 or later.
10 * See the COPYING file in the top-level directory.
11 */
12#include "hw/hotplug.h"
13#include "qemu/module.h"
14
15void hotplug_handler_plug(HotplugHandler *plug_handler,
16 DeviceState *plugged_dev,
17 Error **errp)
18{
19 HotplugHandlerClass *hdc = HOTPLUG_HANDLER_GET_CLASS(plug_handler);
20
21 if (hdc->plug) {
22 hdc->plug(plug_handler, plugged_dev, errp);
23 }
24}
25
14d5a28f
IM
26void hotplug_handler_unplug_request(HotplugHandler *plug_handler,
27 DeviceState *plugged_dev,
28 Error **errp)
9f117d41
IM
29{
30 HotplugHandlerClass *hdc = HOTPLUG_HANDLER_GET_CLASS(plug_handler);
31
14d5a28f
IM
32 if (hdc->unplug_request) {
33 hdc->unplug_request(plug_handler, plugged_dev, errp);
9f117d41
IM
34 }
35}
36
181a2c63
IM
37void hotplug_handler_unplug(HotplugHandler *plug_handler,
38 DeviceState *plugged_dev,
39 Error **errp)
40{
41 HotplugHandlerClass *hdc = HOTPLUG_HANDLER_GET_CLASS(plug_handler);
42
43 if (hdc->unplug) {
44 hdc->unplug(plug_handler, plugged_dev, errp);
45 }
46}
47
9f117d41
IM
48static const TypeInfo hotplug_handler_info = {
49 .name = TYPE_HOTPLUG_HANDLER,
50 .parent = TYPE_INTERFACE,
51 .class_size = sizeof(HotplugHandlerClass),
52};
53
54static void hotplug_handler_register_types(void)
55{
56 type_register_static(&hotplug_handler_info);
57}
58
59type_init(hotplug_handler_register_types)
This page took 0.073194 seconds and 4 git commands to generate.