diff options
| author | Stephen Rothwell <sfr@canb.auug.org.au> | 2005-08-17 02:41:44 -0400 |
|---|---|---|
| committer | Paul Mackerras <paulus@samba.org> | 2005-08-29 23:23:47 -0400 |
| commit | 71d276d751ff5ddba28312aecefb174b20a5b970 (patch) | |
| tree | 1d2262f427fb0e117d0ad464eaf3375373e166f8 | |
| parent | b877b90f227fb9698d99fb70492d432362584082 (diff) | |
[PATCH] Create vio_bus_ops
Create vio_bus_ops so that we just pass a structure to vio_bus_init
instead of three separate function pointers.
Rearrange vio.h to avoid forward references. vio.h only needs
struct device_node from prom.h so remove the include and just
declare it.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
| -rw-r--r-- | arch/ppc64/kernel/iSeries_vio.c | 6 | ||||
| -rw-r--r-- | arch/ppc64/kernel/pSeries_vio.c | 10 | ||||
| -rw-r--r-- | arch/ppc64/kernel/vio.c | 24 | ||||
| -rw-r--r-- | drivers/scsi/ibmvscsi/rpa_vscsi.c | 1 | ||||
| -rw-r--r-- | include/asm-ppc64/vio.h | 97 |
5 files changed, 69 insertions, 69 deletions
diff --git a/arch/ppc64/kernel/iSeries_vio.c b/arch/ppc64/kernel/iSeries_vio.c index d0960a82708c..6b754b0c8344 100644 --- a/arch/ppc64/kernel/iSeries_vio.c +++ b/arch/ppc64/kernel/iSeries_vio.c | |||
| @@ -131,6 +131,10 @@ static int vio_match_device_iseries(const struct vio_device_id *id, | |||
| 131 | return strncmp(dev->type, id->type, strlen(id->type)) == 0; | 131 | return strncmp(dev->type, id->type, strlen(id->type)) == 0; |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | static struct vio_bus_ops vio_bus_ops_iseries = { | ||
| 135 | .match = vio_match_device_iseries, | ||
| 136 | }; | ||
| 137 | |||
| 134 | /** | 138 | /** |
| 135 | * vio_bus_init_iseries: - Initialize the iSeries virtual IO bus | 139 | * vio_bus_init_iseries: - Initialize the iSeries virtual IO bus |
| 136 | */ | 140 | */ |
| @@ -138,7 +142,7 @@ static int __init vio_bus_init_iseries(void) | |||
| 138 | { | 142 | { |
| 139 | int err; | 143 | int err; |
| 140 | 144 | ||
| 141 | err = vio_bus_init(vio_match_device_iseries, NULL, NULL); | 145 | err = vio_bus_init(&vio_bus_ops_iseries); |
| 142 | if (err == 0) { | 146 | if (err == 0) { |
| 143 | iommu_vio_init(); | 147 | iommu_vio_init(); |
| 144 | vio_bus_device.iommu_table = &vio_iommu_table; | 148 | vio_bus_device.iommu_table = &vio_iommu_table; |
diff --git a/arch/ppc64/kernel/pSeries_vio.c b/arch/ppc64/kernel/pSeries_vio.c index 81e94f8aa846..e0ae06f58f86 100644 --- a/arch/ppc64/kernel/pSeries_vio.c +++ b/arch/ppc64/kernel/pSeries_vio.c | |||
| @@ -76,6 +76,12 @@ static void vio_unregister_device_pseries(struct vio_dev *viodev) | |||
| 76 | device_remove_file(&viodev->dev, &dev_attr_devspec); | 76 | device_remove_file(&viodev->dev, &dev_attr_devspec); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | static struct vio_bus_ops vio_bus_ops_pseries = { | ||
| 80 | .match = vio_match_device_pseries, | ||
| 81 | .unregister_device = vio_unregister_device_pseries, | ||
| 82 | .release_device = vio_release_device_pseries, | ||
| 83 | }; | ||
| 84 | |||
| 79 | /** | 85 | /** |
| 80 | * vio_bus_init_pseries: - Initialize the pSeries virtual IO bus | 86 | * vio_bus_init_pseries: - Initialize the pSeries virtual IO bus |
| 81 | */ | 87 | */ |
| @@ -83,9 +89,7 @@ static int __init vio_bus_init_pseries(void) | |||
| 83 | { | 89 | { |
| 84 | int err; | 90 | int err; |
| 85 | 91 | ||
| 86 | err = vio_bus_init(vio_match_device_pseries, | 92 | err = vio_bus_init(&vio_bus_ops_pseries); |
| 87 | vio_unregister_device_pseries, | ||
| 88 | vio_release_device_pseries); | ||
| 89 | if (err == 0) | 93 | if (err == 0) |
| 90 | probe_bus_pseries(); | 94 | probe_bus_pseries(); |
| 91 | return err; | 95 | return err; |
diff --git a/arch/ppc64/kernel/vio.c b/arch/ppc64/kernel/vio.c index 3eab2290b12a..93c437a0911b 100644 --- a/arch/ppc64/kernel/vio.c +++ b/arch/ppc64/kernel/vio.c | |||
| @@ -32,10 +32,7 @@ struct vio_dev vio_bus_device = { /* fake "parent" device */ | |||
| 32 | .dev.bus = &vio_bus_type, | 32 | .dev.bus = &vio_bus_type, |
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| 35 | static int (*is_match)(const struct vio_device_id *id, | 35 | static struct vio_bus_ops vio_bus_ops; |
| 36 | const struct vio_dev *dev); | ||
| 37 | static void (*unregister_device_callback)(struct vio_dev *dev); | ||
| 38 | static void (*release_device_callback)(struct device *dev); | ||
| 39 | 36 | ||
| 40 | /* | 37 | /* |
| 41 | * Convert from struct device to struct vio_dev and pass to driver. | 38 | * Convert from struct device to struct vio_dev and pass to driver. |
| @@ -115,7 +112,7 @@ static const struct vio_device_id *vio_match_device( | |||
| 115 | const struct vio_device_id *ids, const struct vio_dev *dev) | 112 | const struct vio_device_id *ids, const struct vio_dev *dev) |
| 116 | { | 113 | { |
| 117 | while (ids->type) { | 114 | while (ids->type) { |
| 118 | if (is_match(ids, dev)) | 115 | if (vio_bus_ops.match(ids, dev)) |
| 119 | return ids; | 116 | return ids; |
| 120 | ids++; | 117 | ids++; |
| 121 | } | 118 | } |
| @@ -125,16 +122,11 @@ static const struct vio_device_id *vio_match_device( | |||
| 125 | /** | 122 | /** |
| 126 | * vio_bus_init: - Initialize the virtual IO bus | 123 | * vio_bus_init: - Initialize the virtual IO bus |
| 127 | */ | 124 | */ |
| 128 | int __init vio_bus_init(int (*match_func)(const struct vio_device_id *id, | 125 | int __init vio_bus_init(struct vio_bus_ops *ops) |
| 129 | const struct vio_dev *dev), | ||
| 130 | void (*unregister_dev)(struct vio_dev *), | ||
| 131 | void (*release_dev)(struct device *)) | ||
| 132 | { | 126 | { |
| 133 | int err; | 127 | int err; |
| 134 | 128 | ||
| 135 | is_match = match_func; | 129 | vio_bus_ops = *ops; |
| 136 | unregister_device_callback = unregister_dev; | ||
| 137 | release_device_callback = release_dev; | ||
| 138 | 130 | ||
| 139 | err = bus_register(&vio_bus_type); | 131 | err = bus_register(&vio_bus_type); |
| 140 | if (err) { | 132 | if (err) { |
| @@ -159,8 +151,8 @@ int __init vio_bus_init(int (*match_func)(const struct vio_device_id *id, | |||
| 159 | /* vio_dev refcount hit 0 */ | 151 | /* vio_dev refcount hit 0 */ |
| 160 | static void __devinit vio_dev_release(struct device *dev) | 152 | static void __devinit vio_dev_release(struct device *dev) |
| 161 | { | 153 | { |
| 162 | if (release_device_callback) | 154 | if (vio_bus_ops.release_device) |
| 163 | release_device_callback(dev); | 155 | vio_bus_ops.release_device(dev); |
| 164 | kfree(to_vio_dev(dev)); | 156 | kfree(to_vio_dev(dev)); |
| 165 | } | 157 | } |
| 166 | 158 | ||
| @@ -191,8 +183,8 @@ struct vio_dev * __devinit vio_register_device(struct vio_dev *viodev) | |||
| 191 | 183 | ||
| 192 | void __devinit vio_unregister_device(struct vio_dev *viodev) | 184 | void __devinit vio_unregister_device(struct vio_dev *viodev) |
| 193 | { | 185 | { |
| 194 | if (unregister_device_callback) | 186 | if (vio_bus_ops.unregister_device) |
| 195 | unregister_device_callback(viodev); | 187 | vio_bus_ops.unregister_device(viodev); |
| 196 | device_remove_file(&viodev->dev, &dev_attr_name); | 188 | device_remove_file(&viodev->dev, &dev_attr_name); |
| 197 | device_unregister(&viodev->dev); | 189 | device_unregister(&viodev->dev); |
| 198 | } | 190 | } |
diff --git a/drivers/scsi/ibmvscsi/rpa_vscsi.c b/drivers/scsi/ibmvscsi/rpa_vscsi.c index 035f615817d7..8bf5652f1060 100644 --- a/drivers/scsi/ibmvscsi/rpa_vscsi.c +++ b/drivers/scsi/ibmvscsi/rpa_vscsi.c | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | */ | 28 | */ |
| 29 | 29 | ||
| 30 | #include <asm/vio.h> | 30 | #include <asm/vio.h> |
| 31 | #include <asm/prom.h> | ||
| 31 | #include <asm/iommu.h> | 32 | #include <asm/iommu.h> |
| 32 | #include <asm/hvcall.h> | 33 | #include <asm/hvcall.h> |
| 33 | #include <linux/dma-mapping.h> | 34 | #include <linux/dma-mapping.h> |
diff --git a/include/asm-ppc64/vio.h b/include/asm-ppc64/vio.h index 578e30193b7b..85420bb37d58 100644 --- a/include/asm-ppc64/vio.h +++ b/include/asm-ppc64/vio.h | |||
| @@ -19,13 +19,14 @@ | |||
| 19 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
| 20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
| 21 | #include <linux/dma-mapping.h> | 21 | #include <linux/dma-mapping.h> |
| 22 | |||
| 22 | #include <asm/hvcall.h> | 23 | #include <asm/hvcall.h> |
| 23 | #include <asm/prom.h> | ||
| 24 | #include <asm/scatterlist.h> | 24 | #include <asm/scatterlist.h> |
| 25 | /* | 25 | |
| 26 | /* | ||
| 26 | * Architecture-specific constants for drivers to | 27 | * Architecture-specific constants for drivers to |
| 27 | * extract attributes of the device using vio_get_attribute() | 28 | * extract attributes of the device using vio_get_attribute() |
| 28 | */ | 29 | */ |
| 29 | #define VETH_MAC_ADDR "local-mac-address" | 30 | #define VETH_MAC_ADDR "local-mac-address" |
| 30 | #define VETH_MCAST_FILTER_SIZE "ibm,mac-address-filters" | 31 | #define VETH_MCAST_FILTER_SIZE "ibm,mac-address-filters" |
| 31 | 32 | ||
| @@ -37,30 +38,19 @@ | |||
| 37 | #define VIO_IRQ_DISABLE 0UL | 38 | #define VIO_IRQ_DISABLE 0UL |
| 38 | #define VIO_IRQ_ENABLE 1UL | 39 | #define VIO_IRQ_ENABLE 1UL |
| 39 | 40 | ||
| 40 | struct vio_dev; | ||
| 41 | struct vio_driver; | ||
| 42 | struct vio_device_id; | ||
| 43 | struct iommu_table; | 41 | struct iommu_table; |
| 44 | 42 | ||
| 45 | int vio_register_driver(struct vio_driver *drv); | 43 | /* |
| 46 | void vio_unregister_driver(struct vio_driver *drv); | 44 | * The vio_dev structure is used to describe virtual I/O devices. |
| 47 | 45 | */ | |
| 48 | #ifdef CONFIG_PPC_PSERIES | 46 | struct vio_dev { |
| 49 | struct vio_dev * __devinit vio_register_device_node( | 47 | struct iommu_table *iommu_table; /* vio_map_* uses this */ |
| 50 | struct device_node *node_vdev); | 48 | char *name; |
| 51 | #endif | ||
