container.c 968 B

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