Commit 5be3246306e613055505f4950411f5497d97edb0

Authored by Geert Uytterhoeven
1 parent 02f8c6aee8

m68k/amiga: Chip RAM - Use tabs for indentation

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Showing 1 changed file with 61 additions and 57 deletions Side-by-side Diff

arch/m68k/amiga/chipram.c
... ... @@ -23,101 +23,105 @@
23 23 EXPORT_SYMBOL(amiga_chip_size);
24 24  
25 25 static struct resource chipram_res = {
26   - .name = "Chip RAM", .start = CHIP_PHYSADDR
  26 + .name = "Chip RAM", .start = CHIP_PHYSADDR
27 27 };
28 28 static unsigned long chipavail;
29 29  
30 30  
31 31 void __init amiga_chip_init(void)
32 32 {
33   - if (!AMIGAHW_PRESENT(CHIP_RAM))
34   - return;
  33 + if (!AMIGAHW_PRESENT(CHIP_RAM))
  34 + return;
35 35  
36   - chipram_res.end = amiga_chip_size-1;
37   - request_resource(&iomem_resource, &chipram_res);
  36 + chipram_res.end = amiga_chip_size-1;
  37 + request_resource(&iomem_resource, &chipram_res);
38 38  
39   - chipavail = amiga_chip_size;
  39 + chipavail = amiga_chip_size;
40 40 }
41 41  
42 42  
43 43 void *amiga_chip_alloc(unsigned long size, const char *name)
44 44 {
45   - struct resource *res;
  45 + struct resource *res;
46 46  
47   - /* round up */
48   - size = PAGE_ALIGN(size);
  47 + /* round up */
  48 + size = PAGE_ALIGN(size);
49 49  
50 50 #ifdef DEBUG
51   - printk("amiga_chip_alloc: allocate %ld bytes\n", size);
  51 + printk("amiga_chip_alloc: allocate %ld bytes\n", size);
52 52 #endif
53   - res = kzalloc(sizeof(struct resource), GFP_KERNEL);
54   - if (!res)
55   - return NULL;
56   - res->name = name;
  53 + res = kzalloc(sizeof(struct resource), GFP_KERNEL);
  54 + if (!res)
  55 + return NULL;
  56 + res->name = name;
57 57  
58   - if (allocate_resource(&chipram_res, res, size, 0, UINT_MAX, PAGE_SIZE, NULL, NULL) < 0) {
59   - kfree(res);
60   - return NULL;
61   - }
62   - chipavail -= size;
  58 + if (allocate_resource(&chipram_res, res, size, 0, UINT_MAX, PAGE_SIZE,
  59 + NULL, NULL) < 0) {
  60 + kfree(res);
  61 + return NULL;
  62 + }
  63 + chipavail -= size;
63 64 #ifdef DEBUG
64   - printk("amiga_chip_alloc: returning %lx\n", res->start);
  65 + printk("amiga_chip_alloc: returning %lx\n", res->start);
65 66 #endif
66   - return (void *)ZTWO_VADDR(res->start);
  67 + return (void *)ZTWO_VADDR(res->start);
67 68 }
68 69 EXPORT_SYMBOL(amiga_chip_alloc);
69 70  
70 71  
71   - /*
72   - * Warning:
73   - * amiga_chip_alloc_res is meant only for drivers that need to allocate
74   - * Chip RAM before kmalloc() is functional. As a consequence, those
75   - * drivers must not free that Chip RAM afterwards.
76   - */
  72 + /*
  73 + * Warning:
  74 + * amiga_chip_alloc_res is meant only for drivers that need to
  75 + * allocate Chip RAM before kmalloc() is functional. As a consequence,
  76 + * those drivers must not free that Chip RAM afterwards.
  77 + */
77 78  
78 79 void * __init amiga_chip_alloc_res(unsigned long size, struct resource *res)
79 80 {
80   - unsigned long start;
  81 + unsigned long start;
81 82  
82   - /* round up */
83   - size = PAGE_ALIGN(size);
84   - /* dmesg into chipmem prefers memory at the safe end */
85   - start = CHIP_PHYSADDR + chipavail - size;
  83 + /* round up */
  84 + size = PAGE_ALIGN(size);
  85 + /* dmesg into chipmem prefers memory at the safe end */
  86 + start = CHIP_PHYSADDR + chipavail - size;
86 87  
87 88 #ifdef DEBUG
88   - printk("amiga_chip_alloc_res: allocate %ld bytes\n", size);
  89 + printk("amiga_chip_alloc_res: allocate %ld bytes\n", size);
89 90 #endif
90   - if (allocate_resource(&chipram_res, res, size, start, UINT_MAX, PAGE_SIZE, NULL, NULL) < 0) {
91   - printk("amiga_chip_alloc_res: first alloc failed!\n");
92   - if (allocate_resource(&chipram_res, res, size, 0, UINT_MAX, PAGE_SIZE, NULL, NULL) < 0)
93   - return NULL;
94   - }
95   - chipavail -= size;
  91 + if (allocate_resource(&chipram_res, res, size, start, UINT_MAX,
  92 + PAGE_SIZE, NULL, NULL) < 0) {
  93 + printk("amiga_chip_alloc_res: first alloc failed!\n");
  94 + if (allocate_resource(&chipram_res, res, size, 0, UINT_MAX,
  95 + PAGE_SIZE, NULL, NULL) < 0)
  96 + return NULL;
  97 + }
  98 + chipavail -= size;
96 99 #ifdef DEBUG
97   - printk("amiga_chip_alloc_res: returning %lx\n", res->start);
  100 + printk("amiga_chip_alloc_res: returning %lx\n", res->start);
98 101 #endif
99   - return (void *)ZTWO_VADDR(res->start);
  102 + return (void *)ZTWO_VADDR(res->start);
100 103 }
101 104  
102 105 void amiga_chip_free(void *ptr)
103 106 {
104   - unsigned long start = ZTWO_PADDR(ptr);
105   - struct resource **p, *res;
106   - unsigned long size;
  107 + unsigned long start = ZTWO_PADDR(ptr);
  108 + struct resource **p, *res;
  109 + unsigned long size;
107 110  
108   - for (p = &chipram_res.child; (res = *p); p = &res->sibling) {
109   - if (res->start != start)
110   - continue;
111   - *p = res->sibling;
112   - size = res->end-start;
  111 + for (p = &chipram_res.child; (res = *p); p = &res->sibling) {
  112 + if (res->start != start)
  113 + continue;
  114 + *p = res->sibling;
  115 + size = res->end-start;
113 116 #ifdef DEBUG
114   - printk("amiga_chip_free: free %ld bytes at %p\n", size, ptr);
  117 + printk("amiga_chip_free: free %ld bytes at %p\n", size, ptr);
115 118 #endif
116   - chipavail += size;
117   - kfree(res);
118   - return;
119   - }
120   - printk("amiga_chip_free: trying to free nonexistent region at %p\n", ptr);
  119 + chipavail += size;
  120 + kfree(res);
  121 + return;
  122 + }
  123 + printk("amiga_chip_free: trying to free nonexistent region at %p\n",
  124 + ptr);
121 125 }
122 126 EXPORT_SYMBOL(amiga_chip_free);
123 127