1. 22 9月, 2020 1 次提交
  2. 18 9月, 2020 2 次提交
    • C
      d36cb020
    • C
      regmap: debugfs: Fix handling of name string for debugfs init delays · 94cc89eb
      Charles Keepax 提交于
      In regmap_debugfs_init the initialisation of the debugfs is delayed
      if the root node isn't ready yet. Most callers of regmap_debugfs_init
      pass the name from the regmap_config, which is considered temporary
      ie. may be unallocated after the regmap_init call returns. This leads
      to a potential use after free, where config->name has been freed by
      the time it is used in regmap_debugfs_initcall.
      
      This situation can be seen on Zynq, where the architecture init_irq
      callback registers a syscon device, using a local variable for the
      regmap_config. As init_irq is very early in the platform bring up the
      regmap debugfs root isn't ready yet. Although this doesn't crash it
      does result in the debugfs entry not having the correct name.
      
      Regmap already sets map->name from config->name on the regmap_init
      path and the fact that a separate field is used to pass the name
      to regmap_debugfs_init appears to be an artifact of the debugfs
      name being added before the map name. As such this patch updates
      regmap_debugfs_init to use map->name, which is already duplicated from
      the config avoiding the issue.
      
      This does however leave two lose ends, both regmap_attach_dev and
      regmap_reinit_cache can be called after a regmap is registered and
      would have had the effect of applying a new name to the debugfs
      entries. In both of these cases it was chosen to update the map
      name. In the case of regmap_attach_dev there are 3 users that
      currently use this function to update the name, thus doing so avoids
      changes for those users and it seems reasonable that attaching
      a device would want to set the name of the map. In the case of
      regmap_reinit_cache the primary use-case appears to be devices that
      need some register access to identify the device (for example devices
      in the same family) and then update the cache to match the exact
      hardware. Whilst no users do currently update the name here, given the
      use-case it seemed reasonable the name might want to be updated once
      the device is better identified.
      Signed-off-by: NCharles Keepax <ckeepax@opensource.cirrus.com>
      Link: https://lore.kernel.org/r/20200917120828.12987-1-ckeepax@opensource.cirrus.comSigned-off-by: NMark Brown <broonie@kernel.org>
      94cc89eb
  3. 17 7月, 2020 1 次提交
  4. 10 7月, 2020 1 次提交
  5. 08 7月, 2020 2 次提交
  6. 03 7月, 2020 1 次提交
  7. 18 6月, 2020 1 次提交
  8. 16 6月, 2020 1 次提交
  9. 08 6月, 2020 1 次提交
  10. 02 6月, 2020 1 次提交
  11. 01 6月, 2020 1 次提交
  12. 29 5月, 2020 1 次提交
  13. 24 4月, 2020 1 次提交
  14. 14 4月, 2020 2 次提交
  15. 14 3月, 2020 1 次提交
  16. 22 1月, 2020 1 次提交
  17. 07 1月, 2020 1 次提交
  18. 19 11月, 2019 1 次提交
  19. 12 8月, 2019 1 次提交
  20. 09 8月, 2019 1 次提交
  21. 01 8月, 2019 1 次提交
  22. 04 7月, 2019 1 次提交
  23. 17 6月, 2019 1 次提交
  24. 12 6月, 2019 1 次提交
    • S
      regmap: fix bulk writes on paged registers · db057679
      Srinivas Kandagatla 提交于
      On buses like SlimBus and SoundWire which does not support
      gather_writes yet in regmap, A bulk write on paged register
      would be silently ignored after programming page.
      This is because local variable 'ret' value in regmap_raw_write_impl()
      gets reset to 0 once page register is written successfully and the
      code below checks for 'ret' value to be -ENOTSUPP before linearising
      the write buffer to send to bus->write().
      
      Fix this by resetting the 'ret' value to -ENOTSUPP in cases where
      gather_writes() is not supported or single register write is
      not possible.
      Signed-off-by: NSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      db057679
  25. 07 6月, 2019 1 次提交
  26. 20 5月, 2019 1 次提交
    • D
      regmap: debugfs: Fix memory leak in regmap_debugfs_init · 2899872b
      Daniel Baluta 提交于
      As detected by kmemleak running on i.MX6ULL board:
      
      nreferenced object 0xd8366600 (size 64):
        comm "swapper/0", pid 1, jiffies 4294937370 (age 933.220s)
        hex dump (first 32 bytes):
          64 75 6d 6d 79 2d 69 6f 6d 75 78 63 2d 67 70 72  dummy-iomuxc-gpr
          40 32 30 65 34 30 30 30 00 e3 f3 ab fe d1 1b dd  @20e4000........
        backtrace:
          [<b0402aec>] kasprintf+0x2c/0x54
          [<a6fbad2c>] regmap_debugfs_init+0x7c/0x31c
          [<9c8d91fa>] __regmap_init+0xb5c/0xcf4
          [<5b1c3d2a>] of_syscon_register+0x164/0x2c4
          [<596a5d80>] syscon_node_to_regmap+0x64/0x90
          [<49bd597b>] imx6ul_init_machine+0x34/0xa0
          [<250a4dac>] customize_machine+0x1c/0x30
          [<2d19fdaf>] do_one_initcall+0x7c/0x398
          [<e6084469>] kernel_init_freeable+0x328/0x448
          [<168c9101>] kernel_init+0x8/0x114
          [<913268aa>] ret_from_fork+0x14/0x20
          [<ce7b131a>] 0x0
      
      Root cause is that map->debugfs_name is allocated using kasprintf
      and then the pointer is lost by assigning it other memory address.
      Reported-by: NStefan Wahren <stefan.wahren@i2se.com>
      Signed-off-by: NDaniel Baluta <daniel.baluta@nxp.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      2899872b
  27. 26 4月, 2019 1 次提交
  28. 03 4月, 2019 1 次提交
    • H
      regmap: verify if register is writeable before writing operations · 8b9f9d4d
      Han Nandor 提交于
      regmap provides a couple of ways to validate the register range used.
      a) maxim allowed register, b) writable/readable register tables,
      c) callback function that can be provided by the driver to validate
      a register. regmap framework should verify if registers
      are writeable before every write operation. However this doesn't
      seems to happen in every situation.
      
      The method `_regmap_raw_write_impl` is only using the `writeable_reg`
      callback to verify if register is writeable, ignoring the other two.
      This can lead to undefined behaviour since this allows to write to
      registers that could be declared un-writeable by using any other
      option.
      
      Change `_regmap_raw_write_impl` to use the `regmap_writeable` method
      to verify if registers are writable before the write operation.
      Signed-off-by: NNandor Han <nandor.han@vaisala.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      8b9f9d4d
  29. 01 4月, 2019 1 次提交
  30. 21 3月, 2019 1 次提交
  31. 19 3月, 2019 1 次提交
  32. 29 1月, 2019 1 次提交
    • M
      regmap: Remove attribute packed from struct 'regcache_rbtree_node' · 435bba0f
      Mathieu Malaterre 提交于
      On one hand commit 28644c80 ("regmap: Add the rbtree cache support")
      added 'regcache_rbtree_node' as packed structure, while on the other hand
      commit e977145a ("[RBTREE] Add explicit alignment to sizeof(long)
      for struct rb_node.") declared struct 'rb_node' as aligned.
      
      Solve the ambiguity of placing aligned structure in a packed one by
      removing the packed attribute from struct. This seems to be the behavior
      of gcc anyway.
      
      This removes the following warning (W=1):
      
        drivers/base/regmap/regcache-rbtree.c:36:1: warning: alignment 1 of 'struct regcache_rbtree_node' is less than 4 [-Wpacked-not-aligned]
      
      Cc: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Signed-off-by: NMathieu Malaterre <malat@debian.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      435bba0f
  33. 23 1月, 2019 1 次提交
    • M
      regmap: regmap-irq: Add main status register support · a2d21848
      Matti Vaittinen 提交于
      There is bunch of devices with multiple logical blocks which
      can generate interrupts. It's not a rare case that the interrupt
      reason registers are arranged so that there is own status/ack/mask
      register for each logical block. In some devices there is also a
      'main interrupt register(s)' which can indicate what sub blocks
      have interrupts pending.
      
      When such a device is connected via slow bus like i2c the main
      part of interrupt handling latency can be caused by bus accesses.
      On systems where it is expected that only one (or few) sub blocks
      have active interrupts we can reduce the latency by only reading
      the main register and those sub registers which have active
      interrupts. Support this with regmap-irq for simple cases where
      main register does not require acking or masking.
      Signed-off-by: NMatti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      a2d21848
  34. 15 1月, 2019 1 次提交
  35. 01 1月, 2019 1 次提交
  36. 20 12月, 2018 2 次提交
    • B
      regmap: irq: add an option to clear status registers on unmask · c82ea33e
      Bartosz Golaszewski 提交于
      Some interrupt controllers whose interrupts are acked on read will set
      the status bits for masked interrupts without changing the state of
      the IRQ line.
      
      Some chips have an additional "feature" where if those set bits are
      not cleared before unmasking their respective interrupts, the IRQ
      line will change the state and we'll interpret this as an interrupt
      although it actually fired when it was masked.
      
      Add a new field to the irq chip struct that tells the regmap irq chip
      code to always clear the status registers before actually changing the
      irq mask values.
      Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      c82ea33e
    • M
      regmap: regmap-irq/gpio-max77620: add level-irq support · 1c2928e3
      Matti Vaittinen 提交于
      Add level active IRQ support to regmap-irq irqchip. Change breaks
      existing regmap-irq type setting. Convert the existing drivers which
      use regmap-irq with trigger type setting (gpio-max77620) to work
      with this new approach. So we do not magically support level-active
      IRQs on gpio-max77620 - but add support to the regmap-irq for chips
      which support them =)
      
      We do not support distinguishing situation where HW supports rising
      and falling edge detection but not both. Separating this would require
      inventing yet another flags for IRQ types.
      Signed-off-by: NMatti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      1c2928e3