aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64/kernel/vio.c
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2005-07-12 03:45:27 -0400
committerPaul Mackerras <paulus@samba.org>2005-08-28 20:53:32 -0400
commit6312236fe82bbd3b0e1dee60b3eb3b270a2f6aeb (patch)
treecf23f21d9d423e7999270cb4d7050697c72ea80b /arch/ppc64/kernel/vio.c
parent8c65b5c955b8598d9c63b4e97392377269873a54 (diff)
[PATCH] ppc64: make the bus matching function platform specific
This patch allows us to have a different bus if matching function for each platform. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/ppc64/kernel/vio.c')
-rw-r--r--arch/ppc64/kernel/vio.c28
1 files changed, 19 insertions, 9 deletions
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;