-
- return 0;
-}
-
-/**
- * udevdb_get_device: grab's device by name
- */
-struct udevice *udevdb_get_udevice(const char *name)
-{
- struct namedb_record *nrec = NULL;
- struct udevice *dev = NULL;
-
- if (name == NULL)
- return NULL;
-
- nrec = namedb_fetch(name);
- if (nrec == NULL)
- return NULL;
-
- dev = (struct udevice *)malloc(sizeof(struct udevice));
- if (dev == NULL) {
- free(nrec);
- return NULL;
- }
-
- strcpy(dev->name, name);
- strcpy(dev->sysfs_path, nrec->sysfs_path);
- strcpy(dev->class_dev_name, nrec->class_dev_name);
- strcpy(dev->class_name, nrec->class_name);
- strcpy(dev->bus_name, nrec->bus);
- strcpy(dev->bus_id, nrec->id);
- dev->type = nrec->type;
- dev->major = nrec->major;
- dev->minor = nrec->minor;
- dev->mode = nrec->mode;
-
- free(nrec);
-
- return dev;
-}
-
-/**
- * udevdb_get_device_by_bus
- */
-struct udevice *udevdb_get_udevice_by_bus(const char *bus, const char *id)
-{
- struct busdb_record *brec = NULL;
- struct udevice *dev = NULL;
-
- if (bus == NULL || id == NULL)
- return NULL;
-
- brec = busdb_fetch(bus, id);
- if (brec == NULL)
- return NULL;
-
- dev = udevdb_get_udevice(brec->name);
- free(brec);
-
- return dev;
-}
-
-/**
- * udevdb_get_udevice_by_class
- */
-struct udevice *udevdb_get_udevice_by_class(const char *cls,
- const char *cls_dev)
-{
- struct classdb_record *crec = NULL;
- struct udevice *dev = NULL;
-
- if (cls == NULL || cls_dev == NULL)
- return NULL;
-
- crec = classdb_fetch(cls, cls_dev);
- if (crec == NULL)
- return NULL;
-
- dev = udevdb_get_udevice(crec->name);
- free(crec);
-
- return dev;