提交 ac5b33c9 编写于 作者: S Stephen Rothwell 提交者: Linus Torvalds

[PATCH] ppc64: tidy up vio devices fake parent

Currently we dynamically allocate the fake parent device for all devices on
the vio bus.  This patch statically allocates it.  This also allows us to
reuse it for the iSeries "generic" vio device (that is used for passing to
dma routines when communicating with the hypervisor without a device
involved).  Also unexport vio_bus_type as it is never used in modules.
Signed-off-by: NStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 145d01e4
...@@ -41,20 +41,25 @@ static const struct vio_device_id *vio_match_device( ...@@ -41,20 +41,25 @@ static const struct vio_device_id *vio_match_device(
static struct iommu_table *vio_build_iommu_table(struct vio_dev *); static struct iommu_table *vio_build_iommu_table(struct vio_dev *);
static int vio_num_address_cells; static int vio_num_address_cells;
#endif #endif
static struct vio_dev *vio_bus_device; /* fake "parent" device */
#ifdef CONFIG_PPC_ISERIES #ifdef CONFIG_PPC_ISERIES
static struct vio_dev *__init vio_register_device_iseries(char *type,
uint32_t unit_num);
static struct iommu_table veth_iommu_table; static struct iommu_table veth_iommu_table;
static struct iommu_table vio_iommu_table; static struct iommu_table vio_iommu_table;
#endif
static struct vio_dev _vio_dev = { static struct vio_dev vio_bus_device = { /* fake "parent" device */
.name = vio_bus_device.dev.bus_id,
.type = "",
#ifdef CONFIG_PPC_ISERIES
.iommu_table = &vio_iommu_table, .iommu_table = &vio_iommu_table,
.dev.bus = &vio_bus_type #endif
.dev.bus_id = "vio",
.dev.bus = &vio_bus_type,
}; };
struct device *iSeries_vio_dev = &_vio_dev.dev;
#ifdef CONFIG_PPC_ISERIES
static struct vio_dev *__init vio_register_device_iseries(char *type,
uint32_t unit_num);
struct device *iSeries_vio_dev = &vio_bus_device.dev;
EXPORT_SYMBOL(iSeries_vio_dev); EXPORT_SYMBOL(iSeries_vio_dev);
#define device_is_compatible(a, b) 1 #define device_is_compatible(a, b) 1
...@@ -260,18 +265,10 @@ static int __init vio_bus_init(void) ...@@ -260,18 +265,10 @@ static int __init vio_bus_init(void)
} }
/* the fake parent of all vio devices, just to give us a nice directory */ /* the fake parent of all vio devices, just to give us a nice directory */
vio_bus_device = kmalloc(sizeof(struct vio_dev), GFP_KERNEL); err = device_register(&vio_bus_device.dev);
if (!vio_bus_device) {
return 1;
}
memset(vio_bus_device, 0, sizeof(struct vio_dev));
strcpy(vio_bus_device->dev.bus_id, "vio");
err = device_register(&vio_bus_device->dev);
if (err) { if (err) {
printk(KERN_WARNING "%s: device_register returned %i\n", __FUNCTION__, printk(KERN_WARNING "%s: device_register returned %i\n", __FUNCTION__,
err); err);
kfree(vio_bus_device);
return err; return err;
} }
...@@ -326,7 +323,7 @@ static struct vio_dev * __devinit vio_register_device_common( ...@@ -326,7 +323,7 @@ static struct vio_dev * __devinit vio_register_device_common(
viodev->unit_address = unit_address; viodev->unit_address = unit_address;
viodev->iommu_table = iommu_table; viodev->iommu_table = iommu_table;
/* init generic 'struct device' fields: */ /* init generic 'struct device' fields: */
viodev->dev.parent = &vio_bus_device->dev; viodev->dev.parent = &vio_bus_device.dev;
viodev->dev.bus = &vio_bus_type; viodev->dev.bus = &vio_bus_type;
viodev->dev.release = vio_dev_release; viodev->dev.release = vio_dev_release;
...@@ -636,5 +633,3 @@ struct bus_type vio_bus_type = { ...@@ -636,5 +633,3 @@ struct bus_type vio_bus_type = {
.name = "vio", .name = "vio",
.match = vio_bus_match, .match = vio_bus_match,
}; };
EXPORT_SYMBOL(vio_bus_type);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册