/* Walks up the device tree looking for a device of the specified type. If it finds it, it returns it. If not, it returns NULL.  */
const struct parisc_device* find_pa_parent_type(const struct parisc_device *padev, int type)
/* Walks up the device tree looking for a device of the specified type. If it finds it, it returns it. If not, it returns NULL.  */
const struct parisc_device* find_pa_parent_type(const struct parisc_device *padev, int type)
{
	const struct device *dev = &padev->dev;
	while (dev != &root) {
		struct parisc_device *candidate = to_parisc_device(dev);
		if (candidate->id.hw_type == type)
			return candidate;
		dev = dev->parent;
	}
	return NULL;
}