container.c 1004 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // SPDX-License-Identifier: GPL-2.0
  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. #include <linux/container.h>
  13. #include "base.h"
  14. #define CONTAINER_BUS_NAME "container"
  15. static int trivial_online(struct device *dev)
  16. {
  17. return 0;
  18. }
  19. static int container_offline(struct device *dev)
  20. {
  21. struct container_dev *cdev = to_container_dev(dev);
  22. return cdev->offline ? cdev->offline(cdev) : 0;
  23. }
  24. struct bus_type container_subsys = {
  25. .name = CONTAINER_BUS_NAME,
  26. .dev_name = CONTAINER_BUS_NAME,
  27. .online = trivial_online,
  28. .offline = container_offline,
  29. };
  30. void __init container_dev_init(void)
  31. {
  32. int ret;
  33. ret = subsys_system_register(&container_subsys, NULL);
  34. if (ret)
  35. pr_err("%s() failed: %d\n", __func__, ret);
  36. }