Lines Matching full:controller

21 	struct peci_controller *controller = to_peci_controller(dev);  in peci_controller_dev_release()  local
23 mutex_destroy(&controller->bus_lock); in peci_controller_dev_release()
24 ida_free(&peci_controller_ida, controller->id); in peci_controller_dev_release()
25 kfree(controller); in peci_controller_dev_release()
32 int peci_controller_scan_devices(struct peci_controller *controller) in peci_controller_scan_devices() argument
38 ret = peci_device_create(controller, addr); in peci_controller_scan_devices()
49 struct peci_controller *controller; in peci_controller_alloc() local
55 controller = kzalloc(sizeof(*controller), GFP_KERNEL); in peci_controller_alloc()
56 if (!controller) in peci_controller_alloc()
62 controller->id = ret; in peci_controller_alloc()
64 controller->ops = ops; in peci_controller_alloc()
66 controller->dev.parent = dev; in peci_controller_alloc()
67 controller->dev.bus = &peci_bus_type; in peci_controller_alloc()
68 controller->dev.type = &peci_controller_type; in peci_controller_alloc()
70 device_initialize(&controller->dev); in peci_controller_alloc()
72 mutex_init(&controller->bus_lock); in peci_controller_alloc()
74 return controller; in peci_controller_alloc()
77 kfree(controller); in peci_controller_alloc()
90 struct peci_controller *controller = _controller; in unregister_controller() local
96 device_for_each_child_reverse(&controller->dev, NULL, unregister_child); in unregister_controller()
98 device_unregister(&controller->dev); in unregister_controller()
100 fwnode_handle_put(controller->dev.fwnode); in unregister_controller()
102 pm_runtime_disable(&controller->dev); in unregister_controller()
106 * devm_peci_controller_add() - add PECI controller
108 * @ops: pointer to controller specific methods
113 * Return: Pointer to the newly allocated controller or ERR_PTR() in case of failure.
118 struct peci_controller *controller; in devm_peci_controller_add() local
121 controller = peci_controller_alloc(dev, ops); in devm_peci_controller_add()
122 if (IS_ERR(controller)) in devm_peci_controller_add()
123 return controller; in devm_peci_controller_add()
125 ret = dev_set_name(&controller->dev, "peci-%d", controller->id); in devm_peci_controller_add()
129 pm_runtime_no_callbacks(&controller->dev); in devm_peci_controller_add()
130 pm_suspend_ignore_children(&controller->dev, true); in devm_peci_controller_add()
131 pm_runtime_enable(&controller->dev); in devm_peci_controller_add()
133 device_set_node(&controller->dev, fwnode_handle_get(dev_fwnode(dev))); in devm_peci_controller_add()
135 ret = device_add(&controller->dev); in devm_peci_controller_add()
139 ret = devm_add_action_or_reset(dev, unregister_controller, controller); in devm_peci_controller_add()
145 * controller itself. in devm_peci_controller_add()
147 peci_controller_scan_devices(controller); in devm_peci_controller_add()
149 return controller; in devm_peci_controller_add()
152 fwnode_handle_put(controller->dev.fwnode); in devm_peci_controller_add()
154 pm_runtime_disable(&controller->dev); in devm_peci_controller_add()
157 put_device(&controller->dev); in devm_peci_controller_add()