diff options
Diffstat (limited to 'arch/ppc64')
-rw-r--r-- | arch/ppc64/kernel/vio.c | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/arch/ppc64/kernel/vio.c b/arch/ppc64/kernel/vio.c index 3b790bafcaad..7798f01f77b4 100644 --- a/arch/ppc64/kernel/vio.c +++ b/arch/ppc64/kernel/vio.c | |||
@@ -37,9 +37,11 @@ static int (*is_match)(const struct vio_device_id *id, | |||
37 | static void (*unregister_device_callback)(struct vio_dev *dev); | 37 | static void (*unregister_device_callback)(struct vio_dev *dev); |
38 | static void (*release_device_callback)(struct device *dev); | 38 | static void (*release_device_callback)(struct device *dev); |
39 | 39 | ||
40 | /* convert from struct device to struct vio_dev and pass to driver. | 40 | /* |
41 | * Convert from struct device to struct vio_dev and pass to driver. | ||
41 | * dev->driver has already been set by generic code because vio_bus_match | 42 | * dev->driver has already been set by generic code because vio_bus_match |
42 | * succeeded. */ | 43 | * succeeded. |
44 | */ | ||
43 | static int vio_bus_probe(struct device *dev) | 45 | static int vio_bus_probe(struct device *dev) |
44 | { | 46 | { |
45 | struct vio_dev *viodev = to_vio_dev(dev); | 47 | struct vio_dev *viodev = to_vio_dev(dev); |
@@ -51,9 +53,8 @@ static int vio_bus_probe(struct device *dev) | |||
51 | return error; | 53 | return error; |
52 | 54 | ||
53 | id = vio_match_device(viodrv->id_table, viodev); | 55 | id = vio_match_device(viodrv->id_table, viodev); |
54 | if (id) { | 56 | if (id) |
55 | error = viodrv->probe(viodev, id); | 57 | error = viodrv->probe(viodev, id); |
56 | } | ||
57 | 58 | ||
58 | return error; | 59 | return error; |
59 | } | 60 | } |
@@ -64,9 +65,8 @@ static int vio_bus_remove(struct device *dev) | |||
64 | struct vio_dev *viodev = to_vio_dev(dev); | 65 | struct vio_dev *viodev = to_vio_dev(dev); |
65 | struct vio_driver *viodrv = to_vio_driver(dev->driver); | 66 | struct vio_driver *viodrv = to_vio_driver(dev->driver); |
66 | 67 | ||
67 | if (viodrv->remove) { | 68 | if (viodrv->remove) |
68 | return viodrv->remove(viodev); | 69 | return viodrv->remove(viodev); |
69 | } | ||
70 | 70 | ||
71 | /* driver can't remove */ | 71 | /* driver can't remove */ |
72 | return 1; | 72 | return 1; |
@@ -102,16 +102,17 @@ void vio_unregister_driver(struct vio_driver *viodrv) | |||
102 | EXPORT_SYMBOL(vio_unregister_driver); | 102 | EXPORT_SYMBOL(vio_unregister_driver); |
103 | 103 | ||
104 | /** | 104 | /** |
105 | * vio_match_device: - Tell if a VIO device has a matching VIO device id structure. | 105 | * vio_match_device: - Tell if a VIO device has a matching |
106 | * @ids: array of VIO device id structures to search in | 106 | * VIO device id structure. |
107 | * @dev: the VIO device structure to match against | 107 | * @ids: array of VIO device id structures to search in |
108 | * @dev: the VIO device structure to match against | ||
108 | * | 109 | * |
109 | * Used by a driver to check whether a VIO device present in the | 110 | * Used by a driver to check whether a VIO device present in the |
110 | * system is in its list of supported devices. Returns the matching | 111 | * system is in its list of supported devices. Returns the matching |
111 | * vio_device_id structure or NULL if there is no match. | 112 | * vio_device_id structure or NULL if there is no match. |
112 | */ | 113 | */ |
113 | static const struct vio_device_id * vio_match_device(const struct vio_device_id *ids, | 114 | static const struct vio_device_id *vio_match_device( |
114 | const struct vio_dev *dev) | 115 | const struct vio_device_id *ids, const struct vio_dev *dev) |
115 | { | 116 | { |
116 | while (ids->type) { | 117 | while (ids->type) { |
117 | if (is_match(ids, dev)) | 118 | if (is_match(ids, dev)) |
@@ -141,7 +142,8 @@ int __init vio_bus_init(int (*match_func)(const struct vio_device_id *id, | |||
141 | return err; | 142 | return err; |
142 | } | 143 | } |
143 | 144 | ||
144 | /* the fake parent of all vio devices, just to give us | 145 | /* |
146 | * The fake parent of all vio devices, just to give us | ||
145 | * a nice directory | 147 | * a nice directory |
146 | */ | 148 | */ |
147 | err = device_register(&vio_bus_device.dev); | 149 | err = device_register(&vio_bus_device.dev); |
@@ -162,7 +164,8 @@ static void __devinit vio_dev_release(struct device *dev) | |||
162 | kfree(to_vio_dev(dev)); | 164 | kfree(to_vio_dev(dev)); |
163 | } | 165 | } |
164 | 166 | ||
165 | static ssize_t viodev_show_name(struct device *dev, struct device_attribute *attr, char *buf) | 167 | static ssize_t viodev_show_name(struct device *dev, |
168 | struct device_attribute *attr, char *buf) | ||
166 | { | 169 | { |
167 | return sprintf(buf, "%s\n", to_vio_dev(dev)->name); | 170 | return sprintf(buf, "%s\n", to_vio_dev(dev)->name); |
168 | } | 171 | } |
@@ -262,16 +265,8 @@ static int vio_bus_match(struct device *dev, struct device_driver *drv) | |||
262 | const struct vio_dev *vio_dev = to_vio_dev(dev); | 265 | const struct vio_dev *vio_dev = to_vio_dev(dev); |
263 | struct vio_driver *vio_drv = to_vio_driver(drv); | 266 | struct vio_driver *vio_drv = to_vio_driver(drv); |
264 | const struct vio_device_id *ids = vio_drv->id_table; | 267 | const struct vio_device_id *ids = vio_drv->id_table; |
265 | const struct vio_device_id *found_id; | ||
266 | |||
267 | if (!ids) | ||
268 | return 0; | ||
269 | 268 | ||
270 | found_id = vio_match_device(ids, vio_dev); | 269 | return (ids != NULL) && (vio_match_device(ids, vio_dev) != NULL); |
271 | if (found_id) | ||
272 | return 1; | ||
273 | |||
274 | return 0; | ||
275 | } | 270 | } |
276 | 271 | ||
277 | struct bus_type vio_bus_type = { | 272 | struct bus_type vio_bus_type = { |