container.c 814 B

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