Merge tag 'asm-generic-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 25 Mar 2016 06:13:48 +0000 (23:13 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 25 Mar 2016 06:13:48 +0000 (23:13 -0700)
Pull asm-generic updates from Arnd Bergmann:
 "There are only three patches this time, most other changes to files in
  include/asm-generic tend to go through the tree of whoever depends on
  the change.

  Two patches are cleanups for stuff that is no longer needed, the main
  change is to adapt the generic version of BUG_ON() for CONFIG_BUG=n to
  make it behave consistently with BUG().

  This avoids undefined behavior along with a number of warnings about
  that undefined behavior in randconfig builds when we keep going on
  after hitting a BUG_ON()"

* tag 'asm-generic-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
  asm-generic: remove old nonatomic-io wrapper files
  asm-generic: default BUG_ON(x) to if(x)BUG()
  asm-generic: page.h: Remove useless get_user_page and free_user_page

1  2 
arch/arc/include/asm/page.h
drivers/dma/idma64.h
include/asm-generic/bug.h

  
  #include <uapi/asm/page.h>
  
 -
  #ifndef __ASSEMBLY__
  
- #define get_user_page(vaddr)          __get_free_page(GFP_KERNEL)
- #define free_user_page(page, addr)    free_page(addr)
  #define clear_page(paddr)             memset((paddr), 0, PAGE_SIZE)
  #define copy_page(to, from)           memcpy((to), (from), PAGE_SIZE)
  
@@@ -75,26 -73,30 +72,26 @@@ typedef unsigned long pgprot_t
  
  typedef pte_t * pgtable_t;
  
 -#define ARCH_PFN_OFFSET     (CONFIG_LINUX_LINK_BASE >> PAGE_SHIFT)
 +#define virt_to_pfn(kaddr)    (__pa(kaddr) >> PAGE_SHIFT)
 +
 +#define ARCH_PFN_OFFSET               virt_to_pfn(CONFIG_LINUX_LINK_BASE)
  
 -#define pfn_valid(pfn)      (((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
 +#define pfn_valid(pfn)                (((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
  
  /*
   * __pa, __va, virt_to_page (ALERT: deprecated, don't use them)
   *
   * These macros have historically been misnamed
   * virt here means link-address/program-address as embedded in object code.
 - * So if kernel img is linked at 0x8000_0000 onwards, 0x8010_0000 will be
 - * 128th page, and virt_to_page( ) will return the struct page corresp to it.
 - * mem_map[ ] is an array of struct page for each page frame in the system
 - *
 - * Independent of where linux is linked at, link-addr = physical address
 - * So the old macro  __pa = vaddr + PAGE_OFFSET - CONFIG_LINUX_LINK_BASE
 - * would have been wrong in case kernel is not at 0x8zs
 + * And for ARC, link-addr = physical address
   */
  #define __pa(vaddr)  ((unsigned long)vaddr)
  #define __va(paddr)  ((void *)((unsigned long)(paddr)))
  
  #define virt_to_page(kaddr)   \
 -      (mem_map + ((__pa(kaddr) - CONFIG_LINUX_LINK_BASE) >> PAGE_SHIFT))
 +      (mem_map + virt_to_pfn((kaddr) - CONFIG_LINUX_LINK_BASE))
  
 -#define virt_addr_valid(kaddr)  pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
 +#define virt_addr_valid(kaddr)  pfn_valid(virt_to_pfn(kaddr))
  
  /* Default Permissions for stack/heaps pages (Non Executable) */
  #define VM_DATA_DEFAULT_FLAGS   (VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE)
diff --combined drivers/dma/idma64.h
@@@ -16,7 -16,7 +16,7 @@@
  #include <linux/spinlock.h>
  #include <linux/types.h>
  
- #include <asm-generic/io-64-nonatomic-lo-hi.h>
+ #include <linux/io-64-nonatomic-lo-hi.h>
  
  #include "virt-dma.h"
  
@@@ -71,7 -71,7 +71,7 @@@
  #define IDMA64C_CFGH_SRC_PER(x)               ((x) << 0)      /* src peripheral */
  #define IDMA64C_CFGH_DST_PER(x)               ((x) << 4)      /* dst peripheral */
  #define IDMA64C_CFGH_RD_ISSUE_THD(x)  ((x) << 8)
 -#define IDMA64C_CFGH_RW_ISSUE_THD(x)  ((x) << 18)
 +#define IDMA64C_CFGH_WR_ISSUE_THD(x)  ((x) << 18)
  
  /* Interrupt registers */
  
@@@ -81,12 -81,6 +81,12 @@@ extern void warn_slowpath_null(const ch
        do { printk(arg); __WARN_TAINT(taint); } while (0)
  #endif
  
 +/* used internally by panic.c */
 +struct warn_args;
 +
 +void __warn(const char *file, int line, void *caller, unsigned taint,
 +          struct pt_regs *regs, struct warn_args *args);
 +
  #ifndef WARN_ON
  #define WARN_ON(condition) ({                                         \
        int __ret_warn_on = !!(condition);                              \
        static bool __section(.data.unlikely) __warned;         \
        int __ret_warn_once = !!(condition);                    \
                                                                \
 -      if (unlikely(__ret_warn_once))                          \
 -              if (WARN_ON(!__warned))                         \
 -                      __warned = true;                        \
 +      if (unlikely(__ret_warn_once && !__warned)) {           \
 +              __warned = true;                                \
 +              WARN_ON(1);                                     \
 +      }                                                       \
        unlikely(__ret_warn_once);                              \
  })
  
        static bool __section(.data.unlikely) __warned;         \
        int __ret_warn_once = !!(condition);                    \
                                                                \
 -      if (unlikely(__ret_warn_once))                          \
 -              if (WARN(!__warned, format))                    \
 -                      __warned = true;                        \
 +      if (unlikely(__ret_warn_once && !__warned)) {           \
 +              __warned = true;                                \
 +              WARN(1, format);                                \
 +      }                                                       \
        unlikely(__ret_warn_once);                              \
  })
  
        static bool __section(.data.unlikely) __warned;         \
        int __ret_warn_once = !!(condition);                    \
                                                                \
 -      if (unlikely(__ret_warn_once))                          \
 -              if (WARN_TAINT(!__warned, taint, format))       \
 -                      __warned = true;                        \
 +      if (unlikely(__ret_warn_once && !__warned)) {           \
 +              __warned = true;                                \
 +              WARN_TAINT(1, taint, format);                   \
 +      }                                                       \
        unlikely(__ret_warn_once);                              \
  })
  
  #endif
  
  #ifndef HAVE_ARCH_BUG_ON
- #define BUG_ON(condition) do { if (condition) ; } while (0)
+ #define BUG_ON(condition) do { if (condition) BUG(); } while (0)
  #endif
  
  #ifndef HAVE_ARCH_WARN_ON