Lines Matching refs:scmi_dev

23 scmi_dev_match_id(struct scmi_device *scmi_dev, struct scmi_driver *scmi_drv)  in scmi_dev_match_id()  argument
31 if (id->protocol_id == scmi_dev->protocol_id) { in scmi_dev_match_id()
34 else if (!strcmp(id->name, scmi_dev->name)) in scmi_dev_match_id()
44 struct scmi_device *scmi_dev = to_scmi_dev(dev); in scmi_dev_match() local
47 id = scmi_dev_match_id(scmi_dev, scmi_drv); in scmi_dev_match()
71 struct scmi_device *scmi_dev = to_scmi_dev(dev); in scmi_dev_probe() local
75 id = scmi_dev_match_id(scmi_dev, scmi_drv); in scmi_dev_probe()
79 if (!scmi_dev->handle) in scmi_dev_probe()
82 ret = scmi_protocol_init(scmi_dev->protocol_id, scmi_dev->handle); in scmi_dev_probe()
88 scmi_dev->protocol_id); in scmi_dev_probe()
90 return scmi_drv->probe(scmi_dev); in scmi_dev_probe()
96 struct scmi_device *scmi_dev = to_scmi_dev(dev); in scmi_dev_remove() local
99 scmi_drv->remove(scmi_dev); in scmi_dev_remove()
145 struct scmi_device *scmi_dev; in scmi_device_create() local
147 scmi_dev = kzalloc(sizeof(*scmi_dev), GFP_KERNEL); in scmi_device_create()
148 if (!scmi_dev) in scmi_device_create()
151 scmi_dev->name = kstrdup_const(name ?: "unknown", GFP_KERNEL); in scmi_device_create()
152 if (!scmi_dev->name) { in scmi_device_create()
153 kfree(scmi_dev); in scmi_device_create()
159 kfree_const(scmi_dev->name); in scmi_device_create()
160 kfree(scmi_dev); in scmi_device_create()
164 scmi_dev->id = id; in scmi_device_create()
165 scmi_dev->protocol_id = protocol; in scmi_device_create()
166 scmi_dev->dev.parent = parent; in scmi_device_create()
167 scmi_dev->dev.of_node = np; in scmi_device_create()
168 scmi_dev->dev.bus = &scmi_bus_type; in scmi_device_create()
169 scmi_dev->dev.release = scmi_device_release; in scmi_device_create()
170 dev_set_name(&scmi_dev->dev, "scmi_dev.%d", id); in scmi_device_create()
172 retval = device_register(&scmi_dev->dev); in scmi_device_create()
176 return scmi_dev; in scmi_device_create()
178 kfree_const(scmi_dev->name); in scmi_device_create()
179 put_device(&scmi_dev->dev); in scmi_device_create()
184 void scmi_device_destroy(struct scmi_device *scmi_dev) in scmi_device_destroy() argument
186 kfree_const(scmi_dev->name); in scmi_device_destroy()
187 scmi_handle_put(scmi_dev->handle); in scmi_device_destroy()
188 ida_simple_remove(&scmi_bus_id, scmi_dev->id); in scmi_device_destroy()
189 device_unregister(&scmi_dev->dev); in scmi_device_destroy()
192 void scmi_set_handle(struct scmi_device *scmi_dev) in scmi_set_handle() argument
194 scmi_dev->handle = scmi_handle_get(&scmi_dev->dev); in scmi_set_handle()
222 struct scmi_device *scmi_dev = to_scmi_dev(dev); in __scmi_devices_unregister() local
224 scmi_device_destroy(scmi_dev); in __scmi_devices_unregister()