1. 25 7月, 2016 17 次提交
  2. 28 5月, 2016 1 次提交
    • A
      remove lots of IS_ERR_VALUE abuses · 287980e4
      Arnd Bergmann 提交于
      Most users of IS_ERR_VALUE() in the kernel are wrong, as they
      pass an 'int' into a function that takes an 'unsigned long'
      argument. This happens to work because the type is sign-extended
      on 64-bit architectures before it gets converted into an
      unsigned type.
      
      However, anything that passes an 'unsigned short' or 'unsigned int'
      argument into IS_ERR_VALUE() is guaranteed to be broken, as are
      8-bit integers and types that are wider than 'unsigned long'.
      
      Andrzej Hajda has already fixed a lot of the worst abusers that
      were causing actual bugs, but it would be nice to prevent any
      users that are not passing 'unsigned long' arguments.
      
      This patch changes all users of IS_ERR_VALUE() that I could find
      on 32-bit ARM randconfig builds and x86 allmodconfig. For the
      moment, this doesn't change the definition of IS_ERR_VALUE()
      because there are probably still architecture specific users
      elsewhere.
      
      Almost all the warnings I got are for files that are better off
      using 'if (err)' or 'if (err < 0)'.
      The only legitimate user I could find that we get a warning for
      is the (32-bit only) freescale fman driver, so I did not remove
      the IS_ERR_VALUE() there but changed the type to 'unsigned long'.
      For 9pfs, I just worked around one user whose calling conventions
      are so obscure that I did not dare change the behavior.
      
      I was using this definition for testing:
      
       #define IS_ERR_VALUE(x) ((unsigned long*)NULL == (typeof (x)*)NULL && \
             unlikely((unsigned long long)(x) >= (unsigned long long)(typeof(x))-MAX_ERRNO))
      
      which ends up making all 16-bit or wider types work correctly with
      the most plausible interpretation of what IS_ERR_VALUE() was supposed
      to return according to its users, but also causes a compile-time
      warning for any users that do not pass an 'unsigned long' argument.
      
      I suggested this approach earlier this year, but back then we ended
      up deciding to just fix the users that are obviously broken. After
      the initial warning that caused me to get involved in the discussion
      (fs/gfs2/dir.c) showed up again in the mainline kernel, Linus
      asked me to send the whole thing again.
      
      [ Updated the 9p parts as per Al Viro  - Linus ]
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Andrzej Hajda <a.hajda@samsung.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Link: https://lkml.org/lkml/2016/1/7/363
      Link: https://lkml.org/lkml/2016/5/27/486
      Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> # For nvmem part
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      287980e4
  3. 16 5月, 2016 1 次提交
  4. 02 5月, 2016 9 次提交
  5. 29 3月, 2016 1 次提交
    • A
      mmc: sdhci: Fix regression setting power on Trats2 board · 1dceb041
      Adrian Hunter 提交于
      Several commits relating to setting power have been introducing
      problems by putting driver-specific rules into generic SDHCI code.
      
      Krzysztof Kozlowski reported that after commit 918f4cbd ("mmc:
      sdhci: restore behavior when setting VDD via external regulator")
      on Trats2 board there are warnings for invalid VDD  value (2.8V):
      
      [    3.119656] ------------[ cut here ]------------
      [    3.119666] WARNING: CPU: 3 PID: 90 at
      ../drivers/mmc/host/sdhci.c:1234 sdhci_do_set_ios+0x4cc/0x5e0
      [    3.119669] mmc0: Invalid vdd 0x10
      [    3.119673] Modules linked in:
      [    3.119679] CPU: 3 PID: 90 Comm: kworker/3:1 Tainted: G        W
         4.5.0-next-20160324 #23
      [    3.119681] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
      [    3.119690] Workqueue: events_freezable mmc_rescan
      [    3.119708] [<c010e0ac>] (unwind_backtrace) from [<c010ae10>]
      (show_stack+0x10/0x14)
      [    3.119719] [<c010ae10>] (show_stack) from [<c0323260>]
      (dump_stack+0x88/0x9c)
      [    3.119728] [<c0323260>] (dump_stack) from [<c011b754>] (__warn+0xe8/0x100)
      [    3.119734] [<c011b754>] (__warn) from [<c011b7a4>]
      (warn_slowpath_fmt+0x38/0x48)
      [    3.119740] [<c011b7a4>] (warn_slowpath_fmt) from [<c0527d28>]
      (sdhci_do_set_ios+0x4cc/0x5e0)
      [    3.119748] [<c0527d28>] (sdhci_do_set_ios) from [<c0528018>]
      (sdhci_runtime_resume_host+0x60/0x114)
      [    3.119758] [<c0528018>] (sdhci_runtime_resume_host) from
      [<c0402570>] (__rpm_callback+0x2c/0x60)
      [    3.119767] [<c0402570>] (__rpm_callback) from [<c04025c4>]
      (rpm_callback+0x20/0x80)
      [    3.119773] [<c04025c4>] (rpm_callback) from [<c04034b8>]
      (rpm_resume+0x36c/0x558)
      [    3.119780] [<c04034b8>] (rpm_resume) from [<c04036f0>]
      (__pm_runtime_resume+0x4c/0x64)
      [    3.119788] [<c04036f0>] (__pm_runtime_resume) from [<c0512728>]
      (__mmc_claim_host+0x170/0x1b0)
      [    3.119795] [<c0512728>] (__mmc_claim_host) from [<c0514e2c>]
      (mmc_rescan+0x54/0x348)
      [    3.119807] [<c0514e2c>] (mmc_rescan) from [<c0130dac>]
      (process_one_work+0x120/0x3f4)
      [    3.119815] [<c0130dac>] (process_one_work) from [<c01310b8>]
      (worker_thread+0x38/0x554)
      [    3.119823] [<c01310b8>] (worker_thread) from [<c01365a4>]
      (kthread+0xdc/0xf4)
      [    3.119831] [<c01365a4>] (kthread) from [<c0107878>]
      (ret_from_fork+0x14/0x3c)
      [    3.119834] ---[ end trace a22d652aa3276886 ]---
      
      Fix by adding a 'set_power' callback and restoring the default
      behaviour prior to commit 918f4cbd ("mmc: sdhci: restore
      behavior when setting VDD via external regulator").  The desired
      behaviour of that commit is gotten by having sdhci-pxav3 provide
      its own set_power callback.
      Reported-by: NKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Link: http://lkml.kernel.org/r/CAJKOXPcGDnPm-Ykh6wHqV1YxfTaov5E8iVqBoBn4OJc7BnhgEQ@mail.gmail.com
      Fixes: 918f4cbd ("mmc: sdhci: restore behavior when setting VDD...)
      Tested-by: NKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Tested-by: NLudovic Desroches <ludovic.desroches@atmel.com>
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: stable@vger.kernel.org # v4.5+
      Reviewed-by: NJisheng Zhang <jszhang@marvell.com>
      Tested-by: NJisheng Zhang <jszhang@marvell.com>
      Tested-by: NJaehoon Chung <jh80.chung@samsung.com>
      Tested-by: NAnand Moon <linux.amoon@gmail.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      1dceb041
  6. 18 3月, 2016 1 次提交
  7. 17 3月, 2016 1 次提交
    • A
      mmc: sdhci: Fix override of timeout clk wrt max_busy_timeout · 99513624
      Adrian Hunter 提交于
      Normally the timeout clock frequency is read from the capabilities
      register.  It is also possible to set the value prior to calling
      sdhci_add_host() in which case that value will override the
      capabilities register value.  However that was being done after
      calculating max_busy_timeout so that max_busy_timeout was being
      calculated using the wrong value of timeout_clk.
      
      Fix that by moving the override before max_busy_timeout is
      calculated.
      
      The result is that the max_busy_timeout and max_discard
      increase for BSW devices so that, for example, the time for
      mkfs.ext4 on a 64GB eMMC drops from about 1 minute 40 seconds
      to about 20 seconds.
      
      Note, in the future, the capabilities setting will be tidied up
      and this override won't be used anymore.  However this fix is
      needed for stable.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: stable@vger.kernel.org # v3.18+
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      99513624
  8. 29 2月, 2016 9 次提交