1. 24 6月, 2016 2 次提交
    • K
      of: unittest: use of_platform_default_populate() to populate default bus · 146dedbc
      Kefeng Wang 提交于
      Use helper of_platform_default_populate() in linux/of_platform
      when possible, instead of calling of_platform_populate() with
      the default match table.
      
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Frank Rowand <frowand.list@gmail.com>
      Cc: Grant Likely <grant.likely@linaro.org>
      Signed-off-by: NKefeng Wang <wangkefeng.wang@huawei.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      146dedbc
    • K
      of/platform: Add common method to populate default bus · 44a7185c
      Kefeng Wang 提交于
      The arch code calls of_platform_populate() with default match table
      when it wants to populate default bus.
      
      This patch introduce a new of_platform_default_populate_init() and make it
      arch_initcall_sync(it should be later than some iommu configration, eg,
      of_iommu_init() and swiotlb_late_init in arm64), then we can finish above
      job in common method.
      
      In order to avoid the default bus being populated twice, simply checking
      the flag of bus node whether has be set OF_POPULATED_BUS or not.
      
      After that, we can safely remove the caller in arch code.
      
      Btw, add debug print in of_platform_populate(), and use __func__ to
      print function's name of of_platform_bus_create().
      
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Frank Rowand <frowand.list@gmail.com>
      Cc: Grant Likely <grant.likely@linaro.org>
      Signed-off-by: NKefeng Wang <wangkefeng.wang@huawei.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      44a7185c
  2. 10 6月, 2016 1 次提交
  3. 03 6月, 2016 3 次提交
    • S
      of: silence warnings due to max() usage · aaaab56d
      Stephen Rothwell 提交于
      pageblock_order can be (at least) an unsigned int or an unsigned long
      depending on the kernel config and architecture, so use max_t(unsigned
      long ...) when comparing it.
      
      fixes these warnings:
      
      In file included from include/linux/list.h:8:0,
                       from include/linux/kobject.h:20,
                       from include/linux/of.h:21,
                       from drivers/of/of_reserved_mem.c:17:
      drivers/of/of_reserved_mem.c: In function ‘__reserved_mem_alloc_size’:
      include/linux/kernel.h:748:17: warning: comparison of distinct pointer types lacks a cast
        (void) (&_max1 == &_max2);  \
                       ^
      include/linux/kernel.h:747:9: note: in definition of macro ‘max’
        typeof(y) _max2 = (y);   \
               ^
      drivers/of/of_reserved_mem.c:131:48: note: in expansion of macro ‘max’
         align = max(align, (phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_ord
                                                      ^
      include/linux/kernel.h:748:17: warning: comparison of distinct pointer types lacks a cast
        (void) (&_max1 == &_max2);  \
                       ^
      include/linux/kernel.h:747:21: note: in definition of macro ‘max’
        typeof(y) _max2 = (y);   \
                           ^
      drivers/of/of_reserved_mem.c:131:48: note: in expansion of macro ‘max’
         align = max(align, (phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_ord
                                                      ^
      
      Fixes: 1cc8e345 ("drivers: of: of_reserved_mem: fixup the alignment with CMA setup")
      Signed-off-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: NRob Herring <robh@kernel.org>
      aaaab56d
    • J
      drivers: of: of_reserved_mem: fixup the CMA alignment not to affect dma-coherent · 7d482813
      Jaewon 提交于
      There was an alignment mismatch issue for CMA and it was fixed by
      commit 1cc8e345 ("drivers: of: of_reserved_mem: fixup the alignment with CMA setup").
      However the way of the commit considers not only dma-contiguous(CMA) but also
      dma-coherent which has no that requirement.
      
      This patch checks more to distinguish dma-contiguous(CMA) from dma-coherent.
      Signed-off-by: NJaewon Kim <jaewon31.kim@samsung.com>
      Acked-by: NJason Liu <r64343@freescale.com>
      Acked-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      [robh: remove erroneous opening bracket]
      Signed-off-by: NRob Herring <robh@kernel.org>
      7d482813
    • S
      of: irq: fix of_irq_get[_byname]() kernel-doc · 39935466
      Sergei Shtylyov 提交于
      The kernel-doc for the of_irq_get[_byname]()  is clearly inadequate in
      describing the return values -- of_irq_get_byname() is documented better
      than of_irq_get() but it  still doesn't mention that 0 is returned iff
      irq_create_of_mapping() fails (it doesn't return an error code in this
      case). Document all possible return value variants, making the writing
      of the word "IRQ" consistent, while at it...
      
      Fixes: 9ec36caf ("of/irq: do irq resolution in platform_get_irq")
      Fixes: ad69674e ("of/irq: do irq resolution in platform_get_irq_byname()")
      Signed-off-by: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      CC: stable@vger.kernel.org
      Signed-off-by: NRob Herring <robh@kernel.org>
      39935466
  4. 19 5月, 2016 3 次提交
    • J
      of/unittest: Remove unnecessary module.h header inclusion · 27f4ec14
      Javier Martinez Canillas 提交于
      The OF_UNITTEST Kconfig symbol is bool so this unittest can only be
      built-in and not build as a module. Also, nothing defined in this
      header file used so is not necessary to include it.
      Signed-off-by: NJavier Martinez Canillas <javier@osg.samsung.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      27f4ec14
    • G
      drivers/of: Fix build warning in populate_node() · dddc33e5
      Gavin Shan 提交于
      Function populate_node() is used to unflatten FDT blob to device
      tree. It supports maximal 64 level of device nodes. There is one
      array @fpsizes[64] tracking the full name length of last unflattened
      device node in the corresponding level (index of element in the
      array - 1). Build warning is seen with CONFIG_FRAME_WARN=1024 like
      below on ARM64 as Geert reported. The issue can be reproduced on
      PPC64 as well.
      
        $ make drivers/of/fdt.o
        drivers/of/fdt.c:443:1: warning: the frame size of 1136 bytes is \
        larger than 1024 bytes [-Wframe-larger-than=]
      
      This changes the data type of @fpsizes[i] from "unsigned long" to
      "unsigned int" to avoid the build warning. The return value type
      of populate_node() and its @fpsize argument is adjusted accordingly.
      With this applied, 256 bytes saved from the stack frame on ARM64 and
      PPC64 platforms and the above warning isn't seen.
      
      Fixes: 50800082 ("drivers/of: Avoid recursively calling unflatten_dt_node()")
      Reported-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      dddc33e5
    • R
      drivers/of: Fix depth when unflattening devicetree · 78c44d91
      Rhyland Klein 提交于
      When the implementation for unflatten_dt_node() changed from being
      recursive to being non-recursive, it had a side effect of increasing the
      depth passed to fdt_next_node() by 1. This is fine most of the time, but
      it seems that when the end of the dtb is being parsed, it will cause the
      FDT_END condition in fdt_next_node() to return a different value
      (returning nextoffset instead of -FDT_ERR_NOTFOUND). This ends up passing
      an FDT_ERR_TRUNCATED error back to the unflatten_dt_node() which then
      sees that and complains "Error -8 processing FDT" causing boot to fail.
      
      This patch simply avoids incrementing depth and uses modified accesses
      for local array indices so that the depth is the same as it was before
      the change as far as fdt_next_node() is concerned.
      
      This problem was discovered trying to boot Tegra210-Smaug platforms.
      
      Fixes: 50800082 ("drivers/of: Avoid recursively calling unflatten_dt_node()")
      Signed-off-by: NRhyland Klein <rklein@nvidia.com>
      [robh: squashed in KASAN fix from Rhyland]
      Signed-off-by: NRob Herring <robh@kernel.org>
      78c44d91
  5. 16 5月, 2016 7 次提交
  6. 12 5月, 2016 1 次提交
  7. 11 5月, 2016 1 次提交
    • S
      drivers/of: Add check for null property in of_remove_property() · 201b3fe5
      Suraj Jitindar Singh 提交于
      The validity of the property input argument to of_remove_property() is
      never checked within the function and thus it is possible to pass a null
      value. It happens that this will be picked up in __of_remove_property()
      as no matching property of the device node will be found and thus an
      error will be returned, however once again there is no explicit check
      for a null value. By the time this is detected 2 locks have already been
      acquired which is completely unnecessary if the property to remove is
      null.
      
      Add an explicit check in the function of_remove_property() for a null
      property value and return -ENODEV in this case, this is consistent with
      what the previous return value would have been when the null value was
      not detected and passed to __of_remove_property().
      
      By moving an explicit check for the property paramenter into the
      of_remove_property() function, this will remove the need to perform this
      check in calling code before invocation of the of_remove_property()
      function.
      Signed-off-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Acked-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      201b3fe5
  8. 09 5月, 2016 1 次提交
  9. 06 5月, 2016 1 次提交
  10. 02 5月, 2016 1 次提交
  11. 27 4月, 2016 1 次提交
  12. 25 4月, 2016 1 次提交
  13. 22 4月, 2016 1 次提交
  14. 20 4月, 2016 7 次提交
  15. 19 4月, 2016 1 次提交
  16. 16 4月, 2016 1 次提交
  17. 15 4月, 2016 1 次提交
    • T
      of/platform: Allow secondary compatible match in of_dev_lookup · fc5cf80a
      Tony Lindgren 提交于
      We currently try to match of_dev_auxdata based on compatible,
      IO address, and device name. But in some cases we have multiple
      instances of drivers that can use the same auxdata.
      
      Let's add an additional secondary lookup for generic compatible
      match for auxdata if no device specific match is found. This does
      not change the existing matching, and still allows adding device
      specific auxdata.
      
      This simplifies things as specifying the IO address and device
      name is prone errors as it requires maintaining an in kernel
      database for each SoC.
      
      To specify a generic match, all that is needed is to add a
      OF_DEV_AUXDATA entry with no device instance specified:
      
      OF_DEV_AUXDATA("pinctrl-single", 0, NULL, &pcs_pdata),
      
      As the auxdata is already initialized only for the booted SoC,
      there's not much of a chance of getting things wrong.
      
      Let's also fix two checkpatch warnings while at it to add a
      space before parenthesis in the for loop, and remove a comparison
      to NULL by using !auxdata->compatible.
      Acked-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      fc5cf80a
  18. 15 3月, 2016 3 次提交
  19. 04 3月, 2016 3 次提交
    • D
      of: add 'const' for of_property_*_string*() parameter '*np' · fe99c707
      David Rivshin 提交于
      The of_property_{read,count,match}_string* family of functions never
      modify the struct device_node pointer that is passed in, so there is no
      reason for it to be non-const. Equivalent functions for all other types
      already take a 'const struct device_node *np'.
      Signed-off-by: NDavid Rivshin <drivshin@allworx.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      fe99c707
    • S
      of/unittest: fix infinite loop in of_unittest_destroy_tracked_overlays() · 815d74b3
      Sergey Senozhatsky 提交于
      of_overlay_destroy() can return `-ENODEV' error code once it
      failed to find the requested overlay in `ov_idr'. However,
      of_unittest_destroy_tracked_overlays() does not handle this
      error code correctly and continues to call of_overlay_destroy()
      on the 'missing' overlay over and over again. This results in
      a printk flood
      
      [..]
      [   33.497583] of_overlay_destroy: Could not find overlay #6
      [   33.497583] of_overlay_destroy: Could not find overlay #6
      [   33.497584] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
      [   33.497584] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
      [   33.497586] of_overlay_destroy: Could not find overlay #6
      [   33.497586] of_overlay_destroy: Could not find overlay #6
      [   33.497587] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
      [   33.497587] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
      [..]
      
      which is not really good due to printk design, and can lead to soft
      lockups, hard lockups, etc. (depending on the context console_unlock()
      is being called from). The problem has bee observed in real life
      and reported by Ying Huang.
      
      This patch does not address the root cause of missing overlay in
      `ov_idr', it fixes the endless loop only.
      Signed-off-by: NSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Reported-by: Nkernel test robot <ying.huang@linux.intel.com>
      Link: lkml.kernel.org/r/87fuwk1c0o.fsf@yhuang-dev.intel.com
      Signed-off-by: NRob Herring <robh@kernel.org>
      815d74b3
    • V
      of: alloc anywhere from memblock if range not specified · e53b50c0
      Vinayak Menon 提交于
      early_init_dt_alloc_reserved_memory_arch passes end as 0 to
      __memblock_alloc_base, when limits are not specified. But
      __memblock_alloc_base takes end value of 0 as MEMBLOCK_ALLOC_ACCESSIBLE
      and limits the end to memblock.current_limit. This results in regions
      never being placed in HIGHMEM area, for e.g. CMA.
      Let __memblock_alloc_base allocate from anywhere in memory if limits are
      not specified.
      Acked-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: NVinayak Menon <vinmenon@codeaurora.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: NRob Herring <robh@kernel.org>
      e53b50c0