Lines Matching +full:ctrl +full:- +full:module
1 // SPDX-License-Identifier: GPL-2.0+
3 * Surface System Aggregator Module bus and device integration.
5 * Copyright (C) 2019-2021 Maximilian Luz <luzmaximilian@gmail.com>
23 sdev->uid.domain, sdev->uid.category, sdev->uid.target, in modalias_show()
24 sdev->uid.instance, sdev->uid.function); in modalias_show()
39 sdev->uid.domain, sdev->uid.category, in ssam_device_uevent()
40 sdev->uid.target, sdev->uid.instance, in ssam_device_uevent()
41 sdev->uid.function); in ssam_device_uevent()
48 ssam_controller_put(sdev->ctrl); in ssam_device_release()
61 * ssam_device_alloc() - Allocate and initialize a SSAM client device.
62 * @ctrl: The controller under which the device should be added.
73 struct ssam_device *ssam_device_alloc(struct ssam_controller *ctrl, in ssam_device_alloc() argument
82 device_initialize(&sdev->dev); in ssam_device_alloc()
83 sdev->dev.bus = &ssam_bus_type; in ssam_device_alloc()
84 sdev->dev.type = &ssam_device_type; in ssam_device_alloc()
85 sdev->dev.parent = ssam_controller_device(ctrl); in ssam_device_alloc()
86 sdev->ctrl = ssam_controller_get(ctrl); in ssam_device_alloc()
87 sdev->uid = uid; in ssam_device_alloc()
89 dev_set_name(&sdev->dev, "%02x:%02x:%02x:%02x:%02x", in ssam_device_alloc()
90 sdev->uid.domain, sdev->uid.category, sdev->uid.target, in ssam_device_alloc()
91 sdev->uid.instance, sdev->uid.function); in ssam_device_alloc()
98 * ssam_device_add() - Add a SSAM client device.
102 * controller. Thus, this function will fail with %-ENODEV if the controller
118 * set up device-links for this purpose.
130 * controller device, i.e. it ensures that the controller (sdev->ctrl) in ssam_device_add()
143 ssam_controller_statelock(sdev->ctrl); in ssam_device_add()
145 if (sdev->ctrl->state != SSAM_CONTROLLER_STARTED) { in ssam_device_add()
146 ssam_controller_stateunlock(sdev->ctrl); in ssam_device_add()
147 return -ENODEV; in ssam_device_add()
150 status = device_add(&sdev->dev); in ssam_device_add()
152 ssam_controller_stateunlock(sdev->ctrl); in ssam_device_add()
158 * ssam_device_remove() - Remove a SSAM client device.
165 device_unregister(&sdev->dev); in ssam_device_remove()
170 * ssam_device_id_compatible() - Check if a device ID matches a UID.
184 if (id->domain != uid.domain || id->category != uid.category) in ssam_device_id_compatible()
187 if ((id->match_flags & SSAM_MATCH_TARGET) && id->target != uid.target) in ssam_device_id_compatible()
190 if ((id->match_flags & SSAM_MATCH_INSTANCE) && id->instance != uid.instance) in ssam_device_id_compatible()
193 if ((id->match_flags & SSAM_MATCH_FUNCTION) && id->function != uid.function) in ssam_device_id_compatible()
200 * ssam_device_id_is_null() - Check if a device ID is null.
211 return id->match_flags == 0 && in ssam_device_id_is_null()
212 id->domain == 0 && in ssam_device_id_is_null()
213 id->category == 0 && in ssam_device_id_is_null()
214 id->target == 0 && in ssam_device_id_is_null()
215 id->instance == 0 && in ssam_device_id_is_null()
216 id->function == 0 && in ssam_device_id_is_null()
217 id->driver_data == 0; in ssam_device_id_is_null()
221 * ssam_device_id_match() - Find the matching ID table entry for the given UID.
242 * ssam_device_get_match() - Find and return the ID matching the device in the
261 sdrv = to_ssam_device_driver(dev->dev.driver); in ssam_device_get_match()
265 if (!sdrv->match_table) in ssam_device_get_match()
268 return ssam_device_id_match(sdrv->match_table, dev->uid); in ssam_device_get_match()
273 * ssam_device_get_match_data() - Find the ID matching the device in the
298 return (const void *)id->driver_data; in ssam_device_get_match_data()
310 return !!ssam_device_id_match(sdrv->match_table, sdev->uid); in ssam_bus_match()
315 return to_ssam_device_driver(dev->driver) in ssam_bus_probe()
316 ->probe(to_ssam_device(dev)); in ssam_bus_probe()
321 struct ssam_device_driver *sdrv = to_ssam_device_driver(dev->driver); in ssam_bus_remove()
323 if (sdrv->remove) in ssam_bus_remove()
324 sdrv->remove(to_ssam_device(dev)); in ssam_bus_remove()
336 * __ssam_device_driver_register() - Register a SSAM client device driver.
338 * @owner: The module owning the provided driver.
341 * to register a driver from inside its owning module.
344 struct module *owner) in __ssam_device_driver_register()
346 sdrv->driver.owner = owner; in __ssam_device_driver_register()
347 sdrv->driver.bus = &ssam_bus_type; in __ssam_device_driver_register()
350 sdrv->driver.probe_type = PROBE_PREFER_ASYNCHRONOUS; in __ssam_device_driver_register()
352 return driver_register(&sdrv->driver); in __ssam_device_driver_register()
357 * ssam_device_driver_unregister - Unregister a SSAM device driver.
362 driver_unregister(&sdrv->driver); in ssam_device_driver_unregister()
377 * ssam_controller_remove_clients() - Remove SSAM client devices registered as
379 * @ctrl: The controller to remove all direct clients for.
391 void ssam_controller_remove_clients(struct ssam_controller *ctrl) in ssam_controller_remove_clients() argument
395 dev = ssam_controller_device(ctrl); in ssam_controller_remove_clients()
400 * ssam_bus_register() - Register and set-up the SSAM client device bus.
408 * ssam_bus_unregister() - Unregister the SSAM client device bus.