diff options
author | Len Brown <len.brown@intel.com> | 2005-08-05 00:44:28 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-08-05 00:45:14 -0400 |
commit | 4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch) | |
tree | 5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/utilities/utmath.c | |
parent | c65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff) |
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/utilities/utmath.c')
-rw-r--r-- | drivers/acpi/utilities/utmath.c | 144 |
1 files changed, 60 insertions, 84 deletions
diff --git a/drivers/acpi/utilities/utmath.c b/drivers/acpi/utilities/utmath.c index 0d527c91543c..68a0a6f94129 100644 --- a/drivers/acpi/utilities/utmath.c +++ b/drivers/acpi/utilities/utmath.c | |||
@@ -41,19 +41,16 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | 45 | ||
47 | |||
48 | #define _COMPONENT ACPI_UTILITIES | 46 | #define _COMPONENT ACPI_UTILITIES |
49 | ACPI_MODULE_NAME ("utmath") | 47 | ACPI_MODULE_NAME("utmath") |
50 | 48 | ||
51 | /* | 49 | /* |
52 | * Support for double-precision integer divide. This code is included here | 50 | * Support for double-precision integer divide. This code is included here |
53 | * in order to support kernel environments where the double-precision math | 51 | * in order to support kernel environments where the double-precision math |
54 | * library is not available. | 52 | * library is not available. |
55 | */ | 53 | */ |
56 | |||
57 | #ifndef ACPI_USE_NATIVE_DIVIDE | 54 | #ifndef ACPI_USE_NATIVE_DIVIDE |
58 | /******************************************************************************* | 55 | /******************************************************************************* |
59 | * | 56 | * |
@@ -71,27 +68,22 @@ | |||
71 | * 32-bit remainder. | 68 | * 32-bit remainder. |
72 | * | 69 | * |
73 | ******************************************************************************/ | 70 | ******************************************************************************/ |
74 | |||
75 | acpi_status | 71 | acpi_status |
76 | acpi_ut_short_divide ( | 72 | acpi_ut_short_divide(acpi_integer dividend, |
77 | acpi_integer dividend, | 73 | u32 divisor, |
78 | u32 divisor, | 74 | acpi_integer * out_quotient, u32 * out_remainder) |
79 | acpi_integer *out_quotient, | ||
80 | u32 *out_remainder) | ||
81 | { | 75 | { |
82 | union uint64_overlay dividend_ovl; | 76 | union uint64_overlay dividend_ovl; |
83 | union uint64_overlay quotient; | 77 | union uint64_overlay quotient; |
84 | u32 remainder32; | 78 | u32 remainder32; |
85 | |||
86 | |||
87 | ACPI_FUNCTION_TRACE ("ut_short_divide"); | ||
88 | 79 | ||
80 | ACPI_FUNCTION_TRACE("ut_short_divide"); | ||
89 | 81 | ||
90 | /* Always check for a zero divisor */ | 82 | /* Always check for a zero divisor */ |
91 | 83 | ||
92 | if (divisor == 0) { | 84 | if (divisor == 0) { |
93 | ACPI_REPORT_ERROR (("acpi_ut_short_divide: Divide by zero\n")); | 85 | ACPI_REPORT_ERROR(("acpi_ut_short_divide: Divide by zero\n")); |
94 | return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO); | 86 | return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); |
95 | } | 87 | } |
96 | 88 | ||
97 | dividend_ovl.full = dividend; | 89 | dividend_ovl.full = dividend; |
@@ -100,9 +92,9 @@ acpi_ut_short_divide ( | |||
100 | * The quotient is 64 bits, the remainder is always 32 bits, | 92 | * The quotient is 64 bits, the remainder is always 32 bits, |
101 | * and is generated by the second divide. | 93 | * and is generated by the second divide. |
102 | */ | 94 | */ |
103 | ACPI_DIV_64_BY_32 (0, dividend_ovl.part.hi, divisor, | 95 | ACPI_DIV_64_BY_32(0, dividend_ovl.part.hi, divisor, |
104 | quotient.part.hi, remainder32); | 96 | quotient.part.hi, remainder32); |
105 | ACPI_DIV_64_BY_32 (remainder32, dividend_ovl.part.lo, divisor, | 97 | ACPI_DIV_64_BY_32(remainder32, dividend_ovl.part.lo, divisor, |
106 | quotient.part.lo, remainder32); | 98 | quotient.part.lo, remainder32); |
107 | 99 | ||
108 | /* Return only what was requested */ | 100 | /* Return only what was requested */ |
@@ -114,10 +106,9 @@ acpi_ut_short_divide ( | |||
114 | *out_remainder = remainder32; | 106 | *out_remainder = remainder32; |
115 | } | 107 | } |
116 | 108 | ||
117 | return_ACPI_STATUS (AE_OK); | 109 | return_ACPI_STATUS(AE_OK); |
118 | } | 110 | } |
119 | 111 | ||
120 | |||
121 | /******************************************************************************* | 112 | /******************************************************************************* |
122 | * | 113 | * |
123 | * FUNCTION: acpi_ut_divide | 114 | * FUNCTION: acpi_ut_divide |
@@ -134,34 +125,30 @@ acpi_ut_short_divide ( | |||
134 | ******************************************************************************/ | 125 | ******************************************************************************/ |
135 | 126 | ||
136 | acpi_status | 127 | acpi_status |
137 | acpi_ut_divide ( | 128 | acpi_ut_divide(acpi_integer in_dividend, |
138 | acpi_integer in_dividend, | 129 | acpi_integer in_divisor, |
139 | acpi_integer in_divisor, | 130 | acpi_integer * out_quotient, acpi_integer * out_remainder) |
140 | acpi_integer *out_quotient, | ||
141 | acpi_integer *out_remainder) | ||
142 | { | 131 | { |
143 | union uint64_overlay dividend; | 132 | union uint64_overlay dividend; |
144 | union uint64_overlay divisor; | 133 | union uint64_overlay divisor; |
145 | union uint64_overlay quotient; | 134 | union uint64_overlay quotient; |
146 | union uint64_overlay remainder; | 135 | union uint64_overlay remainder; |
147 | union uint64_overlay normalized_dividend; | 136 | union uint64_overlay normalized_dividend; |
148 | union uint64_overlay normalized_divisor; | 137 | union uint64_overlay normalized_divisor; |
149 | u32 partial1; | 138 | u32 partial1; |
150 | union uint64_overlay partial2; | 139 | union uint64_overlay partial2; |
151 | union uint64_overlay partial3; | 140 | union uint64_overlay partial3; |
152 | 141 | ||
153 | 142 | ACPI_FUNCTION_TRACE("ut_divide"); | |
154 | ACPI_FUNCTION_TRACE ("ut_divide"); | ||
155 | |||
156 | 143 | ||
157 | /* Always check for a zero divisor */ | 144 | /* Always check for a zero divisor */ |
158 | 145 | ||
159 | if (in_divisor == 0) { | 146 | if (in_divisor == 0) { |
160 | ACPI_REPORT_ERROR (("acpi_ut_divide: Divide by zero\n")); | 147 | ACPI_REPORT_ERROR(("acpi_ut_divide: Divide by zero\n")); |
161 | return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO); | 148 | return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); |
162 | } | 149 | } |
163 | 150 | ||
164 | divisor.full = in_divisor; | 151 | divisor.full = in_divisor; |
165 | dividend.full = in_dividend; | 152 | dividend.full = in_dividend; |
166 | if (divisor.part.hi == 0) { | 153 | if (divisor.part.hi == 0) { |
167 | /* | 154 | /* |
@@ -174,9 +161,9 @@ acpi_ut_divide ( | |||
174 | * The quotient is 64 bits, the remainder is always 32 bits, | 161 | * The quotient is 64 bits, the remainder is always 32 bits, |
175 | * and is generated by the second divide. | 162 | * and is generated by the second divide. |
176 | */ | 163 | */ |
177 | ACPI_DIV_64_BY_32 (0, dividend.part.hi, divisor.part.lo, | 164 | ACPI_DIV_64_BY_32(0, dividend.part.hi, divisor.part.lo, |
178 | quotient.part.hi, partial1); | 165 | quotient.part.hi, partial1); |
179 | ACPI_DIV_64_BY_32 (partial1, dividend.part.lo, divisor.part.lo, | 166 | ACPI_DIV_64_BY_32(partial1, dividend.part.lo, divisor.part.lo, |
180 | quotient.part.lo, remainder.part.lo); | 167 | quotient.part.lo, remainder.part.lo); |
181 | } | 168 | } |
182 | 169 | ||
@@ -185,23 +172,23 @@ acpi_ut_divide ( | |||
185 | * 2) The general case where the divisor is a full 64 bits | 172 | * 2) The general case where the divisor is a full 64 bits |
186 | * is more difficult | 173 | * is more difficult |
187 | */ | 174 | */ |
188 | quotient.part.hi = 0; | 175 | quotient.part.hi = 0; |
189 | normalized_dividend = dividend; | 176 | normalized_dividend = dividend; |
190 | normalized_divisor = divisor; | 177 | normalized_divisor = divisor; |
191 | 178 | ||
192 | /* Normalize the operands (shift until the divisor is < 32 bits) */ | 179 | /* Normalize the operands (shift until the divisor is < 32 bits) */ |
193 | 180 | ||
194 | do { | 181 | do { |
195 | ACPI_SHIFT_RIGHT_64 (normalized_divisor.part.hi, | 182 | ACPI_SHIFT_RIGHT_64(normalized_divisor.part.hi, |
196 | normalized_divisor.part.lo); | 183 | normalized_divisor.part.lo); |
197 | ACPI_SHIFT_RIGHT_64 (normalized_dividend.part.hi, | 184 | ACPI_SHIFT_RIGHT_64(normalized_dividend.part.hi, |
198 | normalized_dividend.part.lo); | 185 | normalized_dividend.part.lo); |
199 | 186 | ||
200 | } while (normalized_divisor.part.hi != 0); | 187 | } while (normalized_divisor.part.hi != 0); |
201 | 188 | ||
202 | /* Partial divide */ | 189 | /* Partial divide */ |
203 | 190 | ||
204 | ACPI_DIV_64_BY_32 (normalized_dividend.part.hi, | 191 | ACPI_DIV_64_BY_32(normalized_dividend.part.hi, |
205 | normalized_dividend.part.lo, | 192 | normalized_dividend.part.lo, |
206 | normalized_divisor.part.lo, | 193 | normalized_divisor.part.lo, |
207 | quotient.part.lo, partial1); | 194 | quotient.part.lo, partial1); |
@@ -210,8 +197,9 @@ acpi_ut_divide ( | |||
210 | * The quotient is always 32 bits, and simply requires adjustment. | 197 | * The quotient is always 32 bits, and simply requires adjustment. |
211 | * The 64-bit remainder must be generated. | 198 | * The 64-bit remainder must be generated. |
212 | */ | 199 | */ |
213 | partial1 = quotient.part.lo * divisor.part.hi; | 200 | partial1 = quotient.part.lo * divisor.part.hi; |
214 | partial2.full = (acpi_integer) quotient.part.lo * divisor.part.lo; | 201 | partial2.full = |
202 | (acpi_integer) quotient.part.lo * divisor.part.lo; | ||
215 | partial3.full = (acpi_integer) partial2.part.hi + partial1; | 203 | partial3.full = (acpi_integer) partial2.part.hi + partial1; |
216 | 204 | ||
217 | remainder.part.hi = partial3.part.lo; | 205 | remainder.part.hi = partial3.part.lo; |
@@ -224,16 +212,15 @@ acpi_ut_divide ( | |||
224 | quotient.part.lo--; | 212 | quotient.part.lo--; |
225 | remainder.full -= divisor.full; | 213 | remainder.full -= divisor.full; |
226 | } | 214 | } |
227 | } | 215 | } else { |
228 | else { | ||
229 | quotient.part.lo--; | 216 | quotient.part.lo--; |
230 | remainder.full -= divisor.full; | 217 | remainder.full -= divisor.full; |
231 | } | 218 | } |
232 | } | 219 | } |
233 | 220 | ||
234 | remainder.full = remainder.full - dividend.full; | 221 | remainder.full = remainder.full - dividend.full; |
235 | remainder.part.hi = (u32) -((s32) remainder.part.hi); | 222 | remainder.part.hi = (u32) - ((s32) remainder.part.hi); |
236 | remainder.part.lo = (u32) -((s32) remainder.part.lo); | 223 | remainder.part.lo = (u32) - ((s32) remainder.part.lo); |
237 | 224 | ||
238 | if (remainder.part.lo) { | 225 | if (remainder.part.lo) { |
239 | remainder.part.hi--; | 226 | remainder.part.hi--; |
@@ -250,11 +237,10 @@ acpi_ut_divide ( | |||
250 | *out_remainder = remainder.full; | 237 | *out_remainder = remainder.full; |
251 | } | 238 | } |
252 | 239 | ||
253 | return_ACPI_STATUS (AE_OK); | 240 | return_ACPI_STATUS(AE_OK); |
254 | } | 241 | } |
255 | 242 | ||
256 | #else | 243 | #else |
257 | |||
258 | /******************************************************************************* | 244 | /******************************************************************************* |
259 | * | 245 | * |
260 | * FUNCTION: acpi_ut_short_divide, acpi_ut_divide | 246 | * FUNCTION: acpi_ut_short_divide, acpi_ut_divide |
@@ -269,23 +255,19 @@ acpi_ut_divide ( | |||
269 | * perform the divide. | 255 | * perform the divide. |
270 | * | 256 | * |
271 | ******************************************************************************/ | 257 | ******************************************************************************/ |
272 | |||
273 | acpi_status | 258 | acpi_status |
274 | acpi_ut_short_divide ( | 259 | acpi_ut_short_divide(acpi_integer in_dividend, |
275 | acpi_integer in_dividend, | 260 | u32 divisor, |
276 | u32 divisor, | 261 | acpi_integer * out_quotient, u32 * out_remainder) |
277 | acpi_integer *out_quotient, | ||
278 | u32 *out_remainder) | ||
279 | { | 262 | { |
280 | 263 | ||
281 | ACPI_FUNCTION_TRACE ("ut_short_divide"); | 264 | ACPI_FUNCTION_TRACE("ut_short_divide"); |
282 | |||
283 | 265 | ||
284 | /* Always check for a zero divisor */ | 266 | /* Always check for a zero divisor */ |
285 | 267 | ||
286 | if (divisor == 0) { | 268 | if (divisor == 0) { |
287 | ACPI_REPORT_ERROR (("acpi_ut_short_divide: Divide by zero\n")); | 269 | ACPI_REPORT_ERROR(("acpi_ut_short_divide: Divide by zero\n")); |
288 | return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO); | 270 | return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); |
289 | } | 271 | } |
290 | 272 | ||
291 | /* Return only what was requested */ | 273 | /* Return only what was requested */ |
@@ -297,27 +279,23 @@ acpi_ut_short_divide ( | |||
297 | *out_remainder = (u32) in_dividend % divisor; | 279 | *out_remainder = (u32) in_dividend % divisor; |
298 | } | 280 | } |
299 | 281 | ||
300 | return_ACPI_STATUS (AE_OK); | 282 | return_ACPI_STATUS(AE_OK); |
301 | } | 283 | } |
302 | 284 | ||
303 | acpi_status | 285 | acpi_status |
304 | acpi_ut_divide ( | 286 | acpi_ut_divide(acpi_integer in_dividend, |
305 | acpi_integer in_dividend, | 287 | acpi_integer in_divisor, |
306 | acpi_integer in_divisor, | 288 | acpi_integer * out_quotient, acpi_integer * out_remainder) |
307 | acpi_integer *out_quotient, | ||
308 | acpi_integer *out_remainder) | ||
309 | { | 289 | { |
310 | ACPI_FUNCTION_TRACE ("ut_divide"); | 290 | ACPI_FUNCTION_TRACE("ut_divide"); |
311 | |||
312 | 291 | ||
313 | /* Always check for a zero divisor */ | 292 | /* Always check for a zero divisor */ |
314 | 293 | ||
315 | if (in_divisor == 0) { | 294 | if (in_divisor == 0) { |
316 | ACPI_REPORT_ERROR (("acpi_ut_divide: Divide by zero\n")); | 295 | ACPI_REPORT_ERROR(("acpi_ut_divide: Divide by zero\n")); |
317 | return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO); | 296 | return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); |
318 | } | 297 | } |
319 | 298 | ||
320 | |||
321 | /* Return only what was requested */ | 299 | /* Return only what was requested */ |
322 | 300 | ||
323 | if (out_quotient) { | 301 | if (out_quotient) { |
@@ -327,9 +305,7 @@ acpi_ut_divide ( | |||
327 | *out_remainder = in_dividend % in_divisor; | 305 | *out_remainder = in_dividend % in_divisor; |
328 | } | 306 | } |
329 | 307 | ||
330 | return_ACPI_STATUS (AE_OK); | 308 | return_ACPI_STATUS(AE_OK); |
331 | } | 309 | } |
332 | 310 | ||
333 | #endif | 311 | #endif |
334 | |||
335 | |||