Lines Matching refs:scmi_dev
190 scmi_dev_match_id(struct scmi_device *scmi_dev, struct scmi_driver *scmi_drv) in scmi_dev_match_id() argument
198 if (id->protocol_id == scmi_dev->protocol_id) { in scmi_dev_match_id()
201 else if (!strcmp(id->name, scmi_dev->name)) in scmi_dev_match_id()
211 struct scmi_device *scmi_dev = to_scmi_dev(dev); in scmi_dev_match() local
214 id = scmi_dev_match_id(scmi_dev, scmi_drv); in scmi_dev_match()
249 struct scmi_device *scmi_dev = to_scmi_dev(dev); in scmi_dev_probe() local
251 if (!scmi_dev->handle) in scmi_dev_probe()
254 return scmi_drv->probe(scmi_dev); in scmi_dev_probe()
260 struct scmi_device *scmi_dev = to_scmi_dev(dev); in scmi_dev_remove() local
263 scmi_drv->remove(scmi_dev); in scmi_dev_remove()
311 static void __scmi_device_destroy(struct scmi_device *scmi_dev) in __scmi_device_destroy() argument
314 of_node_full_name(scmi_dev->dev.parent->of_node), in __scmi_device_destroy()
315 dev_name(&scmi_dev->dev), scmi_dev->protocol_id, in __scmi_device_destroy()
316 scmi_dev->name); in __scmi_device_destroy()
318 if (scmi_dev->protocol_id == SCMI_PROTOCOL_SYSTEM) in __scmi_device_destroy()
321 kfree_const(scmi_dev->name); in __scmi_device_destroy()
322 ida_free(&scmi_bus_id, scmi_dev->id); in __scmi_device_destroy()
323 device_unregister(&scmi_dev->dev); in __scmi_device_destroy()
331 struct scmi_device *scmi_dev; in __scmi_device_create() local
340 scmi_dev = scmi_child_dev_find(parent, protocol, name); in __scmi_device_create()
341 if (scmi_dev) in __scmi_device_create()
342 return scmi_dev; in __scmi_device_create()
358 scmi_dev = kzalloc(sizeof(*scmi_dev), GFP_KERNEL); in __scmi_device_create()
359 if (!scmi_dev) in __scmi_device_create()
362 scmi_dev->name = kstrdup_const(name ?: "unknown", GFP_KERNEL); in __scmi_device_create()
363 if (!scmi_dev->name) { in __scmi_device_create()
364 kfree(scmi_dev); in __scmi_device_create()
370 kfree_const(scmi_dev->name); in __scmi_device_create()
371 kfree(scmi_dev); in __scmi_device_create()
375 scmi_dev->id = id; in __scmi_device_create()
376 scmi_dev->protocol_id = protocol; in __scmi_device_create()
377 scmi_dev->dev.parent = parent; in __scmi_device_create()
378 device_set_node(&scmi_dev->dev, of_fwnode_handle(np)); in __scmi_device_create()
379 scmi_dev->dev.bus = &scmi_bus_type; in __scmi_device_create()
380 scmi_dev->dev.release = scmi_device_release; in __scmi_device_create()
381 dev_set_name(&scmi_dev->dev, "scmi_dev.%d", id); in __scmi_device_create()
383 retval = device_register(&scmi_dev->dev); in __scmi_device_create()
389 dev_name(&scmi_dev->dev), protocol, name); in __scmi_device_create()
391 return scmi_dev; in __scmi_device_create()
393 kfree_const(scmi_dev->name); in __scmi_device_create()
394 put_device(&scmi_dev->dev); in __scmi_device_create()
428 struct scmi_device *scmi_dev = NULL; in scmi_device_create() local
450 scmi_dev = sdev; in scmi_device_create()
459 return scmi_dev; in scmi_device_create()
465 struct scmi_device *scmi_dev; in scmi_device_destroy() local
467 scmi_dev = scmi_child_dev_find(parent, protocol, name); in scmi_device_destroy()
468 if (scmi_dev) in scmi_device_destroy()
469 __scmi_device_destroy(scmi_dev); in scmi_device_destroy()
475 struct scmi_device *scmi_dev = to_scmi_dev(dev); in __scmi_devices_unregister() local
477 __scmi_device_destroy(scmi_dev); in __scmi_devices_unregister()