Commit 5c0b4b8759f78c31172088a91e10733fc014ccee
Committed by
Paul Mackerras
1 parent
1e4a79e045
Exists in
master
and in
4 other branches
[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>
Showing 1 changed file with 17 additions and 22 deletions Side-by-side Diff
arch/ppc64/kernel/vio.c
| ... | ... | @@ -37,9 +37,11 @@ |
| 37 | 37 | static void (*unregister_device_callback)(struct vio_dev *dev); |
| 38 | 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 | 42 | * dev->driver has already been set by generic code because vio_bus_match |
| 42 | - * succeeded. */ | |
| 43 | + * succeeded. | |
| 44 | + */ | |
| 43 | 45 | static int vio_bus_probe(struct device *dev) |
| 44 | 46 | { |
| 45 | 47 | struct vio_dev *viodev = to_vio_dev(dev); |
| 46 | 48 | |
| ... | ... | @@ -51,9 +53,8 @@ |
| 51 | 53 | return error; |
| 52 | 54 | |
| 53 | 55 | id = vio_match_device(viodrv->id_table, viodev); |
| 54 | - if (id) { | |
| 56 | + if (id) | |
| 55 | 57 | error = viodrv->probe(viodev, id); |
| 56 | - } | |
| 57 | 58 | |
| 58 | 59 | return error; |
| 59 | 60 | } |
| 60 | 61 | |
| ... | ... | @@ -64,9 +65,8 @@ |
| 64 | 65 | struct vio_dev *viodev = to_vio_dev(dev); |
| 65 | 66 | struct vio_driver *viodrv = to_vio_driver(dev->driver); |
| 66 | 67 | |
| 67 | - if (viodrv->remove) { | |
| 68 | + if (viodrv->remove) | |
| 68 | 69 | return viodrv->remove(viodev); |
| 69 | - } | |
| 70 | 70 | |
| 71 | 71 | /* driver can't remove */ |
| 72 | 72 | return 1; |
| 73 | 73 | |
| ... | ... | @@ -102,16 +102,17 @@ |
| 102 | 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. | |
| 106 | - * @ids: array of VIO device id structures to search in | |
| 107 | - * @dev: the VIO device structure to match against | |
| 105 | + * vio_match_device: - Tell if a VIO device has a matching | |
| 106 | + * VIO device id structure. | |
| 107 | + * @ids: array of VIO device id structures to search in | |
| 108 | + * @dev: the VIO device structure to match against | |
| 108 | 109 | * |
| 109 | 110 | * Used by a driver to check whether a VIO device present in the |
| 110 | 111 | * system is in its list of supported devices. Returns the matching |
| 111 | 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 | - const struct vio_dev *dev) | |
| 114 | +static const struct vio_device_id *vio_match_device( | |
| 115 | + const struct vio_device_id *ids, const struct vio_dev *dev) | |
| 115 | 116 | { |
| 116 | 117 | while (ids->type) { |
| 117 | 118 | if (is_match(ids, dev)) |
| ... | ... | @@ -141,7 +142,8 @@ |
| 141 | 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 | 147 | * a nice directory |
| 146 | 148 | */ |
| 147 | 149 | err = device_register(&vio_bus_device.dev); |
| ... | ... | @@ -162,7 +164,8 @@ |
| 162 | 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 | 170 | return sprintf(buf, "%s\n", to_vio_dev(dev)->name); |
| 168 | 171 | } |
| 169 | 172 | |
| ... | ... | @@ -262,16 +265,8 @@ |
| 262 | 265 | const struct vio_dev *vio_dev = to_vio_dev(dev); |
| 263 | 266 | struct vio_driver *vio_drv = to_vio_driver(drv); |
| 264 | 267 | const struct vio_device_id *ids = vio_drv->id_table; |
| 265 | - const struct vio_device_id *found_id; | |
| 266 | 268 | |
| 267 | - if (!ids) | |
| 268 | - return 0; | |
| 269 | - | |
| 270 | - found_id = vio_match_device(ids, vio_dev); | |
| 271 | - if (found_id) | |
| 272 | - return 1; | |
| 273 | - | |
| 274 | - return 0; | |
| 269 | + return (ids != NULL) && (vio_match_device(ids, vio_dev) != NULL); | |
| 275 | 270 | } |
| 276 | 271 | |
| 277 | 272 | struct bus_type vio_bus_type = { |