/* hwpath_to_device - Finds the generic device corresponding to a given hardware path. @modpath: the hardware path.  */
struct device* hwpath_to_device(struct hardware_path *modpath)
/* hwpath_to_device - Finds the generic device corresponding to a given hardware path. @modpath: the hardware path.  */
struct device* hwpath_to_device(struct hardware_path *modpath)
{
	int i;
	struct device *parent = &root;
	for (i = 0; i < 6; i++) {
		if (modpath->bc[i] == -1)
			continue;
		parent = parse_tree_node(parent, i, modpath);
		if (!parent)
			return NULL;
	}
	if (is_pci_dev(parent))
		return parent;
	else
		return parse_tree_node(parent, 6, modpath);
}