aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2005-08-17 02:37:35 -0400
committerPaul Mackerras <paulus@samba.org>2005-08-29 23:08:53 -0400
commit5c0b4b8759f78c31172088a91e10733fc014ccee (patch)
tree85dc031ac08abe63476ae3230d9385b7bf972906
parent1e4a79e0458beca871c662028610ae3a88e3f1bf (diff)
[PATCH] Formatting changes to vio.c
Formatting changes to vio.c to bring it closer to the kernel coding standard. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--arch/ppc64/kernel/vio.c39
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,
37static void (*unregister_device_callback)(struct vio_dev *dev); 37static void (*unregister_device_callback)(struct vio_dev *dev);
38static void (*release_device_callback)(struct device *dev); 38static 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 */
43static int vio_bus_probe(struct device *dev) 45static 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)
102EXPORT_SYMBOL(vio_unregister_driver); 102EXPORT_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 */
113static const struct vio_device_id * vio_match_device(const struct vio_device_id *ids, 114static 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
165static ssize_t viodev_show_name(struct device *dev, struct device_attribute *attr, char *buf) 167static 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
277struct bus_type vio_bus_type = { 272struct bus_type vio_bus_type = {