Greg Kroah-Hartman | 989d42e | 2017-11-07 17:30:07 +0100 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Rafael J. Wysocki | caa73ea | 2013-12-29 15:25:48 +0100 | [diff] [blame] | 2 | /* |
| 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 | |
| 19 | static int trivial_online(struct device *dev) |
| 20 | { |
| 21 | return 0; |
| 22 | } |
| 23 | |
| 24 | static 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 | |
| 31 | struct 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 | |
| 38 | void __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 | } |