Commit 4a4c0a5e9a2b65711f733bc2178e506131b0693b

Authored by Marek Vasut
1 parent 5561a84148

fpga: altera: More indentation trimdown

Further improve the indentation in the rest of the file, where
the indentation is initially a bit less brutal. There is no
functional change in this patch.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Chin Liang See <clsee@altera.com>
Cc: Dinh Nguyen <dinguyen@altera.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Tom Rini <trini@ti.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Pavel Machek <pavel@denx.de>
Acked-by: Pavel Machek <pavel@denx.de>

Showing 1 changed file with 120 additions and 118 deletions Side-by-side Diff

drivers/fpga/altera.c
... ... @@ -26,40 +26,41 @@
26 26 {
27 27 int ret_val = FPGA_FAIL; /* assume a failure */
28 28  
29   - if (!altera_validate (desc, (char *)__func__)) {
  29 + if (!altera_validate(desc, (char *)__func__)) {
30 30 printf("%s: Invalid device descriptor\n", __func__);
31   - } else {
32   - switch (desc->family) {
33   - case Altera_ACEX1K:
34   - case Altera_CYC2:
  31 + return FPGA_FAIL;
  32 + }
  33 +
  34 + switch (desc->family) {
  35 + case Altera_ACEX1K:
  36 + case Altera_CYC2:
35 37 #if defined(CONFIG_FPGA_ACEX1K)
36   - debug_cond(FPGA_DEBUG,
37   - "%s: Launching the ACEX1K Loader...\n",
38   - __func__);
39   - ret_val = ACEX1K_load (desc, buf, bsize);
  38 + debug_cond(FPGA_DEBUG,
  39 + "%s: Launching the ACEX1K Loader...\n",
  40 + __func__);
  41 + ret_val = ACEX1K_load (desc, buf, bsize);
40 42 #elif defined(CONFIG_FPGA_CYCLON2)
41   - debug_cond(FPGA_DEBUG,
42   - "%s: Launching the CYCLONE II Loader...\n",
43   - __func__);
44   - ret_val = CYC2_load (desc, buf, bsize);
  43 + debug_cond(FPGA_DEBUG,
  44 + "%s: Launching the CYCLONE II Loader...\n",
  45 + __func__);
  46 + ret_val = CYC2_load (desc, buf, bsize);
45 47 #else
46   - printf("%s: No support for ACEX1K devices.\n",
47   - __func__);
  48 + printf("%s: No support for ACEX1K devices.\n",
  49 + __func__);
48 50 #endif
49   - break;
  51 + break;
50 52  
51 53 #if defined(CONFIG_FPGA_STRATIX_II)
52   - case Altera_StratixII:
53   - debug_cond(FPGA_DEBUG,
54   - "%s: Launching the Stratix II Loader...\n",
55   - __func__);
56   - ret_val = StratixII_load (desc, buf, bsize);
57   - break;
  54 + case Altera_StratixII:
  55 + debug_cond(FPGA_DEBUG,
  56 + "%s: Launching the Stratix II Loader...\n",
  57 + __func__);
  58 + ret_val = StratixII_load (desc, buf, bsize);
  59 + break;
58 60 #endif
59   - default:
60   - printf("%s: Unsupported family type, %d\n",
61   - __func__, desc->family);
62   - }
  61 + default:
  62 + printf("%s: Unsupported family type, %d\n",
  63 + __func__, desc->family);
63 64 }
64 65  
65 66 return ret_val;
66 67  
67 68  
68 69  
69 70  
70 71  
71 72  
72 73  
73 74  
74 75  
75 76  
76 77  
77 78  
78 79  
79 80  
80 81  
81 82  
82 83  
... ... @@ -71,124 +72,125 @@
71 72  
72 73 if (!altera_validate (desc, (char *)__func__)) {
73 74 printf("%s: Invalid device descriptor\n", __func__);
74   - } else {
75   - switch (desc->family) {
76   - case Altera_ACEX1K:
  75 + return FPGA_FAIL;
  76 + }
  77 +
  78 + switch (desc->family) {
  79 + case Altera_ACEX1K:
77 80 #if defined(CONFIG_FPGA_ACEX)
78   - debug_cond(FPGA_DEBUG,
79   - "%s: Launching the ACEX1K Reader...\n",
80   - __func__);
81   - ret_val = ACEX1K_dump (desc, buf, bsize);
  81 + debug_cond(FPGA_DEBUG,
  82 + "%s: Launching the ACEX1K Reader...\n",
  83 + __func__);
  84 + ret_val = ACEX1K_dump (desc, buf, bsize);
82 85 #else
83   - printf("%s: No support for ACEX1K devices.\n",
84   - __func__);
  86 + printf("%s: No support for ACEX1K devices.\n",
  87 + __func__);
85 88 #endif
86   - break;
  89 + break;
87 90  
88 91 #if defined(CONFIG_FPGA_STRATIX_II)
89   - case Altera_StratixII:
90   - debug_cond(FPGA_DEBUG,
91   - "%s: Launching the Stratix II Reader...\n",
92   - __func__);
93   - ret_val = StratixII_dump (desc, buf, bsize);
94   - break;
  92 + case Altera_StratixII:
  93 + debug_cond(FPGA_DEBUG,
  94 + "%s: Launching the Stratix II Reader...\n",
  95 + __func__);
  96 + ret_val = StratixII_dump (desc, buf, bsize);
  97 + break;
95 98 #endif
96   - default:
97   - printf("%s: Unsupported family type, %d\n",
98   - __func__, desc->family);
99   - }
  99 + default:
  100 + printf("%s: Unsupported family type, %d\n",
  101 + __func__, desc->family);
100 102 }
101 103  
102 104 return ret_val;
103 105 }
104 106  
105   -int altera_info( Altera_desc *desc )
  107 +int altera_info(Altera_desc *desc)
106 108 {
107 109 int ret_val = FPGA_FAIL;
108 110  
109   - if (altera_validate (desc, (char *)__func__)) {
110   - printf("Family: \t");
  111 + if (!altera_validate (desc, (char *)__func__)) {
  112 + printf("%s: Invalid device descriptor\n", __func__);
  113 + return FPGA_FAIL;
  114 + }
  115 +
  116 + printf("Family: \t");
  117 + switch (desc->family) {
  118 + case Altera_ACEX1K:
  119 + printf("ACEX1K\n");
  120 + break;
  121 + case Altera_CYC2:
  122 + printf("CYCLON II\n");
  123 + break;
  124 + case Altera_StratixII:
  125 + printf("Stratix II\n");
  126 + break;
  127 + /* Add new family types here */
  128 + default:
  129 + printf("Unknown family type, %d\n", desc->family);
  130 + }
  131 +
  132 + printf("Interface type:\t");
  133 + switch (desc->iface) {
  134 + case passive_serial:
  135 + printf("Passive Serial (PS)\n");
  136 + break;
  137 + case passive_parallel_synchronous:
  138 + printf("Passive Parallel Synchronous (PPS)\n");
  139 + break;
  140 + case passive_parallel_asynchronous:
  141 + printf("Passive Parallel Asynchronous (PPA)\n");
  142 + break;
  143 + case passive_serial_asynchronous:
  144 + printf("Passive Serial Asynchronous (PSA)\n");
  145 + break;
  146 + case altera_jtag_mode: /* Not used */
  147 + printf("JTAG Mode\n");
  148 + break;
  149 + case fast_passive_parallel:
  150 + printf("Fast Passive Parallel (FPP)\n");
  151 + break;
  152 + case fast_passive_parallel_security:
  153 + printf("Fast Passive Parallel with Security (FPPS)\n");
  154 + break;
  155 + /* Add new interface types here */
  156 + default:
  157 + printf("Unsupported interface type, %d\n", desc->iface);
  158 + }
  159 +
  160 + printf("Device Size: \t%zd bytes\n"
  161 + "Cookie: \t0x%x (%d)\n",
  162 + desc->size, desc->cookie, desc->cookie);
  163 +
  164 + if (desc->iface_fns) {
  165 + printf("Device Function Table @ 0x%p\n", desc->iface_fns);
111 166 switch (desc->family) {
112 167 case Altera_ACEX1K:
113   - printf("ACEX1K\n");
114   - break;
115 168 case Altera_CYC2:
116   - printf("CYCLON II\n");
  169 +#if defined(CONFIG_FPGA_ACEX1K)
  170 + ACEX1K_info(desc);
  171 +#elif defined(CONFIG_FPGA_CYCLON2)
  172 + CYC2_info(desc);
  173 +#else
  174 + /* just in case */
  175 + printf("%s: No support for ACEX1K devices.\n",
  176 + __func__);
  177 +#endif
117 178 break;
  179 +#if defined(CONFIG_FPGA_STRATIX_II)
118 180 case Altera_StratixII:
119   - printf("Stratix II\n");
  181 + StratixII_info(desc);
120 182 break;
  183 +#endif
121 184 /* Add new family types here */
122 185 default:
123   - printf("Unknown family type, %d\n", desc->family);
124   - }
125   -
126   - printf("Interface type:\t");
127   - switch (desc->iface) {
128   - case passive_serial:
129   - printf("Passive Serial (PS)\n");
  186 + /* we don't need a message here - we give one up above */
130 187 break;
131   - case passive_parallel_synchronous:
132   - printf("Passive Parallel Synchronous (PPS)\n");
133   - break;
134   - case passive_parallel_asynchronous:
135   - printf("Passive Parallel Asynchronous (PPA)\n");
136   - break;
137   - case passive_serial_asynchronous:
138   - printf("Passive Serial Asynchronous (PSA)\n");
139   - break;
140   - case altera_jtag_mode: /* Not used */
141   - printf("JTAG Mode\n");
142   - break;
143   - case fast_passive_parallel:
144   - printf("Fast Passive Parallel (FPP)\n");
145   - break;
146   - case fast_passive_parallel_security:
147   - printf
148   - ("Fast Passive Parallel with Security (FPPS) \n");
149   - break;
150   - /* Add new interface types here */
151   - default:
152   - printf("Unsupported interface type, %d\n", desc->iface);
153 188 }
154   -
155   - printf("Device Size: \t%zd bytes\n"
156   - "Cookie: \t0x%x (%d)\n",
157   - desc->size, desc->cookie, desc->cookie);
158   -
159   - if (desc->iface_fns) {
160   - printf("Device Function Table @ 0x%p\n", desc->iface_fns);
161   - switch (desc->family) {
162   - case Altera_ACEX1K:
163   - case Altera_CYC2:
164   -#if defined(CONFIG_FPGA_ACEX1K)
165   - ACEX1K_info(desc);
166   -#elif defined(CONFIG_FPGA_CYCLON2)
167   - CYC2_info(desc);
168   -#else
169   - /* just in case */
170   - printf("%s: No support for ACEX1K devices.\n",
171   - __func__);
172   -#endif
173   - break;
174   -#if defined(CONFIG_FPGA_STRATIX_II)
175   - case Altera_StratixII:
176   - StratixII_info(desc);
177   - break;
178   -#endif
179   - /* Add new family types here */
180   - default:
181   - /* we don't need a message here - we give one up above */
182   - break;
183   - }
184   - } else {
185   - printf("No Device Function Table.\n");
186   - }
187   -
188   - ret_val = FPGA_SUCCESS;
189 189 } else {
190   - printf("%s: Invalid device descriptor\n", __func__);
  190 + printf("No Device Function Table.\n");
191 191 }
  192 +
  193 + ret_val = FPGA_SUCCESS;
192 194  
193 195 return ret_val;
194 196 }