diff options
Diffstat (limited to 'include/linux/mtd/map.h')
-rw-r--r-- | include/linux/mtd/map.h | 130 |
1 files changed, 61 insertions, 69 deletions
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h index 3aa56e3104bb..b5b43f94f311 100644 --- a/include/linux/mtd/map.h +++ b/include/linux/mtd/map.h | |||
@@ -270,75 +270,67 @@ void map_destroy(struct mtd_info *mtd); | |||
270 | #define INVALIDATE_CACHED_RANGE(map, from, size) \ | 270 | #define INVALIDATE_CACHED_RANGE(map, from, size) \ |
271 | do { if (map->inval_cache) map->inval_cache(map, from, size); } while (0) | 271 | do { if (map->inval_cache) map->inval_cache(map, from, size); } while (0) |
272 | 272 | ||
273 | 273 | #define map_word_equal(map, val1, val2) \ | |
274 | static inline int map_word_equal(struct map_info *map, map_word val1, map_word val2) | 274 | ({ \ |
275 | { | 275 | int i, ret = 1; \ |
276 | int i; | 276 | for (i = 0; i < map_words(map); i++) \ |
277 | 277 | if ((val1).x[i] != (val2).x[i]) { \ | |
278 | for (i = 0; i < map_words(map); i++) { | 278 | ret = 0; \ |
279 | if (val1.x[i] != val2.x[i]) | 279 | break; \ |
280 | return 0; | 280 | } \ |
281 | } | 281 | ret; \ |
282 | 282 | }) | |
283 | return 1; | 283 | |
284 | } | 284 | #define map_word_and(map, val1, val2) \ |
285 | 285 | ({ \ | |
286 | static inline map_word map_word_and(struct map_info *map, map_word val1, map_word val2) | 286 | map_word r; \ |
287 | { | 287 | int i; \ |
288 | map_word r; | 288 | for (i = 0; i < map_words(map); i++) \ |
289 | int i; | 289 | r.x[i] = (val1).x[i] & (val2).x[i]; \ |
290 | 290 | r; \ | |
291 | for (i = 0; i < map_words(map); i++) | 291 | }) |
292 | r.x[i] = val1.x[i] & val2.x[i]; | 292 | |
293 | 293 | #define map_word_clr(map, val1, val2) \ | |
294 | return r; | 294 | ({ \ |
295 | } | 295 | map_word r; \ |
296 | 296 | int i; \ | |
297 | static inline map_word map_word_clr(struct map_info *map, map_word val1, map_word val2) | 297 | for (i = 0; i < map_words(map); i++) \ |
298 | { | 298 | r.x[i] = (val1).x[i] & ~(val2).x[i]; \ |
299 | map_word r; | 299 | r; \ |
300 | int i; | 300 | }) |
301 | 301 | ||
302 | for (i = 0; i < map_words(map); i++) | 302 | #define map_word_or(map, val1, val2) \ |
303 | r.x[i] = val1.x[i] & ~val2.x[i]; | 303 | ({ \ |
304 | 304 | map_word r; \ | |
305 | return r; | 305 | int i; \ |
306 | } | 306 | for (i = 0; i < map_words(map); i++) \ |
307 | 307 | r.x[i] = (val1).x[i] | (val2).x[i]; \ | |
308 | static inline map_word map_word_or(struct map_info *map, map_word val1, map_word val2) | 308 | r; \ |
309 | { | 309 | }) |
310 | map_word r; | 310 | |
311 | int i; | 311 | #define map_word_andequal(map, val1, val2, val3) \ |
312 | 312 | ({ \ | |
313 | for (i = 0; i < map_words(map); i++) | 313 | int i, ret = 1; \ |
314 | r.x[i] = val1.x[i] | val2.x[i]; | 314 | for (i = 0; i < map_words(map); i++) { \ |
315 | 315 | if (((val1).x[i] & (val2).x[i]) != (val2).x[i]) { \ | |
316 | return r; | 316 | ret = 0; \ |
317 | } | 317 | break; \ |
318 | 318 | } \ | |
319 | static inline int map_word_andequal(struct map_info *map, map_word val1, map_word val2, map_word val3) | 319 | } \ |
320 | { | 320 | ret; \ |
321 | int i; | 321 | }) |
322 | 322 | ||
323 | for (i = 0; i < map_words(map); i++) { | 323 | #define map_word_bitsset(map, val1, val2) \ |
324 | if ((val1.x[i] & val2.x[i]) != val3.x[i]) | 324 | ({ \ |
325 | return 0; | 325 | int i, ret = 0; \ |
326 | } | 326 | for (i = 0; i < map_words(map); i++) { \ |
327 | 327 | if ((val1).x[i] & (val2).x[i]) { \ | |
328 | return 1; | 328 | ret = 1; \ |
329 | } | 329 | break; \ |
330 | 330 | } \ | |
331 | static inline int map_word_bitsset(struct map_info *map, map_word val1, map_word val2) | 331 | } \ |
332 | { | 332 | ret; \ |
333 | int i; | 333 | }) |
334 | |||
335 | for (i = 0; i < map_words(map); i++) { | ||
336 | if (val1.x[i] & val2.x[i]) | ||
337 | return 1; | ||
338 | } | ||
339 | |||
340 | return 0; | ||
341 | } | ||
342 | 334 | ||
343 | static inline map_word map_word_load(struct map_info *map, const void *ptr) | 335 | static inline map_word map_word_load(struct map_info *map, const void *ptr) |
344 | { | 336 | { |