1. 27 1月, 2015 1 次提交
  2. 24 1月, 2015 2 次提交
    • P
      i2c: s3c2410: fix ABBA deadlock by keeping clock prepared · 34e81ad5
      Paul Osmialowski 提交于
      This patch solves deadlock between clock prepare mutex and regmap mutex reported
      by Tomasz Figa in [1] by implementing solution from [2]: "always leave the clock
      of the i2c controller in a prepared state".
      
      [1] https://lkml.org/lkml/2014/7/2/171
      [2] https://lkml.org/lkml/2014/7/2/207
      
      On each i2c transfer handled by s3c24xx_i2c_xfer(), clk_prepare_enable() was
      called, which calls clk_prepare() then clk_enable(). clk_prepare() takes
      prepare_lock mutex before proceeding. Note that i2c transfer functions are
      invoked from many places in kernel, typically with some other additional lock
      held.
      
      It may happen that function on CPU1 (e.g. regmap_update_bits()) has taken a
      mutex (i.e. regmap lock mutex) then it attempts i2c communication in order to
      proceed (so it needs to obtain clock related prepare_lock mutex during transfer
      preparation stage due to clk_prepare() call). At the same time other task on
      CPU0 wants to operate on clock (e.g. to (un)prepare clock for some other reason)
      so it has taken prepare_lock mutex.
      
      CPU0:                        CPU1:
      clk_disable_unused()         regulator_disable()
        clk_prepare_lock()           map->lock(map->lock_arg)
        regmap_read()                s3c24xx_i2c_xfer()
          map->lock(map->lock_arg)     clk_prepare_lock()
      
      Implemented solution from [2] leaves i2c clock prepared. Preparation is done in
      s3c24xx_i2c_probe() function. Without this patch, it is immediately unprepared
      by clk_disable_unprepare() call. I've replaced this call with clk_disable() and
      I've added clk_unprepare() call in s3c24xx_i2c_remove().
      
      The s3c24xx_i2c_xfer() function now uses clk_enable() instead of
      clk_prepare_enable() (and clk_disable() instead of clk_unprepare_disable()).
      Signed-off-by: NPaul Osmialowski <p.osmialowsk@samsung.com>
      Reviewed-by: NKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      Cc: stable@kernel.org
      34e81ad5
    • W
      i2c: slave-eeprom: fix boundary check when using sysfs · 2541f7f4
      Wolfram Sang 提交于
      Due to a copy&paste error, the last byte of the shared memory was not
      accessible via sysfs.
      Reported-by: NDebora Grosse <debora@mds.com>
      Signed-off-by: NWolfram Sang <wsa+renesas@sang-engineering.com>
      Acked-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      2541f7f4
  3. 09 1月, 2015 1 次提交
  4. 08 1月, 2015 1 次提交
  5. 07 1月, 2015 10 次提交
  6. 06 1月, 2015 13 次提交
  7. 05 1月, 2015 6 次提交
  8. 03 1月, 2015 5 次提交
  9. 01 1月, 2015 1 次提交