Commit 9d58f302ca370c720fa47cb419f0b33eaa1a1132

Authored by Ralf Baechle
1 parent 495515b351

Glue again after removal of BUILD_BUG().

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

Showing 1 changed file with 32 additions and 25 deletions Side-by-side Diff

include/asm-mips/io.h
... ... @@ -387,11 +387,11 @@
387 387 \
388 388 __val = pfx##ioswab##bwlq(val); \
389 389 \
390   - if (sizeof(type) != sizeof(u64)) { \
391   - *__addr = __val; \
392   - slow; \
393   - } else \
394   - BUILD_BUG(); \
  390 + /* Really, we want this to be atomic */ \
  391 + BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
  392 + \
  393 + *__addr = __val; \
  394 + slow; \
395 395 } \
396 396 \
397 397 static inline type pfx##in##bwlq##p(unsigned long port) \
398 398  
... ... @@ -402,14 +402,11 @@
402 402 port = __swizzle_addr_##bwlq(port); \
403 403 __addr = (void *)(mips_io_port_base + port); \
404 404 \
405   - if (sizeof(type) != sizeof(u64)) { \
406   - __val = *__addr; \
407   - slow; \
408   - } else { \
409   - __val = 0; \
410   - BUILD_BUG(); \
411   - } \
  405 + BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
412 406 \
  407 + __val = *__addr; \
  408 + slow; \
  409 + \
413 410 return pfx##ioswab##bwlq(__val); \
414 411 }
415 412  
416 413  
417 414  
418 415  
419 416  
... ... @@ -417,28 +414,36 @@
417 414 \
418 415 __BUILD_MEMORY_SINGLE(bus, bwlq, type, 1)
419 416  
420   -#define __BUILD_IOPORT_PFX(bus, bwlq, type) \
  417 +#define BUILDIO_MEM(bwlq, type) \
421 418 \
422   -__BUILD_IOPORT_SINGLE(bus, bwlq, type, ,) \
423   -__BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
424   -
425   -#define BUILDIO(bwlq, type) \
426   - \
427 419 __BUILD_MEMORY_PFX(__raw_, bwlq, type) \
428 420 __BUILD_MEMORY_PFX(, bwlq, type) \
429 421 __BUILD_MEMORY_PFX(mem_, bwlq, type) \
430   -__BUILD_IOPORT_PFX(, bwlq, type) \
431   -__BUILD_IOPORT_PFX(mem_, bwlq, type)
432 422  
  423 +BUILDIO_MEM(b, u8)
  424 +BUILDIO_MEM(w, u16)
  425 +BUILDIO_MEM(l, u32)
  426 +BUILDIO_MEM(q, u64)
  427 +
  428 +#define __BUILD_IOPORT_PFX(bus, bwlq, type) \
  429 + __BUILD_IOPORT_SINGLE(bus, bwlq, type, ,) \
  430 + __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
  431 +
  432 +#define BUILDIO_IOPORT(bwlq, type) \
  433 + __BUILD_IOPORT_PFX(, bwlq, type) \
  434 + __BUILD_IOPORT_PFX(mem_, bwlq, type)
  435 +
  436 +BUILDIO_IOPORT(b, u8)
  437 +BUILDIO_IOPORT(w, u16)
  438 +BUILDIO_IOPORT(l, u32)
  439 +#ifdef CONFIG_64BIT
  440 +BUILDIO_IOPORT(q, u64)
  441 +#endif
  442 +
433 443 #define __BUILDIO(bwlq, type) \
434 444 \
435 445 __BUILD_MEMORY_SINGLE(____raw_, bwlq, type, 0)
436 446  
437   -BUILDIO(b, u8)
438   -BUILDIO(w, u16)
439   -BUILDIO(l, u32)
440   -BUILDIO(q, u64)
441   -
442 447 __BUILDIO(q, u64)
443 448  
444 449 #define readb_relaxed readb
445 450  
... ... @@ -508,7 +513,9 @@
508 513 BUILDSTRING(b, u8)
509 514 BUILDSTRING(w, u16)
510 515 BUILDSTRING(l, u32)
  516 +#ifdef CONFIG_64BIT
511 517 BUILDSTRING(q, u64)
  518 +#endif
512 519  
513 520  
514 521 /* Depends on MIPS II instruction set */