1. 09 12月, 2015 1 次提交
  2. 22 10月, 2015 1 次提交
    • J
      of/irq: add missing of_node_put · 8363ccb9
      Julia Lawall 提交于
      for_each_matching_node performs an of_node_get on each iteration, so
      a break out of the loop requires an of_node_put.
      
      A simplified version of the semantic patch that fixes this problem is as
      follows (http://coccinelle.lip6.fr):
      
      // <smpl>
      @@
      local idexpression n;
      expression e;
      identifier l;
      @@
      
       for_each_matching_node(n,...) {
         ...
      (
         of_node_put(n);
      |
         e = n
      |
      +  of_node_put(n);
      ?  goto l;
      )
         ...
       }
      ...
      l: ... when != n
      // </smpl>
      
      Besides the issue found by the semantic patch, this code also stores the
      device_node value in a list, which requires an of_node_get, and then cleans
      up the list on exit from the function, which requires an of_node_put.
      Signed-off-by: NJulia Lawall <Julia.Lawall@lip6.fr>
      Signed-off-by: NRob Herring <robh@kernel.org>
      8363ccb9
  3. 16 10月, 2015 5 次提交
  4. 14 10月, 2015 1 次提交
  5. 27 8月, 2015 1 次提交
  6. 30 7月, 2015 1 次提交
  7. 01 7月, 2015 1 次提交
  8. 30 6月, 2015 1 次提交
  9. 19 3月, 2015 1 次提交
  10. 10 11月, 2014 1 次提交
  11. 16 8月, 2014 1 次提交
  12. 23 5月, 2014 1 次提交
    • G
      of/irq: do irq resolution in platform_get_irq_byname() · ad69674e
      Grygorii Strashko 提交于
      The commit 9ec36caf
      "of/irq: do irq resolution in platform_get_irq" from Rob Herring -
      moves resolving of the interrupt resources in platform_get_irq().
      But this solution isn't complete because platform_get_irq_byname()
      need to be modified the same way.
      
      Hence, fix it by adding interrupt resolution code at the
      platform_get_irq_byname() function too.
      
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Tony Lindgren <tony@atomide.com>
      Cc: Grant Likely <grant.likely@linaro.org>
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Signed-off-by: NGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      ad69674e
  13. 25 4月, 2014 1 次提交
    • R
      of/irq: do irq resolution in platform_get_irq · 9ec36caf
      Rob Herring 提交于
      Currently we get the following kind of errors if we try to use interrupt
      phandles to irqchips that have not yet initialized:
      
      irq: no irq domain found for /ocp/pinmux@48002030 !
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 1 at drivers/of/platform.c:171 of_device_alloc+0x144/0x184()
      Modules linked in:
      CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.12.0-00038-g42a9708 #1012
      (show_stack+0x14/0x1c)
      (dump_stack+0x6c/0xa0)
      (warn_slowpath_common+0x64/0x84)
      (warn_slowpath_null+0x1c/0x24)
      (of_device_alloc+0x144/0x184)
      (of_platform_device_create_pdata+0x44/0x9c)
      (of_platform_bus_create+0xd0/0x170)
      (of_platform_bus_create+0x12c/0x170)
      (of_platform_populate+0x60/0x98)
      
      This is because we're wrongly trying to populate resources that are not
      yet available. It's perfectly valid to create irqchips dynamically, so
      let's fix up the issue by resolving the interrupt resources when
      platform_get_irq is called.
      
      And then we also need to accept the fact that some irqdomains do not
      exist that early on, and only get initialized later on. So we can
      make the current WARN_ON into just into a pr_debug().
      
      We still attempt to populate irq resources when we create the devices.
      This allows current drivers which don't use platform_get_irq to continue
      to function. Once all drivers are fixed, this code can be removed.
      Suggested-by: NRussell King <linux@arm.linux.org.uk>
      Signed-off-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      Tested-by: NTony Lindgren <tony@atomide.com>
      Cc: stable@vger.kernel.org # v3.10+
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      9ec36caf
  14. 23 4月, 2014 1 次提交
  15. 31 12月, 2013 1 次提交
    • C
      of/irq: Fix device_node refcount in of_irq_parse_raw() · 2f53a713
      Cédric Le Goater 提交于
      Commit 23616132, "of/irq: Refactor interrupt-map parsing" changed
      the refcount on the device_node causing an error in of_node_put():
      
      ERROR: Bad of_node_put() on /pci@800000020000000
      CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.13.0-rc3-dirty #2
      Call Trace:
      [c00000003e403500] [c0000000000144fc] .show_stack+0x7c/0x1f0 (unreliable)
      [c00000003e4035d0] [c00000000070f250] .dump_stack+0x88/0xb4
      [c00000003e403650] [c0000000005e8768] .of_node_release+0xd8/0xf0
      [c00000003e4036e0] [c0000000005eeafc] .of_irq_parse_one+0x10c/0x280
      [c00000003e4037a0] [c0000000005efd4c] .of_irq_parse_pci+0x3c/0x1d0
      [c00000003e403840] [c000000000038240] .pcibios_setup_device+0xa0/0x2e0
      [c00000003e403910] [c0000000000398f0] .pcibios_setup_bus_devices+0x60/0xd0
      [c00000003e403990] [c00000000003b3a4] .__of_scan_bus+0x1a4/0x2b0
      [c00000003e403a80] [c00000000003a62c] .pcibios_scan_phb+0x30c/0x410
      [c00000003e403b60] [c0000000009fe430] .pcibios_init+0x7c/0xd4
      
      This patch adjusts the refcount in the walk of the interrupt tree.
      When a match is found, there is no need to increase the refcount
      on 'out_irq->np' as 'newpar' is already holding a ref. The refcount
      balance between 'ipar' and 'newpar' is maintained in the skiplevel:
      goto label.
      
      This patch also removes the usage of the device_node variable 'old'
      which seems useless after the latest changes.
      Signed-off-by: NCédric Le Goater <clg@fr.ibm.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      2f53a713
  16. 05 12月, 2013 2 次提交
  17. 08 11月, 2013 1 次提交
  18. 04 11月, 2013 2 次提交
  19. 29 10月, 2013 1 次提交
    • G
      of/irq: create interrupts-extended property · 79d97015
      Grant Likely 提交于
      The standard interrupts property in device tree can only handle
      interrupts coming from a single interrupt parent. If a device is wired
      to multiple interrupt controllers, then it needs to be attached to a
      node with an interrupt-map property to demux the interrupt specifiers
      which is confusing. It would be a lot easier if there was a form of the
      interrupts property that allows for a separate interrupt phandle for
      each interrupt specifier.
      
      This patch does exactly that by creating a new interrupts-extended
      property which reuses the phandle+arguments pattern used by GPIOs and
      other core bindings.
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      Acked-by: NTony Lindgren <tony@atomide.com>
      Acked-by: NKumar Gala <galak@codeaurora.org>
      [grant.likely: removed versatile platform hunks into separate patch]
      Cc: Rob Herring <rob.herring@calxeda.com>
      79d97015
  20. 24 10月, 2013 6 次提交
    • T
      of/irq: Rework of_irq_count() · 3da52787
      Thierry Reding 提交于
      The of_irq_to_resource() helper that is used to implement of_irq_count()
      tries to resolve interrupts and in fact creates a mapping for resolved
      interrupts. That's pretty heavy lifting for something that claims to
      just return the number of interrupts requested by a given device node.
      
      Instead, use the more lightweight of_irq_map_one(), which, despite the
      name, doesn't create an actual mapping. Perhaps a better name would be
      of_irq_translate_one().
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      Acked-by: NRob Herring <rob.herring@calxeda.com>
      [grant.likely: fixup s/of_irq_map_one/of_irq_parse_one/]
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      3da52787
    • G
      of: Add helper for printing an of_phandle_args structure · 624cfca5
      Grant Likely 提交于
      It is sometimes useful for debug to get the contents of an
      of_phandle_args structure out into the kernel log.
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      624cfca5
    • G
      of/irq: Refactor interrupt-map parsing · 23616132
      Grant Likely 提交于
      All the users of of_irq_parse_raw pass in a raw interrupt specifier from
      the device tree and expect it to be returned (possibly modified) in an
      of_phandle_args structure. However, the primary function of
      of_irq_parse_raw() is to check for translations due to the presence of
      one or more interrupt-map properties. The actual placing of the data
      into an of_phandle_args structure is trivial. If it is refactored to
      accept an of_phandle_args structure directly, then it becomes possible
      to consume of_phandle_args from other sources. This is important for an
      upcoming patch that allows a device to be connected to more than one
      interrupt parent. It also simplifies the code a bit.
      
      The biggest complication with this patch is that the old version works
      on the interrupt specifiers in __be32 form, but the of_phandle_args
      structure is intended to carry it in the cpu-native version. A bit of
      churn was required to make this work. In the end it results in tighter
      code, so the churn is worth it.
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      Acked-by: NTony Lindgren <tony@atomide.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      23616132
    • G
      of/irq: simplify args to irq_create_of_mapping · e6d30ab1
      Grant Likely 提交于
      All the callers of irq_create_of_mapping() pass the contents of a struct
      of_phandle_args structure to the function. Since all the callers already
      have an of_phandle_args pointer, why not pass it directly to
      irq_create_of_mapping()?
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      Acked-by: NMichal Simek <monstr@monstr.eu>
      Acked-by: NTony Lindgren <tony@atomide.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      e6d30ab1
    • G
      of/irq: Replace of_irq with of_phandle_args · 530210c7
      Grant Likely 提交于
      struct of_irq and struct of_phandle_args are exactly the same structure.
      This patch makes the kernel use of_phandle_args everywhere. This in
      itself isn't a big deal, but it makes some follow-on patches simpler.
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      Acked-by: NMichal Simek <monstr@monstr.eu>
      Acked-by: NTony Lindgren <tony@atomide.com>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      530210c7
    • G
      of/irq: Rename of_irq_map_* functions to of_irq_parse_* · 0c02c800
      Grant Likely 提交于
      The OF irq handling code has been overloading the term 'map' to refer to
      both parsing the data in the device tree and mapping it to the internal
      linux irq system. This is probably because the device tree does have the
      concept of an 'interrupt-map' function for translating interrupt
      references from one node to another, but 'map' is still confusing when
      the primary purpose of some of the functions are to parse the DT data.
      
      This patch renames all the of_irq_map_* functions to of_irq_parse_*
      which makes it clear that there is a difference between the parsing
      phase and the mapping phase. Kernel code can make use of just the
      parsing or just the mapping support as needed by the subsystem.
      
      The patch was generated mechanically with a handful of sed commands.
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      Acked-by: NMichal Simek <monstr@monstr.eu>
      Acked-by: NTony Lindgren <tony@atomide.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      0c02c800
  21. 16 10月, 2013 2 次提交
    • T
      of/irq: Pass trigger type in IRQ resource flags · 4a43d686
      Tomasz Figa 提交于
      Some drivers might rely on availability of trigger flags in IRQ
      resource, for example to configure the hardware for particular interrupt
      type. However current code creating IRQ resources from data in device
      tree does not configure trigger flags in resulting resources.
      
      This patch tries to solve the problem, based on the fact that
      irq_of_parse_and_map() configures the trigger based on DT interrupt
      specifier and IRQD_TRIGGER_* flags are consistent with IORESOURCE_IRQ_*,
      and we can get correct trigger flags by calling irqd_get_trigger_type()
      after mapping the interrupt.
      Signed-off-by: NTomasz Figa <tomasz.figa@gmail.com>
      [grant.likely: Merged the two assignments to r->flags]
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      4a43d686
    • G
      of: Fix dereferencing node name in debug output to be safe · 8804827b
      Grant Likely 提交于
      Several locations in the of_address and of_irq code dereference the
      full_name parameter from a device_node pointer without checking if the
      pointer is valid.  This patch switches to use of_node_full_name() which
      always checks the pointer.
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      8804827b
  22. 10 9月, 2013 1 次提交
  23. 23 7月, 2013 2 次提交
  24. 18 10月, 2012 1 次提交
    • K
      of/irq: sparse fixes · d2e41518
      Kim Phillips 提交于
      drivers/of/irq.c:195:57: warning: restricted __be32 degrades to integer
      drivers/of/irq.c:196:51: warning: restricted __be32 degrades to integer
      drivers/of/irq.c:199:57: warning: restricted __be32 degrades to integer
      drivers/of/irq.c:201:58: warning: restricted __be32 degrades to integer
      drivers/of/irq.c:470:37: warning: incorrect type in assignment (different modifiers)
      drivers/of/irq.c:470:37:    expected int ( *[usertype] irq_init_cb )( ... )
      drivers/of/irq.c:470:37:    got void const *const data
      drivers/of/irq.c:96:5: error: symbol 'of_irq_map_raw' redeclared with different type (originally declared at include/linux/of_irq.h:61) - incompatible argument 2 (different base types)
      
      drivers/of/of_pci_irq.c:91:40: warning: incorrect type in argument 2 (different base types)
      drivers/of/of_pci_irq.c:91:40:    expected unsigned int const [usertype] *intspec
      drivers/of/of_pci_irq.c:91:40:    got restricted __be32 *<noident>
      drivers/of/of_pci_irq.c:91:53: warning: incorrect type in argument 4 (different base types)
      drivers/of/of_pci_irq.c:91:53:    expected unsigned int const [usertype] *addr
      drivers/of/of_pci_irq.c:91:53:    got restricted __be32 *<noident>
      Signed-off-by: NKim Phillips <kim.phillips@freescale.com>
      Signed-off-by: NRob Herring <rob.herring@calxeda.com>
      d2e41518
  25. 07 9月, 2012 1 次提交
  26. 06 7月, 2012 1 次提交
  27. 16 6月, 2012 1 次提交
    • G
      devicetree: add helper inline for retrieving a node's full name · efd68e72
      Grant Likely 提交于
      The pattern (np ? np->full_name : "<none>") is rather common in the
      kernel, but can also make for quite long lines.  This patch adds a new
      inline function, of_node_full_name() so that the test for a valid node
      pointer doesn't need to be open coded at all call sites.
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      Cc: Paul Mundt <lethal@linux-sh.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      efd68e72