Lines Matching +full:uuid +full:- +full:dev

1 // SPDX-License-Identifier: GPL-2.0
20 static int ffa_device_match(struct device *dev, struct device_driver *drv) in ffa_device_match() argument
25 id_table = to_ffa_driver(drv)->id_table; in ffa_device_match()
26 ffa_dev = to_ffa_dev(dev); in ffa_device_match()
28 while (!uuid_is_null(&id_table->uuid)) { in ffa_device_match()
30 * FF-A v1.0 doesn't provide discovery of UUIDs, just the in ffa_device_match()
32 * id_table UUID and assign the UUID to the device if the in ffa_device_match()
35 if (uuid_is_null(&ffa_dev->uuid)) in ffa_device_match()
36 ffa_device_match_uuid(ffa_dev, &id_table->uuid); in ffa_device_match()
38 if (uuid_equal(&ffa_dev->uuid, &id_table->uuid)) in ffa_device_match()
46 static int ffa_device_probe(struct device *dev) in ffa_device_probe() argument
48 struct ffa_driver *ffa_drv = to_ffa_driver(dev->driver); in ffa_device_probe()
49 struct ffa_device *ffa_dev = to_ffa_dev(dev); in ffa_device_probe()
51 return ffa_drv->probe(ffa_dev); in ffa_device_probe()
54 static void ffa_device_remove(struct device *dev) in ffa_device_remove() argument
56 struct ffa_driver *ffa_drv = to_ffa_driver(dev->driver); in ffa_device_remove()
58 if (ffa_drv->remove) in ffa_device_remove()
59 ffa_drv->remove(to_ffa_dev(dev)); in ffa_device_remove()
62 static int ffa_device_uevent(const struct device *dev, struct kobj_uevent_env *env) in ffa_device_uevent() argument
64 const struct ffa_device *ffa_dev = to_ffa_dev(dev); in ffa_device_uevent()
67 ffa_dev->vm_id, &ffa_dev->uuid); in ffa_device_uevent()
70 static ssize_t partition_id_show(struct device *dev, in partition_id_show() argument
73 struct ffa_device *ffa_dev = to_ffa_dev(dev); in partition_id_show()
75 return sprintf(buf, "0x%04x\n", ffa_dev->vm_id); in partition_id_show()
79 static ssize_t uuid_show(struct device *dev, struct device_attribute *attr, in uuid_show() argument
82 struct ffa_device *ffa_dev = to_ffa_dev(dev); in uuid_show()
84 return sprintf(buf, "%pUb\n", &ffa_dev->uuid); in uuid_show()
86 static DEVICE_ATTR_RO(uuid);
110 if (!driver->probe) in ffa_driver_register()
111 return -EINVAL; in ffa_driver_register()
113 driver->driver.bus = &ffa_bus_type; in ffa_driver_register()
114 driver->driver.name = driver->name; in ffa_driver_register()
115 driver->driver.owner = owner; in ffa_driver_register()
116 driver->driver.mod_name = mod_name; in ffa_driver_register()
118 ret = driver_register(&driver->driver); in ffa_driver_register()
120 pr_debug("registered new ffa driver %s\n", driver->name); in ffa_driver_register()
128 driver_unregister(&driver->driver); in ffa_driver_unregister()
132 static void ffa_release_device(struct device *dev) in ffa_release_device() argument
134 struct ffa_device *ffa_dev = to_ffa_dev(dev); in ffa_release_device()
136 ida_free(&ffa_bus_id, ffa_dev->id); in ffa_release_device()
140 static int __ffa_devices_unregister(struct device *dev, void *data) in __ffa_devices_unregister() argument
142 device_unregister(dev); in __ffa_devices_unregister()
156 struct device *dev = NULL; in ffa_device_is_valid() local
160 dev = bus_find_next_device(&ffa_bus_type, dev); in ffa_device_is_valid()
161 tmp_dev = to_ffa_dev(dev); in ffa_device_is_valid()
166 put_device(dev); in ffa_device_is_valid()
167 } while (dev); in ffa_device_is_valid()
169 put_device(dev); in ffa_device_is_valid()
174 struct ffa_device *ffa_device_register(const uuid_t *uuid, int vm_id, in ffa_device_register() argument
178 struct device *dev; in ffa_device_register() local
191 dev = &ffa_dev->dev; in ffa_device_register()
192 dev->bus = &ffa_bus_type; in ffa_device_register()
193 dev->release = ffa_release_device; in ffa_device_register()
194 dev_set_name(&ffa_dev->dev, "arm-ffa-%d", id); in ffa_device_register()
196 ffa_dev->id = id; in ffa_device_register()
197 ffa_dev->vm_id = vm_id; in ffa_device_register()
198 ffa_dev->ops = ops; in ffa_device_register()
199 uuid_copy(&ffa_dev->uuid, uuid); in ffa_device_register()
201 ret = device_register(&ffa_dev->dev); in ffa_device_register()
203 dev_err(dev, "unable to register device %s err=%d\n", in ffa_device_register()
204 dev_name(dev), ret); in ffa_device_register()
205 put_device(dev); in ffa_device_register()
218 device_unregister(&ffa_dev->dev); in ffa_device_unregister()