diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2005-08-17 02:40:12 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-08-29 23:23:47 -0400 |
commit | b877b90f227fb9698d99fb70492d432362584082 (patch) | |
tree | b58168217324bc07c8d6e7368246fa24ba7e96db /arch/ppc64/kernel | |
parent | 5c0b4b8759f78c31172088a91e10733fc014ccee (diff) |
[PATCH] Create vio_register_device
Take some assignments out of vio_register_device_common and
rename it to vio_register_device.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/ppc64/kernel')
-rw-r--r-- | arch/ppc64/kernel/iSeries_vio.c | 15 | ||||
-rw-r--r-- | arch/ppc64/kernel/pSeries_vio.c | 9 | ||||
-rw-r--r-- | arch/ppc64/kernel/vio.c | 8 |
3 files changed, 18 insertions, 14 deletions
diff --git a/arch/ppc64/kernel/iSeries_vio.c b/arch/ppc64/kernel/iSeries_vio.c index b4268cc4ba48..d0960a82708c 100644 --- a/arch/ppc64/kernel/iSeries_vio.c +++ b/arch/ppc64/kernel/iSeries_vio.c | |||
@@ -68,7 +68,7 @@ static void __init iommu_vio_init(void) | |||
68 | } | 68 | } |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * vio_register_device: - Register a new vio device. | 71 | * vio_register_device_iseries: - Register a new iSeries vio device. |
72 | * @voidev: The device to register. | 72 | * @voidev: The device to register. |
73 | */ | 73 | */ |
74 | static struct vio_dev *__init vio_register_device_iseries(char *type, | 74 | static struct vio_dev *__init vio_register_device_iseries(char *type, |
@@ -76,7 +76,7 @@ static struct vio_dev *__init vio_register_device_iseries(char *type, | |||
76 | { | 76 | { |
77 | struct vio_dev *viodev; | 77 | struct vio_dev *viodev; |
78 | 78 | ||
79 | /* allocate a vio_dev for this node */ | 79 | /* allocate a vio_dev for this device */ |
80 | viodev = kmalloc(sizeof(struct vio_dev), GFP_KERNEL); | 80 | viodev = kmalloc(sizeof(struct vio_dev), GFP_KERNEL); |
81 | if (!viodev) | 81 | if (!viodev) |
82 | return NULL; | 82 | return NULL; |
@@ -84,8 +84,15 @@ static struct vio_dev *__init vio_register_device_iseries(char *type, | |||
84 | 84 | ||
85 | snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%s%d", type, unit_num); | 85 | snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%s%d", type, unit_num); |
86 | 86 | ||
87 | return vio_register_device_common(viodev, viodev->dev.bus_id, type, | 87 | viodev->name = viodev->dev.bus_id; |
88 | unit_num, &vio_iommu_table); | 88 | viodev->type = type; |
89 | viodev->unit_address = unit_num; | ||
90 | viodev->iommu_table = &vio_iommu_table; | ||
91 | if (vio_register_device(viodev) == NULL) { | ||
92 | kfree(viodev); | ||
93 | return NULL; | ||
94 | } | ||
95 | return viodev; | ||
89 | } | 96 | } |
90 | 97 | ||
91 | void __init probe_bus_iseries(void) | 98 | void __init probe_bus_iseries(void) |
diff --git a/arch/ppc64/kernel/pSeries_vio.c b/arch/ppc64/kernel/pSeries_vio.c index 338f9e1bdc09..81e94f8aa846 100644 --- a/arch/ppc64/kernel/pSeries_vio.c +++ b/arch/ppc64/kernel/pSeries_vio.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/kobject.h> | 19 | #include <linux/kobject.h> |
20 | #include <asm/iommu.h> | 20 | #include <asm/iommu.h> |
21 | #include <asm/dma.h> | 21 | #include <asm/dma.h> |
22 | #include <asm/prom.h> | ||
22 | #include <asm/vio.h> | 23 | #include <asm/vio.h> |
23 | #include <asm/hvcall.h> | 24 | #include <asm/hvcall.h> |
24 | 25 | ||
@@ -181,11 +182,13 @@ struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node) | |||
181 | } | 182 | } |
182 | 183 | ||
183 | snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%x", *unit_address); | 184 | snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%x", *unit_address); |
185 | viodev->name = of_node->name; | ||
186 | viodev->type = of_node->type; | ||
187 | viodev->unit_address = *unit_address; | ||
188 | viodev->iommu_table = vio_build_iommu_table(viodev); | ||
184 | 189 | ||
185 | /* register with generic device framework */ | 190 | /* register with generic device framework */ |
186 | if (vio_register_device_common(viodev, of_node->name, of_node->type, | 191 | if (vio_register_device(viodev) == NULL) { |
187 | *unit_address, vio_build_iommu_table(viodev)) | ||
188 | == NULL) { | ||
189 | /* XXX free TCE table */ | 192 | /* XXX free TCE table */ |
190 | kfree(viodev); | 193 | kfree(viodev); |
191 | return NULL; | 194 | return NULL; |
diff --git a/arch/ppc64/kernel/vio.c b/arch/ppc64/kernel/vio.c index 7798f01f77b4..3eab2290b12a 100644 --- a/arch/ppc64/kernel/vio.c +++ b/arch/ppc64/kernel/vio.c | |||
@@ -171,14 +171,8 @@ static ssize_t viodev_show_name(struct device *dev, | |||
171 | } | 171 | } |
172 | DEVICE_ATTR(name, S_IRUSR | S_IRGRP | S_IROTH, viodev_show_name, NULL); | 172 | DEVICE_ATTR(name, S_IRUSR | S_IRGRP | S_IROTH, viodev_show_name, NULL); |
173 | 173 | ||
174 | struct vio_dev * __devinit vio_register_device_common( | 174 | struct vio_dev * __devinit vio_register_device(struct vio_dev *viodev) |
175 | struct vio_dev *viodev, char *name, char *type, | ||
176 | uint32_t unit_address, struct iommu_table *iommu_table) | ||
177 | { | 175 | { |
178 | viodev->name = name; | ||
179 | viodev->type = type; | ||
180 | viodev->unit_address = unit_address; | ||
181 | viodev->iommu_table = iommu_table; | ||
182 | /* init generic 'struct device' fields: */ | 176 | /* init generic 'struct device' fields: */ |
183 | viodev->dev.parent = &vio_bus_device.dev; | 177 | viodev->dev.parent = &vio_bus_device.dev; |
184 | viodev->dev.bus = &vio_bus_type; | 178 | viodev->dev.bus = &vio_bus_type; |