aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ppc64/kernel/iSeries_vio.c12
-rw-r--r--arch/ppc64/kernel/vio.c28
-rw-r--r--include/asm-ppc64/vio.h3
3 files changed, 32 insertions, 11 deletions
diff --git a/arch/ppc64/kernel/iSeries_vio.c b/arch/ppc64/kernel/iSeries_vio.c
index 48f0ebf4405d..2656b1ca834d 100644
--- a/arch/ppc64/kernel/iSeries_vio.c
+++ b/arch/ppc64/kernel/iSeries_vio.c
@@ -115,13 +115,23 @@ void __init probe_bus_iseries(void)
115} 115}
116 116
117/** 117/**
118 * vio_match_device_iseries: - Tell if a iSeries VIO device matches a
119 * vio_device_id
120 */
121static int vio_match_device_iseries(const struct vio_device_id *id,
122 const struct vio_dev *dev)
123{
124 return strncmp(dev->type, id->type, strlen(id->type)) == 0;
125}
126
127/**
118 * vio_bus_init_iseries: - Initialize the iSeries virtual IO bus 128 * vio_bus_init_iseries: - Initialize the iSeries virtual IO bus
119 */ 129 */
120static int __init vio_bus_init_iseries(void) 130static int __init vio_bus_init_iseries(void)
121{ 131{
122 int err; 132 int err;
123 133
124 err = vio_bus_init(); 134 err = vio_bus_init(vio_match_device_iseries);
125 if (err == 0) { 135 if (err == 0) {
126 iommu_vio_init(); 136 iommu_vio_init();
127 vio_bus_device.iommu_table = &vio_iommu_table; 137 vio_bus_device.iommu_table = &vio_iommu_table;
diff --git a/arch/ppc64/kernel/vio.c b/arch/ppc64/kernel/vio.c
index 4b9e3712e384..8a243cad0f8b 100644
--- a/arch/ppc64/kernel/vio.c
+++ b/arch/ppc64/kernel/vio.c
@@ -44,11 +44,8 @@ struct vio_dev vio_bus_device = { /* fake "parent" device */
44 .dev.bus = &vio_bus_type, 44 .dev.bus = &vio_bus_type,
45}; 45};
46 46
47#ifdef CONFIG_PPC_ISERIES 47static int (*is_match)(const struct vio_device_id *id,
48 48 const struct vio_dev *dev);
49#define device_is_compatible(a, b) 1
50
51#endif
52 49
53/* convert from struct device to struct vio_dev and pass to driver. 50/* convert from struct device to struct vio_dev and pass to driver.
54 * dev->driver has already been set by generic code because vio_bus_match 51 * dev->driver has already been set by generic code because vio_bus_match
@@ -133,8 +130,7 @@ static const struct vio_device_id * vio_match_device(const struct vio_device_id
133 DBGENTER(); 130 DBGENTER();
134 131
135 while (ids->type) { 132 while (ids->type) {
136 if ((strncmp(dev->type, ids->type, strlen(ids->type)) == 0) && 133 if (is_match(ids, dev))
137 device_is_compatible(dev->dev.platform_data, ids->compat))
138 return ids; 134 return ids;
139 ids++; 135 ids++;
140 } 136 }
@@ -168,10 +164,13 @@ static void probe_bus_pseries(void)
168/** 164/**
169 * vio_bus_init: - Initialize the virtual IO bus 165 * vio_bus_init: - Initialize the virtual IO bus
170 */ 166 */
171int __init vio_bus_init(void) 167int __init vio_bus_init(int (*match_func)(const struct vio_device_id *id,
168 const struct vio_dev *dev))
172{ 169{
173 int err; 170 int err;
174 171
172 is_match = match_func;
173
175 err = bus_register(&vio_bus_type); 174 err = bus_register(&vio_bus_type);
176 if (err) { 175 if (err) {
177 printk(KERN_ERR "failed to register VIO bus\n"); 176 printk(KERN_ERR "failed to register VIO bus\n");
@@ -193,13 +192,24 @@ int __init vio_bus_init(void)
193 192
194#ifdef CONFIG_PPC_PSERIES 193#ifdef CONFIG_PPC_PSERIES
195/** 194/**
195 * vio_match_device_pseries: - Tell if a pSeries VIO device matches a
196 * vio_device_id
197 */
198static int vio_match_device_pseries(const struct vio_device_id *id,
199 const struct vio_dev *dev)
200{
201 return (strncmp(dev->type, id->type, strlen(id->type)) == 0) &&
202 device_is_compatible(dev->dev.platform_data, id->compat);
203}
204
205/**
196 * vio_bus_init_pseries: - Initialize the pSeries virtual IO bus 206 * vio_bus_init_pseries: - Initialize the pSeries virtual IO bus
197 */ 207 */
198static int __init vio_bus_init_pseries(void) 208static int __init vio_bus_init_pseries(void)
199{ 209{
200 int err; 210 int err;
201 211
202 err = vio_bus_init(); 212 err = vio_bus_init(vio_match_device_pseries);
203 if (err == 0) 213 if (err == 0)
204 probe_bus_pseries(); 214 probe_bus_pseries();
205 return err; 215 return err;
diff --git a/include/asm-ppc64/vio.h b/include/asm-ppc64/vio.h
index 1e6d4c4b83a0..70644a232210 100644
--- a/include/asm-ppc64/vio.h
+++ b/include/asm-ppc64/vio.h
@@ -105,6 +105,7 @@ static inline struct vio_dev *to_vio_dev(struct device *dev)
105 return container_of(dev, struct vio_dev, dev); 105 return container_of(dev, struct vio_dev, dev);
106} 106}
107 107
108extern int vio_bus_init(void); 108extern int vio_bus_init(int (*is_match)(const struct vio_device_id *id,
109 const struct vio_dev *dev));
109 110
110#endif /* _ASM_VIO_H */ 111#endif /* _ASM_VIO_H */