blob: ddc68a1e10afdd85c4f0f8f6f9c938aa30e0ec4f [file] [log] [blame]
Greg Kroah-Hartman989d42e2017-11-07 17:30:07 +01001// SPDX-License-Identifier: GPL-2.0
Rafael J. Wysockicaa73ea2013-12-29 15:25:48 +01002/*
3 * System bus type for containers.
4 *
5 * Copyright (C) 2013, Intel Corporation
6 * Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/container.h>
14
15#include "base.h"
16
17#define CONTAINER_BUS_NAME "container"
18
19static int trivial_online(struct device *dev)
20{
21 return 0;
22}
23
24static int container_offline(struct device *dev)
25{
26 struct container_dev *cdev = to_container_dev(dev);
27
28 return cdev->offline ? cdev->offline(cdev) : 0;
29}
30
31struct bus_type container_subsys = {
32 .name = CONTAINER_BUS_NAME,
33 .dev_name = CONTAINER_BUS_NAME,
34 .online = trivial_online,
35 .offline = container_offline,
36};
37
38void __init container_dev_init(void)
39{
40 int ret;
41
42 ret = subsys_system_register(&container_subsys, NULL);
43 if (ret)
44 pr_err("%s() failed: %d\n", __func__, ret);
45}