Lines Matching refs:scmi_dev
210 scmi_dev_match_id(struct scmi_device *scmi_dev, const struct scmi_driver *scmi_drv) in scmi_dev_match_id() argument
218 if (id->protocol_id == scmi_dev->protocol_id) { in scmi_dev_match_id()
221 else if (!strcmp(id->name, scmi_dev->name)) in scmi_dev_match_id()
231 struct scmi_device *scmi_dev = to_scmi_dev(dev); in scmi_dev_match() local
234 id = scmi_dev_match_id(scmi_dev, scmi_drv); in scmi_dev_match()
269 struct scmi_device *scmi_dev = to_scmi_dev(dev); in scmi_dev_probe() local
271 if (!scmi_dev->handle) in scmi_dev_probe()
274 return scmi_drv->probe(scmi_dev); in scmi_dev_probe()
280 struct scmi_device *scmi_dev = to_scmi_dev(dev); in scmi_dev_remove() local
283 scmi_drv->remove(scmi_dev); in scmi_dev_remove()
328 struct scmi_device *scmi_dev = to_scmi_dev(dev); in scmi_device_release() local
330 kfree_const(scmi_dev->name); in scmi_device_release()
331 kfree(scmi_dev); in scmi_device_release()
334 static void __scmi_device_destroy(struct scmi_device *scmi_dev) in __scmi_device_destroy() argument
337 of_node_full_name(scmi_dev->dev.parent->of_node), in __scmi_device_destroy()
338 dev_name(&scmi_dev->dev), scmi_dev->protocol_id, in __scmi_device_destroy()
339 scmi_dev->name); in __scmi_device_destroy()
341 if (scmi_dev->protocol_id == SCMI_PROTOCOL_SYSTEM) in __scmi_device_destroy()
344 ida_free(&scmi_bus_id, scmi_dev->id); in __scmi_device_destroy()
345 device_unregister(&scmi_dev->dev); in __scmi_device_destroy()
353 struct scmi_device *scmi_dev; in __scmi_device_create() local
362 scmi_dev = scmi_child_dev_find(parent, protocol, name); in __scmi_device_create()
363 if (scmi_dev) in __scmi_device_create()
364 return scmi_dev; in __scmi_device_create()
380 scmi_dev = kzalloc(sizeof(*scmi_dev), GFP_KERNEL); in __scmi_device_create()
381 if (!scmi_dev) in __scmi_device_create()
384 scmi_dev->name = kstrdup_const(name ?: "unknown", GFP_KERNEL); in __scmi_device_create()
385 if (!scmi_dev->name) { in __scmi_device_create()
386 kfree(scmi_dev); in __scmi_device_create()
392 kfree_const(scmi_dev->name); in __scmi_device_create()
393 kfree(scmi_dev); in __scmi_device_create()
397 scmi_dev->id = id; in __scmi_device_create()
398 scmi_dev->protocol_id = protocol; in __scmi_device_create()
399 scmi_dev->dev.parent = parent; in __scmi_device_create()
400 device_set_node(&scmi_dev->dev, of_fwnode_handle(np)); in __scmi_device_create()
401 scmi_dev->dev.bus = &scmi_bus_type; in __scmi_device_create()
402 scmi_dev->dev.release = scmi_device_release; in __scmi_device_create()
403 dev_set_name(&scmi_dev->dev, "scmi_dev.%d", id); in __scmi_device_create()
405 retval = device_register(&scmi_dev->dev); in __scmi_device_create()
411 dev_name(&scmi_dev->dev), protocol, name); in __scmi_device_create()
413 return scmi_dev; in __scmi_device_create()
415 put_device(&scmi_dev->dev); in __scmi_device_create()
449 struct scmi_device *scmi_dev = NULL; in scmi_device_create() local
471 scmi_dev = sdev; in scmi_device_create()
480 return scmi_dev; in scmi_device_create()
486 struct scmi_device *scmi_dev; in scmi_device_destroy() local
488 scmi_dev = scmi_child_dev_find(parent, protocol, name); in scmi_device_destroy()
489 if (scmi_dev) in scmi_device_destroy()
490 __scmi_device_destroy(scmi_dev); in scmi_device_destroy()
496 struct scmi_device *scmi_dev = to_scmi_dev(dev); in __scmi_devices_unregister() local
498 __scmi_device_destroy(scmi_dev); in __scmi_devices_unregister()