+/*
+ * Look up the sysfs path in the database to see if we have named this device
+ * something different from the kernel name. If we have, us it. If not, use
+ * the default kernel name for lack of anything else to know to do.
+ */
+int udev_remove_device(const char *path, const char *subsystem)
+{
+ struct udevice dev;
+ char *temp;
+ int retval;
+
+ memset(&dev, 0x00, sizeof(dev));
+
+ retval = udevdb_get_dev(path, &dev);
+ if (retval != 0) {
+ dbg("'%s' not found in database, falling back on default name", path);
+ temp = strrchr(path, '/');
+ if (temp == NULL)
+ return -ENODEV;
+ strfieldcpy(dev.name, &temp[1]);
+ }
+ dbg("name='%s'", dev.name);
+
+ dev.type = get_device_type(path, subsystem);
+ dev_d_send(&dev, subsystem, path);
+ udevdb_delete_dev(path);
+
+ if (dev.type == 'b' || dev.type == 'c')
+ retval = delete_node(&dev);
+ else if (dev.type == 'n')
+ retval = 0;
+
+ return retval;
+}