aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2005-06-21 20:15:54 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-21 21:46:31 -0400
commitac5b33c9bcf1c05ae949b026a51d7f8f9573591c (patch)
tree4df7bb1a13ec444b3be94b3575a23d7075ebd902 /arch
parent145d01e4287b8cbf50f87c3283e33bf5c84e8468 (diff)
[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: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/ppc64/kernel/vio.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/arch/ppc64/kernel/vio.c b/arch/ppc64/kernel/vio.c
index 79f2dc7a9833..0c0ba71ac0e8 100644
--- a/arch/ppc64/kernel/vio.c
+++ b/arch/ppc64/kernel/vio.c
@@ -41,20 +41,25 @@ static const struct vio_device_id *vio_match_device(
41static struct iommu_table *vio_build_iommu_table(struct vio_dev *); 41static struct iommu_table *vio_build_iommu_table(struct vio_dev *);
42static int vio_num_address_cells; 42static int vio_num_address_cells;
43#endif 43#endif
44static struct vio_dev *vio_bus_device; /* fake "parent" device */
45
46#ifdef CONFIG_PPC_ISERIES 44#ifdef CONFIG_PPC_ISERIES
47static struct vio_dev *__init vio_register_device_iseries(char *type,
48 uint32_t unit_num);
49
50static struct iommu_table veth_iommu_table; 45static struct iommu_table veth_iommu_table;
51static struct iommu_table vio_iommu_table; 46static struct iommu_table vio_iommu_table;
52 47#endif
53static struct vio_dev _vio_dev = { 48static struct vio_dev vio_bus_device = { /* fake "parent" device */
49 .name = vio_bus_device.dev.bus_id,
50 .type = "",
51#ifdef CONFIG_PPC_ISERIES
54 .iommu_table = &vio_iommu_table, 52 .iommu_table = &vio_iommu_table,
55 .dev.bus = &vio_bus_type 53#endif
54 .dev.bus_id = "vio",
55 .dev.bus = &vio_bus_type,
56}; 56};
57struct device *iSeries_vio_dev = &_vio_dev.dev; 57
58#ifdef CONFIG_PPC_ISERIES
59static struct vio_dev *__init vio_register_device_iseries(char *type,
60 uint32_t unit_num);
61
62struct device *iSeries_vio_dev = &vio_bus_device.dev;
58EXPORT_SYMBOL(iSeries_vio_dev); 63EXPORT_SYMBOL(iSeries_vio_dev);
59 64
60#define device_is_compatible(a, b) 1 65#define device_is_compatible(a, b) 1
@@ -260,18 +265,10 @@ static int __init vio_bus_init(void)
260 } 265 }
261 266
262 /* the fake parent of all vio devices, just to give us a nice directory */ 267 /* the fake parent of all vio devices, just to give us a nice directory */
263 vio_bus_device = kmalloc(sizeof(struct vio_dev), GFP_KERNEL); 268 err = device_register(&vio_bus_device.dev);
264 if (!vio_bus_device) {
265 return 1;
266 }
267 memset(vio_bus_device, 0, sizeof(struct vio_dev));
268 strcpy(vio_bus_device->dev.bus_id, "vio");
269
270 err = device_register(&vio_bus_device->dev);
271 if (err) { 269 if (err) {
272 printk(KERN_WARNING "%s: device_register returned %i\n", __FUNCTION__, 270 printk(KERN_WARNING "%s: device_register returned %i\n", __FUNCTION__,
273 err); 271 err);
274 kfree(vio_bus_device);
275 return err; 272 return err;
276 } 273 }
277 274
@@ -326,7 +323,7 @@ static struct vio_dev * __devinit vio_register_device_common(
326 viodev->unit_address = unit_address; 323 viodev->unit_address = unit_address;
327 viodev->iommu_table = iommu_table; 324 viodev->iommu_table = iommu_table;
328 /* init generic 'struct device' fields: */ 325 /* init generic 'struct device' fields: */
329 viodev->dev.parent = &vio_bus_device->dev; 326 viodev->dev.parent = &vio_bus_device.dev;
330 viodev->dev.bus = &vio_bus_type; 327 viodev->dev.bus = &vio_bus_type;
331 viodev->dev.release = vio_dev_release; 328 viodev->dev.release = vio_dev_release;
332 329
@@ -636,5 +633,3 @@ struct bus_type vio_bus_type = {
636 .name = "vio", 633 .name = "vio",
637 .match = vio_bus_match, 634 .match = vio_bus_match,
638}; 635};
639
640EXPORT_SYMBOL(vio_bus_type);