Lines Matching refs:scmi_dev

191 scmi_dev_match_id(struct scmi_device *scmi_dev, struct scmi_driver *scmi_drv)  in scmi_dev_match_id()  argument
199 if (id->protocol_id == scmi_dev->protocol_id) { in scmi_dev_match_id()
202 else if (!strcmp(id->name, scmi_dev->name)) in scmi_dev_match_id()
212 struct scmi_device *scmi_dev = to_scmi_dev(dev); in scmi_dev_match() local
215 id = scmi_dev_match_id(scmi_dev, scmi_drv); in scmi_dev_match()
250 struct scmi_device *scmi_dev = to_scmi_dev(dev); in scmi_dev_probe() local
252 if (!scmi_dev->handle) in scmi_dev_probe()
255 return scmi_drv->probe(scmi_dev); in scmi_dev_probe()
261 struct scmi_device *scmi_dev = to_scmi_dev(dev); in scmi_dev_remove() local
264 scmi_drv->remove(scmi_dev); in scmi_dev_remove()
312 static void __scmi_device_destroy(struct scmi_device *scmi_dev) in __scmi_device_destroy() argument
315 of_node_full_name(scmi_dev->dev.parent->of_node), in __scmi_device_destroy()
316 dev_name(&scmi_dev->dev), scmi_dev->protocol_id, in __scmi_device_destroy()
317 scmi_dev->name); in __scmi_device_destroy()
319 if (scmi_dev->protocol_id == SCMI_PROTOCOL_SYSTEM) in __scmi_device_destroy()
322 kfree_const(scmi_dev->name); in __scmi_device_destroy()
323 ida_free(&scmi_bus_id, scmi_dev->id); in __scmi_device_destroy()
324 device_unregister(&scmi_dev->dev); in __scmi_device_destroy()
332 struct scmi_device *scmi_dev; in __scmi_device_create() local
341 scmi_dev = scmi_child_dev_find(parent, protocol, name); in __scmi_device_create()
342 if (scmi_dev) in __scmi_device_create()
343 return scmi_dev; in __scmi_device_create()
359 scmi_dev = kzalloc(sizeof(*scmi_dev), GFP_KERNEL); in __scmi_device_create()
360 if (!scmi_dev) in __scmi_device_create()
363 scmi_dev->name = kstrdup_const(name ?: "unknown", GFP_KERNEL); in __scmi_device_create()
364 if (!scmi_dev->name) { in __scmi_device_create()
365 kfree(scmi_dev); in __scmi_device_create()
371 kfree_const(scmi_dev->name); in __scmi_device_create()
372 kfree(scmi_dev); in __scmi_device_create()
376 scmi_dev->id = id; in __scmi_device_create()
377 scmi_dev->protocol_id = protocol; in __scmi_device_create()
378 scmi_dev->dev.parent = parent; in __scmi_device_create()
379 device_set_node(&scmi_dev->dev, of_fwnode_handle(np)); in __scmi_device_create()
380 scmi_dev->dev.bus = &scmi_bus_type; in __scmi_device_create()
381 scmi_dev->dev.release = scmi_device_release; in __scmi_device_create()
382 dev_set_name(&scmi_dev->dev, "scmi_dev.%d", id); in __scmi_device_create()
384 retval = device_register(&scmi_dev->dev); in __scmi_device_create()
390 dev_name(&scmi_dev->dev), protocol, name); in __scmi_device_create()
392 return scmi_dev; in __scmi_device_create()
394 kfree_const(scmi_dev->name); in __scmi_device_create()
395 put_device(&scmi_dev->dev); in __scmi_device_create()
429 struct scmi_device *scmi_dev = NULL; in scmi_device_create() local
439 return scmi_dev; in scmi_device_create()
451 scmi_dev = sdev; in scmi_device_create()
460 return scmi_dev; in scmi_device_create()
466 struct scmi_device *scmi_dev; in scmi_device_destroy() local
468 scmi_dev = scmi_child_dev_find(parent, protocol, name); in scmi_device_destroy()
469 if (scmi_dev) in scmi_device_destroy()
470 __scmi_device_destroy(scmi_dev); in scmi_device_destroy()
476 struct scmi_device *scmi_dev = to_scmi_dev(dev); in __scmi_devices_unregister() local
478 __scmi_device_destroy(scmi_dev); in __scmi_devices_unregister()