Commit e3439af1 authored by Hollis Blanchard's avatar Hollis Blanchard Committed by Greg Kroah-Hartman

[PATCH] ppc64: export vio_find_node()

To hotplug-remove virtual devices, we need vio_find_node() so we have a
pointer to pass to vio_unregister_device().
parent 84c6b89a
......@@ -29,6 +29,8 @@
#define DBGENTER() pr_debug("%s entered\n", __FUNCTION__)
extern struct subsystem devices_subsys; /* needed for vio_find_name() */
struct iommu_table *vio_build_iommu_table(struct vio_dev *dev);
static int vio_num_address_cells;
......@@ -298,6 +300,42 @@ const void * vio_get_attribute(struct vio_dev *vdev, void* which, int* length)
}
EXPORT_SYMBOL(vio_get_attribute);
/* vio_find_name() - internal because only vio.c knows how we formatted the
* kobject name
* XXX once vio_bus_type.devices is actually used as a kset in
* drivers/base/bus.c, this function should be removed in favor of
* "device_find(kobj_name, &vio_bus_type)"
*/
static struct vio_dev *vio_find_name(const char *kobj_name)
{
struct kobject *found;
found = kset_find_obj(&devices_subsys.kset, kobj_name);
if (!found)
return NULL;
return to_vio_dev(container_of(found, struct device, kobj));
}
/**
* vio_find_node - find an already-registered vio_dev
* @vnode: device_node of the virtual device we're looking for
*/
struct vio_dev *vio_find_node(struct device_node *vnode)
{
uint32_t *unit_address;
char kobj_name[BUS_ID_SIZE];
/* construct the kobject name from the device node */
unit_address = (uint32_t *)get_property(vnode, "reg", NULL);
if (!unit_address)
return NULL;
snprintf(kobj_name, BUS_ID_SIZE, "%x", *unit_address);
return vio_find_name(kobj_name);
}
EXPORT_SYMBOL(vio_find_node);
/**
* vio_build_iommu_table: - gets the dma information from OF and builds the TCE tree.
* @dev: the virtual device.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment