Commit bb2c0fa03e80d4ff131eda28eabbd986f3864107
Committed by
Michal Simek
1 parent
3b2a595fc6
Exists in
smarc_8mq_lf_v2020.04
and in
9 other branches
fpga: altera: cyclon2: Fix most checkpatch warnings
Nothing special, but done before further cleanup. * spacing * braces * __FUNCTION__ → __func__ Suggested-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Alexander Dahl <ada@thorsis.com>
Showing 1 changed file with 39 additions and 42 deletions Side-by-side Diff
drivers/fpga/cyclon2.c
... | ... | @@ -11,9 +11,9 @@ |
11 | 11 | |
12 | 12 | /* Define FPGA_DEBUG to get debug printf's */ |
13 | 13 | #ifdef FPGA_DEBUG |
14 | -#define PRINTF(fmt,args...) printf (fmt ,##args) | |
14 | +#define PRINTF(fmt, args...) printf(fmt, ##args) | |
15 | 15 | #else |
16 | -#define PRINTF(fmt,args...) | |
16 | +#define PRINTF(fmt, args...) | |
17 | 17 | #endif |
18 | 18 | |
19 | 19 | /* Note: The assumption is that we cannot possibly run fast enough to |
... | ... | @@ -26,7 +26,7 @@ |
26 | 26 | #endif |
27 | 27 | |
28 | 28 | #ifndef CONFIG_SYS_FPGA_WAIT |
29 | -#define CONFIG_SYS_FPGA_WAIT CONFIG_SYS_HZ/10 /* 100 ms */ | |
29 | +#define CONFIG_SYS_FPGA_WAIT CONFIG_SYS_HZ / 10 /* 100 ms */ | |
30 | 30 | #endif |
31 | 31 | |
32 | 32 | static int CYC2_ps_load(Altera_desc *desc, const void *buf, size_t bsize); |
... | ... | @@ -41,8 +41,8 @@ |
41 | 41 | |
42 | 42 | switch (desc->iface) { |
43 | 43 | case passive_serial: |
44 | - PRINTF ("%s: Launching Passive Serial Loader\n", __FUNCTION__); | |
45 | - ret_val = CYC2_ps_load (desc, buf, bsize); | |
44 | + PRINTF("%s: Launching Passive Serial Loader\n", __func__); | |
45 | + ret_val = CYC2_ps_load(desc, buf, bsize); | |
46 | 46 | break; |
47 | 47 | |
48 | 48 | case fast_passive_parallel: |
49 | 49 | |
... | ... | @@ -50,16 +50,16 @@ |
50 | 50 | * done in the write() callback. Use the existing PS load |
51 | 51 | * function for FPP, too. |
52 | 52 | */ |
53 | - PRINTF ("%s: Launching Fast Passive Parallel Loader\n", | |
54 | - __FUNCTION__); | |
53 | + PRINTF("%s: Launching Fast Passive Parallel Loader\n", | |
54 | + __func__); | |
55 | 55 | ret_val = CYC2_ps_load(desc, buf, bsize); |
56 | 56 | break; |
57 | 57 | |
58 | 58 | /* Add new interface types here */ |
59 | 59 | |
60 | 60 | default: |
61 | - printf ("%s: Unsupported interface type, %d\n", | |
62 | - __FUNCTION__, desc->iface); | |
61 | + printf("%s: Unsupported interface type, %d\n", | |
62 | + __func__, desc->iface); | |
63 | 63 | } |
64 | 64 | |
65 | 65 | return ret_val; |
66 | 66 | |
67 | 67 | |
68 | 68 | |
69 | 69 | |
70 | 70 | |
71 | 71 | |
72 | 72 | |
73 | 73 | |
74 | 74 | |
... | ... | @@ -71,59 +71,58 @@ |
71 | 71 | |
72 | 72 | switch (desc->iface) { |
73 | 73 | case passive_serial: |
74 | - PRINTF ("%s: Launching Passive Serial Dump\n", __FUNCTION__); | |
75 | - ret_val = CYC2_ps_dump (desc, buf, bsize); | |
74 | + PRINTF("%s: Launching Passive Serial Dump\n", __func__); | |
75 | + ret_val = CYC2_ps_dump(desc, buf, bsize); | |
76 | 76 | break; |
77 | 77 | |
78 | 78 | /* Add new interface types here */ |
79 | 79 | |
80 | 80 | default: |
81 | - printf ("%s: Unsupported interface type, %d\n", | |
82 | - __FUNCTION__, desc->iface); | |
81 | + printf("%s: Unsupported interface type, %d\n", | |
82 | + __func__, desc->iface); | |
83 | 83 | } |
84 | 84 | |
85 | 85 | return ret_val; |
86 | 86 | } |
87 | 87 | |
88 | -int CYC2_info( Altera_desc *desc ) | |
88 | +int CYC2_info(Altera_desc *desc) | |
89 | 89 | { |
90 | 90 | return FPGA_SUCCESS; |
91 | 91 | } |
92 | 92 | |
93 | 93 | /* ------------------------------------------------------------------------- */ |
94 | -/* CYCLON2 Passive Serial Generic Implementation */ | |
94 | +/* CYCLON2 Passive Serial Generic Implementation */ | |
95 | 95 | static int CYC2_ps_load(Altera_desc *desc, const void *buf, size_t bsize) |
96 | 96 | { |
97 | 97 | int ret_val = FPGA_FAIL; /* assume the worst */ |
98 | 98 | Altera_CYC2_Passive_Serial_fns *fn = desc->iface_fns; |
99 | 99 | int ret = 0; |
100 | 100 | |
101 | - PRINTF ("%s: start with interface functions @ 0x%p\n", | |
102 | - __FUNCTION__, fn); | |
101 | + PRINTF("%s: start with interface functions @ 0x%p\n", | |
102 | + __func__, fn); | |
103 | 103 | |
104 | 104 | if (fn) { |
105 | 105 | int cookie = desc->cookie; /* make a local copy */ |
106 | 106 | unsigned long ts; /* timestamp */ |
107 | 107 | |
108 | - PRINTF ("%s: Function Table:\n" | |
108 | + PRINTF("%s: Function Table:\n" | |
109 | 109 | "ptr:\t0x%p\n" |
110 | 110 | "struct: 0x%p\n" |
111 | 111 | "config:\t0x%p\n" |
112 | 112 | "status:\t0x%p\n" |
113 | 113 | "write:\t0x%p\n" |
114 | 114 | "done:\t0x%p\n\n", |
115 | - __FUNCTION__, &fn, fn, fn->config, fn->status, | |
115 | + __func__, &fn, fn, fn->config, fn->status, | |
116 | 116 | fn->write, fn->done); |
117 | 117 | #ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK |
118 | - printf ("Loading FPGA Device %d...", cookie); | |
118 | + printf("Loading FPGA Device %d...", cookie); | |
119 | 119 | #endif |
120 | 120 | |
121 | 121 | /* |
122 | 122 | * Run the pre configuration function if there is one. |
123 | 123 | */ |
124 | - if (*fn->pre) { | |
124 | + if (*fn->pre) | |
125 | 125 | (*fn->pre) (cookie); |
126 | - } | |
127 | 126 | |
128 | 127 | /* Establish the initial state */ |
129 | 128 | (*fn->config) (false, true, cookie); /* De-assert nCONFIG */ |
130 | 129 | |
131 | 130 | |
132 | 131 | |
... | ... | @@ -133,22 +132,23 @@ |
133 | 132 | udelay(2); /* T_cfg > 2us */ |
134 | 133 | |
135 | 134 | /* Wait for nSTATUS to be asserted */ |
136 | - ts = get_timer (0); /* get current time */ | |
135 | + ts = get_timer(0); /* get current time */ | |
137 | 136 | do { |
138 | - CONFIG_FPGA_DELAY (); | |
139 | - if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) { /* check the time */ | |
140 | - puts ("** Timeout waiting for STATUS to go high.\n"); | |
137 | + CONFIG_FPGA_DELAY(); | |
138 | + if (get_timer(ts) > CONFIG_SYS_FPGA_WAIT) { | |
139 | + /* check the time */ | |
140 | + puts("** Timeout waiting for STATUS to go high.\n"); | |
141 | 141 | (*fn->abort) (cookie); |
142 | 142 | return FPGA_FAIL; |
143 | 143 | } |
144 | 144 | } while (!(*fn->status) (cookie)); |
145 | 145 | |
146 | 146 | /* Get ready for the burn */ |
147 | - CONFIG_FPGA_DELAY (); | |
147 | + CONFIG_FPGA_DELAY(); | |
148 | 148 | |
149 | 149 | ret = (*fn->write) (buf, bsize, true, cookie); |
150 | 150 | if (ret) { |
151 | - puts ("** Write failed.\n"); | |
151 | + puts("** Write failed.\n"); | |
152 | 152 | (*fn->abort) (cookie); |
153 | 153 | return FPGA_FAIL; |
154 | 154 | } |
155 | 155 | |
156 | 156 | |
157 | 157 | |
... | ... | @@ -156,20 +156,20 @@ |
156 | 156 | puts(" OK? ..."); |
157 | 157 | #endif |
158 | 158 | |
159 | - CONFIG_FPGA_DELAY (); | |
159 | + CONFIG_FPGA_DELAY(); | |
160 | 160 | |
161 | 161 | #ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK |
162 | - putc (' '); /* terminate the dotted line */ | |
162 | + putc(' '); /* terminate the dotted line */ | |
163 | 163 | #endif |
164 | 164 | |
165 | 165 | /* |
166 | 166 | * Checking FPGA's CONF_DONE signal - correctly booted ? |
167 | 167 | */ |
168 | 168 | |
169 | - if ( ! (*fn->done) (cookie) ) { | |
170 | - puts ("** Booting failed! CONF_DONE is still deasserted.\n"); | |
169 | + if (!(*fn->done) (cookie)) { | |
170 | + puts("** Booting failed! CONF_DONE is still deasserted.\n"); | |
171 | 171 | (*fn->abort) (cookie); |
172 | - return (FPGA_FAIL); | |
172 | + return FPGA_FAIL; | |
173 | 173 | } |
174 | 174 | #ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK |
175 | 175 | puts(" OK\n"); |
176 | 176 | |
... | ... | @@ -178,17 +178,15 @@ |
178 | 178 | ret_val = FPGA_SUCCESS; |
179 | 179 | |
180 | 180 | #ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK |
181 | - if (ret_val == FPGA_SUCCESS) { | |
182 | - puts ("Done.\n"); | |
183 | - } | |
184 | - else { | |
185 | - puts ("Fail.\n"); | |
186 | - } | |
181 | + if (ret_val == FPGA_SUCCESS) | |
182 | + puts("Done.\n"); | |
183 | + else | |
184 | + puts("Fail.\n"); | |
187 | 185 | #endif |
188 | 186 | (*fn->post) (cookie); |
189 | 187 | |
190 | 188 | } else { |
191 | - printf ("%s: NULL Interface function table!\n", __FUNCTION__); | |
189 | + printf("%s: NULL Interface function table!\n", __func__); | |
192 | 190 | } |
193 | 191 | |
194 | 192 | return ret_val; |
... | ... | @@ -198,8 +196,7 @@ |
198 | 196 | { |
199 | 197 | /* Readback is only available through the Slave Parallel and */ |
200 | 198 | /* boundary-scan interfaces. */ |
201 | - printf ("%s: Passive Serial Dumping is unavailable\n", | |
202 | - __FUNCTION__); | |
199 | + printf("%s: Passive Serial Dumping is unavailable\n", __func__); | |
203 | 200 | return FPGA_FAIL; |
204 | 201 | } |