Commit b877b90f227fb9698d99fb70492d432362584082
Committed by
Paul Mackerras
1 parent
5c0b4b8759
Exists in
master
and in
4 other branches
[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>
Showing 4 changed files with 19 additions and 17 deletions Side-by-side Diff
arch/ppc64/kernel/iSeries_vio.c
| ... | ... | @@ -68,7 +68,7 @@ |
| 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 | 72 | * @voidev: The device to register. |
| 73 | 73 | */ |
| 74 | 74 | static struct vio_dev *__init vio_register_device_iseries(char *type, |
| ... | ... | @@ -76,7 +76,7 @@ |
| 76 | 76 | { |
| 77 | 77 | struct vio_dev *viodev; |
| 78 | 78 | |
| 79 | - /* allocate a vio_dev for this node */ | |
| 79 | + /* allocate a vio_dev for this device */ | |
| 80 | 80 | viodev = kmalloc(sizeof(struct vio_dev), GFP_KERNEL); |
| 81 | 81 | if (!viodev) |
| 82 | 82 | return NULL; |
| ... | ... | @@ -84,8 +84,15 @@ |
| 84 | 84 | |
| 85 | 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, | |
| 88 | - unit_num, &vio_iommu_table); | |
| 87 | + viodev->name = viodev->dev.bus_id; | |
| 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 | 98 | void __init probe_bus_iseries(void) |
arch/ppc64/kernel/pSeries_vio.c
| ... | ... | @@ -19,6 +19,7 @@ |
| 19 | 19 | #include <linux/kobject.h> |
| 20 | 20 | #include <asm/iommu.h> |
| 21 | 21 | #include <asm/dma.h> |
| 22 | +#include <asm/prom.h> | |
| 22 | 23 | #include <asm/vio.h> |
| 23 | 24 | #include <asm/hvcall.h> |
| 24 | 25 | |
| 25 | 26 | |
| ... | ... | @@ -181,11 +182,13 @@ |
| 181 | 182 | } |
| 182 | 183 | |
| 183 | 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 | 190 | /* register with generic device framework */ |
| 186 | - if (vio_register_device_common(viodev, of_node->name, of_node->type, | |
| 187 | - *unit_address, vio_build_iommu_table(viodev)) | |
| 188 | - == NULL) { | |
| 191 | + if (vio_register_device(viodev) == NULL) { | |
| 189 | 192 | /* XXX free TCE table */ |
| 190 | 193 | kfree(viodev); |
| 191 | 194 | return NULL; |
arch/ppc64/kernel/vio.c
| ... | ... | @@ -171,14 +171,8 @@ |
| 171 | 171 | } |
| 172 | 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( | |
| 175 | - struct vio_dev *viodev, char *name, char *type, | |
| 176 | - uint32_t unit_address, struct iommu_table *iommu_table) | |
| 174 | +struct vio_dev * __devinit vio_register_device(struct vio_dev *viodev) | |
| 177 | 175 | { |
| 178 | - viodev->name = name; | |
| 179 | - viodev->type = type; | |
| 180 | - viodev->unit_address = unit_address; | |
| 181 | - viodev->iommu_table = iommu_table; | |
| 182 | 176 | /* init generic 'struct device' fields: */ |
| 183 | 177 | viodev->dev.parent = &vio_bus_device.dev; |
| 184 | 178 | viodev->dev.bus = &vio_bus_type; |
include/asm-ppc64/vio.h
| ... | ... | @@ -56,9 +56,7 @@ |
| 56 | 56 | int vio_get_irq(struct vio_dev *dev); |
| 57 | 57 | int vio_enable_interrupts(struct vio_dev *dev); |
| 58 | 58 | int vio_disable_interrupts(struct vio_dev *dev); |
| 59 | -extern struct vio_dev * __devinit vio_register_device_common( | |
| 60 | - struct vio_dev *viodev, char *name, char *type, | |
| 61 | - uint32_t unit_address, struct iommu_table *iommu_table); | |
| 59 | +extern struct vio_dev * __devinit vio_register_device(struct vio_dev *viodev); | |
| 62 | 60 | |
| 63 | 61 | extern struct dma_mapping_ops vio_dma_ops; |
| 64 | 62 |