aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/ibmebus.c
diff options
context:
space:
mode:
authorJoachim Fenkes <fenkes@de.ibm.com>2007-03-09 12:56:46 -0500
committerPaul Mackerras <paulus@samba.org>2007-03-16 01:38:19 -0400
commita83088003cd53f3cd8d550ab5d7778866568d204 (patch)
tree048d7ae1edf09489b741bf7c46172fed6e6f7c44 /arch/powerpc/kernel/ibmebus.c
parent556b09c8189b9b3f5626ca73196009e397503f85 (diff)
[POWERPC] ibmebus: whitespace fixes
This fixes a lot of whitespace in ibmebus.[ch] Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/ibmebus.c')
-rw-r--r--arch/powerpc/kernel/ibmebus.c126
1 files changed, 63 insertions, 63 deletions
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index 82bd2f10770f..061df3a066ae 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -3,35 +3,35 @@
3 * 3 *
4 * Copyright (c) 2005 IBM Corporation 4 * Copyright (c) 2005 IBM Corporation
5 * Heiko J Schick <schickhj@de.ibm.com> 5 * Heiko J Schick <schickhj@de.ibm.com>
6 * 6 *
7 * All rights reserved. 7 * All rights reserved.
8 * 8 *
9 * This source code is distributed under a dual license of GPL v2.0 and OpenIB 9 * This source code is distributed under a dual license of GPL v2.0 and OpenIB
10 * BSD. 10 * BSD.
11 * 11 *
12 * OpenIB BSD License 12 * OpenIB BSD License
13 * 13 *
14 * Redistribution and use in source and binary forms, with or without 14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions are met: 15 * modification, are permitted provided that the following conditions are met:
16 * 16 *
17 * Redistributions of source code must retain the above copyright notice, this 17 * Redistributions of source code must retain the above copyright notice, this
18 * list of conditions and the following disclaimer. 18 * list of conditions and the following disclaimer.
19 * 19 *
20 * Redistributions in binary form must reproduce the above copyright notice, 20 * Redistributions in binary form must reproduce the above copyright notice,
21 * this list of conditions and the following disclaimer in the documentation 21 * this list of conditions and the following disclaimer in the documentation
22 * and/or other materials 22 * and/or other materials
23 * provided with the distribution. 23 * provided with the distribution.
24 * 24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
32 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 32 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
33 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE. 35 * POSSIBILITY OF SUCH DAMAGE.
36 */ 36 */
37 37
@@ -55,7 +55,7 @@ static void *ibmebus_alloc_coherent(struct device *dev,
55 gfp_t flag) 55 gfp_t flag)
56{ 56{
57 void *mem; 57 void *mem;
58 58
59 mem = kmalloc(size, flag); 59 mem = kmalloc(size, flag);
60 *dma_handle = (dma_addr_t)mem; 60 *dma_handle = (dma_addr_t)mem;
61 61
@@ -63,7 +63,7 @@ static void *ibmebus_alloc_coherent(struct device *dev,
63} 63}
64 64
65static void ibmebus_free_coherent(struct device *dev, 65static void ibmebus_free_coherent(struct device *dev,
66 size_t size, void *vaddr, 66 size_t size, void *vaddr,
67 dma_addr_t dma_handle) 67 dma_addr_t dma_handle)
68{ 68{
69 kfree(vaddr); 69 kfree(vaddr);
@@ -79,7 +79,7 @@ static dma_addr_t ibmebus_map_single(struct device *dev,
79 79
80static void ibmebus_unmap_single(struct device *dev, 80static void ibmebus_unmap_single(struct device *dev,
81 dma_addr_t dma_addr, 81 dma_addr_t dma_addr,
82 size_t size, 82 size_t size,
83 enum dma_data_direction direction) 83 enum dma_data_direction direction)
84{ 84{
85 return; 85 return;
@@ -90,13 +90,13 @@ static int ibmebus_map_sg(struct device *dev,
90 int nents, enum dma_data_direction direction) 90 int nents, enum dma_data_direction direction)
91{ 91{
92 int i; 92 int i;
93 93
94 for (i = 0; i < nents; i++) { 94 for (i = 0; i < nents; i++) {
95 sg[i].dma_address = (dma_addr_t)page_address(sg[i].page) 95 sg[i].dma_address = (dma_addr_t)page_address(sg[i].page)
96 + sg[i].offset; 96 + sg[i].offset;
97 sg[i].dma_length = sg[i].length; 97 sg[i].dma_length = sg[i].length;
98 } 98 }
99 99
100 return nents; 100 return nents;
101} 101}
102 102
@@ -128,15 +128,15 @@ static int ibmebus_bus_probe(struct device *dev)
128 struct ibmebus_driver *ibmebusdrv = to_ibmebus_driver(dev->driver); 128 struct ibmebus_driver *ibmebusdrv = to_ibmebus_driver(dev->driver);
129 const struct of_device_id *id; 129 const struct of_device_id *id;
130 int error = -ENODEV; 130 int error = -ENODEV;
131 131
132 if (!ibmebusdrv->probe) 132 if (!ibmebusdrv->probe)
133 return error; 133 return error;
134 134
135 id = of_match_device(ibmebusdrv->id_table, &ibmebusdev->ofdev); 135 id = of_match_device(ibmebusdrv->id_table, &ibmebusdev->ofdev);
136 if (id) { 136 if (id) {
137 error = ibmebusdrv->probe(ibmebusdev, id); 137 error = ibmebusdrv->probe(ibmebusdev, id);
138 } 138 }
139 139
140 return error; 140 return error;
141} 141}
142 142
@@ -144,11 +144,11 @@ static int ibmebus_bus_remove(struct device *dev)
144{ 144{
145 struct ibmebus_dev *ibmebusdev = to_ibmebus_dev(dev); 145 struct ibmebus_dev *ibmebusdev = to_ibmebus_dev(dev);
146 struct ibmebus_driver *ibmebusdrv = to_ibmebus_driver(dev->driver); 146 struct ibmebus_driver *ibmebusdrv = to_ibmebus_driver(dev->driver);
147 147
148 if (ibmebusdrv->remove) { 148 if (ibmebusdrv->remove) {
149 return ibmebusdrv->remove(ibmebusdev); 149 return ibmebusdrv->remove(ibmebusdev);
150 } 150 }
151 151
152 return 0; 152 return 0;
153} 153}
154 154
@@ -158,12 +158,12 @@ static void __devinit ibmebus_dev_release(struct device *dev)
158 kfree(to_ibmebus_dev(dev)); 158 kfree(to_ibmebus_dev(dev));
159} 159}
160 160
161static ssize_t ibmebusdev_show_name(struct device *dev, 161static ssize_t ibmebusdev_show_name(struct device *dev,
162 struct device_attribute *attr, char *buf) 162 struct device_attribute *attr, char *buf)
163{ 163{
164 return sprintf(buf, "%s\n", to_ibmebus_dev(dev)->name); 164 return sprintf(buf, "%s\n", to_ibmebus_dev(dev)->name);
165} 165}
166static DEVICE_ATTR(name, S_IRUSR | S_IRGRP | S_IROTH, ibmebusdev_show_name, 166static DEVICE_ATTR(name, S_IRUSR | S_IRGRP | S_IROTH, ibmebusdev_show_name,
167 NULL); 167 NULL);
168 168
169static struct ibmebus_dev* __devinit ibmebus_register_device_common( 169static struct ibmebus_dev* __devinit ibmebus_register_device_common(
@@ -181,16 +181,16 @@ static struct ibmebus_dev* __devinit ibmebus_register_device_common(
181 dev->ofdev.dev.archdata.numa_node = of_node_to_nid(dev->ofdev.node); 181 dev->ofdev.dev.archdata.numa_node = of_node_to_nid(dev->ofdev.node);
182 182
183 /* An ibmebusdev is based on a of_device. We have to change the 183 /* An ibmebusdev is based on a of_device. We have to change the
184 * bus type to use our own DMA mapping operations. 184 * bus type to use our own DMA mapping operations.
185 */ 185 */
186 if ((err = of_device_register(&dev->ofdev)) != 0) { 186 if ((err = of_device_register(&dev->ofdev)) != 0) {
187 printk(KERN_ERR "%s: failed to register device (%d).\n", 187 printk(KERN_ERR "%s: failed to register device (%d).\n",
188 __FUNCTION__, err); 188 __FUNCTION__, err);
189 return NULL; 189 return NULL;
190 } 190 }
191 191
192 device_create_file(&dev->ofdev.dev, &dev_attr_name); 192 device_create_file(&dev->ofdev.dev, &dev_attr_name);
193 193
194 return dev; 194 return dev;
195} 195}
196 196
@@ -207,7 +207,7 @@ static struct ibmebus_dev* __devinit ibmebus_register_device_node(
207 __FUNCTION__, dn->name ? dn->name : "<unknown>"); 207 __FUNCTION__, dn->name ? dn->name : "<unknown>");
208 return NULL; 208 return NULL;
209 } 209 }
210 210
211 if (strlen(loc_code) == 0) { 211 if (strlen(loc_code) == 0) {
212 printk(KERN_WARNING "%s: 'ibm,loc-code' is invalid\n", 212 printk(KERN_WARNING "%s: 'ibm,loc-code' is invalid\n",
213 __FUNCTION__); 213 __FUNCTION__);
@@ -220,10 +220,10 @@ static struct ibmebus_dev* __devinit ibmebus_register_device_node(
220 } 220 }
221 221
222 dev->ofdev.node = of_node_get(dn); 222 dev->ofdev.node = of_node_get(dn);
223 223
224 length = strlen(loc_code); 224 length = strlen(loc_code);
225 memcpy(dev->ofdev.dev.bus_id, loc_code 225 memcpy(dev->ofdev.dev.bus_id, loc_code
226 + (length - min(length, BUS_ID_SIZE - 1)), 226 + (length - min(length, BUS_ID_SIZE - 1)),
227 min(length, BUS_ID_SIZE - 1)); 227 min(length, BUS_ID_SIZE - 1));
228 228
229 /* Register with generic device framework. */ 229 /* Register with generic device framework. */
@@ -238,17 +238,17 @@ static struct ibmebus_dev* __devinit ibmebus_register_device_node(
238static void ibmebus_probe_of_nodes(char* name) 238static void ibmebus_probe_of_nodes(char* name)
239{ 239{
240 struct device_node *dn = NULL; 240 struct device_node *dn = NULL;
241 241
242 while ((dn = of_find_node_by_name(dn, name))) { 242 while ((dn = of_find_node_by_name(dn, name))) {
243 if (ibmebus_register_device_node(dn) == NULL) { 243 if (ibmebus_register_device_node(dn) == NULL) {
244 of_node_put(dn); 244 of_node_put(dn);
245 245
246 return; 246 return;
247 } 247 }
248 } 248 }
249 249
250 of_node_put(dn); 250 of_node_put(dn);
251 251
252 return; 252 return;
253} 253}
254 254
@@ -266,7 +266,7 @@ static int ibmebus_match_helper(struct device *dev, void *data)
266{ 266{
267 if (strcmp((char*)data, to_ibmebus_dev(dev)->name) == 0) 267 if (strcmp((char*)data, to_ibmebus_dev(dev)->name) == 0)
268 return 1; 268 return 1;
269 269
270 return 0; 270 return 0;
271} 271}
272 272
@@ -281,17 +281,17 @@ static int ibmebus_unregister_device(struct device *dev)
281static void ibmebus_remove_devices_by_id(struct of_device_id *idt) 281static void ibmebus_remove_devices_by_id(struct of_device_id *idt)
282{ 282{
283 struct device *dev; 283 struct device *dev;
284 284
285 while (strlen(idt->name) > 0) { 285 while (strlen(idt->name) > 0) {
286 while ((dev = bus_find_device(&ibmebus_bus_type, NULL, 286 while ((dev = bus_find_device(&ibmebus_bus_type, NULL,
287 (void*)idt->name, 287 (void*)idt->name,
288 ibmebus_match_helper))) { 288 ibmebus_match_helper))) {
289 ibmebus_unregister_device(dev); 289 ibmebus_unregister_device(dev);
290 } 290 }
291 idt++; 291 idt++;
292 292
293 } 293 }
294 294
295 return; 295 return;
296} 296}
297 297
@@ -308,29 +308,29 @@ int ibmebus_register_driver(struct ibmebus_driver *drv)
308 return err; 308 return err;
309 309
310 ibmebus_add_devices_by_id(drv->id_table); 310 ibmebus_add_devices_by_id(drv->id_table);
311 311
312 return 0; 312 return 0;
313} 313}
314EXPORT_SYMBOL(ibmebus_register_driver); 314EXPORT_SYMBOL(ibmebus_register_driver);
315 315
316void ibmebus_unregister_driver(struct ibmebus_driver *drv) 316void ibmebus_unregister_driver(struct ibmebus_driver *drv)
317{ 317{
318 driver_unregister(&drv->driver); 318 driver_unregister(&drv->driver);
319 ibmebus_remove_devices_by_id(drv->id_table); 319 ibmebus_remove_devices_by_id(drv->id_table);
320} 320}
321EXPORT_SYMBOL(ibmebus_unregister_driver); 321EXPORT_SYMBOL(ibmebus_unregister_driver);
322 322
323int ibmebus_request_irq(struct ibmebus_dev *dev, 323int ibmebus_request_irq(struct ibmebus_dev *dev,
324 u32 ist, 324 u32 ist,
325 irq_handler_t handler, 325 irq_handler_t handler,
326 unsigned long irq_flags, const char * devname, 326 unsigned long irq_flags, const char * devname,
327 void *dev_id) 327 void *dev_id)
328{ 328{
329 unsigned int irq = irq_create_mapping(NULL, ist); 329 unsigned int irq = irq_create_mapping(NULL, ist);
330 330
331 if (irq == NO_IRQ) 331 if (irq == NO_IRQ)
332 return -EINVAL; 332 return -EINVAL;
333 333
334 return request_irq(irq, handler, 334 return request_irq(irq, handler,
335 irq_flags, devname, dev_id); 335 irq_flags, devname, dev_id);
336} 336}
@@ -339,25 +339,25 @@ EXPORT_SYMBOL(ibmebus_request_irq);
339void ibmebus_free_irq(struct ibmebus_dev *dev, u32 ist, void *dev_id) 339void ibmebus_free_irq(struct ibmebus_dev *dev, u32 ist, void *dev_id)
340{ 340{
341 unsigned int irq = irq_find_mapping(NULL, ist); 341 unsigned int irq = irq_find_mapping(NULL, ist);
342 342
343 free_irq(irq, dev_id); 343 free_irq(irq, dev_id);
344} 344}
345EXPORT_SYMBOL(ibmebus_free_irq); 345EXPORT_SYMBOL(ibmebus_free_irq);
346 346
347static int ibmebus_bus_match(struct device *dev, struct device_driver *drv) 347static int ibmebus_bus_match(struct device *dev, struct device_driver *drv)
348{ 348{
349 const struct ibmebus_dev *ebus_dev = to_ibmebus_dev(dev); 349 const struct ibmebus_dev *ebus_dev = to_ibmebus_dev(dev);
350 struct ibmebus_driver *ebus_drv = to_ibmebus_driver(drv); 350 struct ibmebus_driver *ebus_drv = to_ibmebus_driver(drv);
351 const struct of_device_id *ids = ebus_drv->id_table; 351 const struct of_device_id *ids = ebus_drv->id_table;
352 const struct of_device_id *found_id; 352 const struct of_device_id *found_id;
353 353
354 if (!ids) 354 if (!ids)
355 return 0; 355 return 0;
356 356
357 found_id = of_match_device(ids, &ebus_dev->ofdev); 357 found_id = of_match_device(ids, &ebus_dev->ofdev);
358 if (found_id) 358 if (found_id)
359 return 1; 359 return 1;
360 360
361 return 0; 361 return 0;
362} 362}
363 363
@@ -370,25 +370,25 @@ EXPORT_SYMBOL(ibmebus_bus_type);
370static int __init ibmebus_bus_init(void) 370static int __init ibmebus_bus_init(void)
371{ 371{
372 int err; 372 int err;
373 373
374 printk(KERN_INFO "IBM eBus Device Driver\n"); 374 printk(KERN_INFO "IBM eBus Device Driver\n");
375 375
376 err = bus_register(&ibmebus_bus_type); 376 err = bus_register(&ibmebus_bus_type);
377 if (err) { 377 if (err) {
378 printk(KERN_ERR ":%s: failed to register IBM eBus.\n", 378 printk(KERN_ERR ":%s: failed to register IBM eBus.\n",
379 __FUNCTION__); 379 __FUNCTION__);
380 return err; 380 return err;
381 } 381 }
382 382
383 err = device_register(&ibmebus_bus_device.ofdev.dev); 383 err = device_register(&ibmebus_bus_device.ofdev.dev);
384 if (err) { 384 if (err) {
385 printk(KERN_WARNING "%s: device_register returned %i\n", 385 printk(KERN_WARNING "%s: device_register returned %i\n",
386 __FUNCTION__, err); 386 __FUNCTION__, err);
387 bus_unregister(&ibmebus_bus_type); 387 bus_unregister(&ibmebus_bus_type);
388 388
389 return err; 389 return err;
390 } 390 }
391 391
392 return 0; 392 return 0;
393} 393}
394__initcall(ibmebus_bus_init); 394__initcall(ibmebus_bus_init);