1. 31 May, 2019 40 commits
    • Lars-Peter Clausen's avatar
      iio: ad_sigma_delta: Properly handle SPI bus locking vs CS assertion · 5e526a75
      Lars-Peter Clausen authored
      [ Upstream commit df1d80ae ]
      
      For devices from the SigmaDelta family we need to keep CS low when doing a
      conversion, since the device will use the MISO line as a interrupt to
      indicate that the conversion is complete.
      
      This is why the driver locks the SPI bus and when the SPI bus is locked
      keeps as long as a conversion is going on. The current implementation gets
      one small detail wrong though. CS is only de-asserted after the SPI bus is
      unlocked. This means it is possible for a different SPI device on the same
      bus to send a message which would be wrongfully be addressed to the
      SigmaDelta device as well. Make sure that the last SPI transfer that is
      done while holding the SPI bus lock de-asserts the CS signal.
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarAlexandru Ardelean <Alexandru.Ardelean@analog.com>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5e526a75
    • Wen Yang's avatar
      drm/pl111: fix possible object reference leak · eaf6e69d
      Wen Yang authored
      [ Upstream commit bc29d3a6 ]
      
      The call to of_find_matching_node_and_match returns a node pointer with
      refcount incremented thus it must be explicitly decremented after the
      last usage.
      
      Detected by coccinelle with the following warnings:
      drivers/gpu/drm/pl111/pl111_versatile.c:333:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function.
      drivers/gpu/drm/pl111/pl111_versatile.c:340:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function.
      drivers/gpu/drm/pl111/pl111_versatile.c:346:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function.
      drivers/gpu/drm/pl111/pl111_versatile.c:354:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function.
      drivers/gpu/drm/pl111/pl111_versatile.c:395:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function.
      drivers/gpu/drm/pl111/pl111_versatile.c:402:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function.
      Signed-off-by: default avatarWen Yang <wen.yang99@zte.com.cn>
      Cc: Eric Anholt <eric@anholt.net> (supporter:DRM DRIVER FOR ARM PL111 CLCD)
      Cc: David Airlie <airlied@linux.ie> (maintainer:DRM DRIVERS)
      Cc: Daniel Vetter <daniel@ffwll.ch> (maintainer:DRM DRIVERS)
      Cc: dri-devel@lists.freedesktop.org (open list:DRM DRIVERS)
      Cc: linux-kernel@vger.kernel.org (open list)
      Signed-off-by: default avatarEric Anholt <eric@anholt.net>
      Link: https://patchwork.freedesktop.org/patch/msgid/1554307455-40361-6-git-send-email-wen.yang99@zte.com.cnSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
      eaf6e69d
    • Ranjani Sridharan's avatar
      ASoC: core: remove link components before cleaning up card resources · 34e3da15
      Ranjani Sridharan authored
      [ Upstream commit f96fb7d1 ]
      
      When the card is registered by the machine driver,
      dai link components are probed after the snd_card is
      created. This is done in snd_soc_bind_card() which calls
      snd_soc_instantiate_card() to first create the snd_card
      and then probes the link components by calling
      soc_probe_link_components(). The snd_card is used by the
      component driver to add the kcontrols associated
      with dapm widgets to the card.
      
      When the machine driver is unregistered, the snd_card
      is freed when the card resources are cleaned up.
      But the snd_card needs to be valid while unloading the
      topology dapm widgets in order to remove the kcontrols
      from the card.
      
      Since, unloading topology is done when the component
      driver is removed, the link components should be removed
      in snd_soc_unbind_card(). This will ensure that the kcontrols
      are removed before the card resources are cleaned up and
      the snd_card itself is freed.
      Signed-off-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      34e3da15
    • Charles Keepax's avatar
      regulator: core: Avoid potential deadlock on regulator_unregister · 18127d11
      Charles Keepax authored
      [ Upstream commit 06377301 ]
      
      Lockdep reports the following issue on my setup:
      
      Possible unsafe locking scenario:
      
      CPU0                    CPU1
      ----                    ----
      lock((work_completion)(&(&rdev->disable_work)->work));
                              lock(regulator_list_mutex);
                              lock((work_completion)(&(&rdev->disable_work)->work));
      lock(regulator_list_mutex);
      
      The problem is that regulator_unregister takes the
      regulator_list_mutex and then calls flush_work on disable_work. But
      regulator_disable_work calls regulator_lock_dependent which will
      also take the regulator_list_mutex. Resulting in a deadlock if the
      flush_work call actually needs to flush the work.
      
      Fix this issue by moving the flush_work outside of the
      regulator_list_mutex. The list mutex is not used to guard the point at
      which the delayed work is queued, so its use adds no additional safety.
      
      Fixes: f8702f9e ("regulator: core: Use ww_mutex for regulators locking")
      Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
      Reviewed-by: default avatarDmitry Osipenko <digetx@gmail.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      18127d11
    • Andrey Smirnov's avatar
      spi: Don't call spi_get_gpio_descs() before device name is set · cf0e0ec1
      Andrey Smirnov authored
      [ Upstream commit 0a919ae4 ]
      
      Move code calling spi_get_gpio_descs() to happen after ctlr->dev's
      name is set in order to have proper GPIO consumer names.
      
      Before:
      
      cat /sys/kernel/debug/gpio
      gpiochip0: GPIOs 0-31, parent: platform/40049000.gpio, vf610-gpio:
       gpio-6   (                    |regulator-usb0-vbus ) out lo
      
      gpiochip1: GPIOs 32-63, parent: platform/4004a000.gpio, vf610-gpio:
       gpio-36  (                    |scl                 ) in  hi
       gpio-37  (                    |sda                 ) in  hi
       gpio-40  (                    |(null) CS1          ) out lo
       gpio-41  (                    |(null) CS0          ) out lo ACTIVE LOW
       gpio-42  (                    |miso                ) in  hi
       gpio-43  (                    |mosi                ) in  lo
       gpio-44  (                    |sck                 ) out lo
      
      After:
      
      cat /sys/kernel/debug/gpio
      gpiochip0: GPIOs 0-31, parent: platform/40049000.gpio, vf610-gpio:
       gpio-6   (                    |regulator-usb0-vbus ) out lo
      
      gpiochip1: GPIOs 32-63, parent: platform/4004a000.gpio, vf610-gpio:
       gpio-36  (                    |scl                 ) in  hi
       gpio-37  (                    |sda                 ) in  hi
       gpio-40  (                    |spi0 CS1            ) out lo
       gpio-41  (                    |spi0 CS0            ) out lo ACTIVE LOW
       gpio-42  (                    |miso                ) in  hi
       gpio-43  (                    |mosi                ) in  lo
       gpio-44  (                    |sck                 ) out lo
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Cc: Mark Brown <broonie@kernel.org>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: linux-spi@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cf0e0ec1
    • Kees Cook's avatar
      x86/build: Keep local relocations with ld.lld · 5fa810fc
      Kees Cook authored
      [ Upstream commit 7c21383f ]
      
      The LLVM linker (ld.lld) defaults to removing local relocations, which
      causes KASLR boot failures. ld.bfd and ld.gold already handle this
      correctly. This adds the explicit instruction "--discard-none" during
      the link phase. There is no change in output for ld.bfd and ld.gold,
      but ld.lld now produces an image with all the needed relocations.
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: clang-built-linux@googlegroups.com
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20190404214027.GA7324@beast
      Link: https://github.com/ClangBuiltLinux/linux/issues/404Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5fa810fc
    • Alexei Starovoitov's avatar
      samples/bpf: fix build with new clang · 10a8c316
      Alexei Starovoitov authored
      [ Upstream commit 636e78b1 ]
      
      clang started to error on invalid asm clobber usage in x86 headers
      and many bpf program samples failed to build with the message:
      
        CLANG-bpf  /data/users/ast/bpf-next/samples/bpf/xdp_redirect_kern.o
      In file included from /data/users/ast/bpf-next/samples/bpf/xdp_redirect_kern.c:14:
      In file included from ../include/linux/in.h:23:
      In file included from ../include/uapi/linux/in.h:24:
      In file included from ../include/linux/socket.h:8:
      In file included from ../include/linux/uio.h:14:
      In file included from ../include/crypto/hash.h:16:
      In file included from ../include/linux/crypto.h:26:
      In file included from ../include/linux/uaccess.h:5:
      In file included from ../include/linux/sched.h:15:
      In file included from ../include/linux/sem.h:5:
      In file included from ../include/uapi/linux/sem.h:5:
      In file included from ../include/linux/ipc.h:9:
      In file included from ../include/linux/refcount.h:72:
      ../arch/x86/include/asm/refcount.h:72:36: error: asm-specifier for input or output variable conflicts with asm clobber list
                                               r->refs.counter, e, "er", i, "cx");
                                                                            ^
      ../arch/x86/include/asm/refcount.h:86:27: error: asm-specifier for input or output variable conflicts with asm clobber list
                                               r->refs.counter, e, "cx");
                                                                   ^
      2 errors generated.
      
      Override volatile() to workaround the problem.
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      10a8c316
    • Oded Gabbay's avatar
      habanalabs: all FD must be closed before removing device · f1d84fe4
      Oded Gabbay authored
      [ Upstream commit caa3c8e5 ]
      
      This patch fixes a bug in the implementation of the function that removes
      the device.
      
      The bug can happen when the device is removed but not the driver itself
      (e.g. remove by the OS due to PCI freeze in Power architecture).
      
      In that case, there maybe open users that are calling IOCTLs while the
      device is removed. This is a possible race condition that the driver must
      handle. Otherwise, a kernel panic may occur.
      
      This race is prevented in the hard-reset flow, because the driver makes
      sure the users are closed before continuing with the hard-reset. This
      race can not occur when the driver itself is removed because the OS makes
      sure all the file descriptors are closed.
      
      The fix is to make sure the open users close their file descriptors and if
      they don't (after a certain amount of time), the driver sends them a
      SIGKILL, because the remove of the device can't be stopped.
      
      The patch re-uses the same code that is called from the hard-reset flow.
      Signed-off-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f1d84fe4
    • Oded Gabbay's avatar
      habanalabs: prevent device PTE read/write during hard-reset · 7de03fc0
      Oded Gabbay authored
      [ Upstream commit 9f201aba ]
      
      During hard-reset, contexts are closed as part of the tear-down process.
      After a context is closed, the driver cleans up the page tables of that
      context in the device's DRAM. This action is both dangerous and
      unnecessary.
      
      It is unnecessary, because the device is going through a hard-reset, which
      means the device's DRAM contents are no longer valid and the device's MMU
      is being reset.
      
      It is dangerous, because if the hard-reset came as a result of a PCI
      freeze, this action may cause the entire host machine to hang.
      
      Therefore, prevent all device PTE updates when a hard-reset operation is
      pending.
      Signed-off-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7de03fc0
    • David Kozub's avatar
      block: sed-opal: fix IOC_OPAL_ENABLE_DISABLE_MBR · 7c1c65c5
      David Kozub authored
      [ Upstream commit 78bf4735 ]
      
      The implementation of IOC_OPAL_ENABLE_DISABLE_MBR handled the value
      opal_mbr_data.enable_disable incorrectly: enable_disable is expected
      to be one of OPAL_MBR_ENABLE(0) or OPAL_MBR_DISABLE(1). enable_disable
      was passed directly to set_mbr_done and set_mbr_enable_disable where
      is was interpreted as either OPAL_TRUE(1) or OPAL_FALSE(0). The end
      result was that calling IOC_OPAL_ENABLE_DISABLE_MBR with OPAL_MBR_ENABLE
      actually disabled the shadow MBR and vice versa.
      
      This patch adds correct conversion from OPAL_MBR_DISABLE/ENABLE to
      OPAL_FALSE/TRUE. The change affects existing programs using
      IOC_OPAL_ENABLE_DISABLE_MBR but this is typically used only once when
      setting up an Opal drive.
      Acked-by: default avatarJon Derrick <jonathan.derrick@intel.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarScott Bauer <sbauer@plzdonthack.me>
      Signed-off-by: default avatarDavid Kozub <zub@linux.fjfi.cvut.cz>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7c1c65c5
    • Wen Yang's avatar
      cpufreq: ap806: fix possible object reference leak · 91efbd9d
      Wen Yang authored
      [ Upstream commit b623fa32 ]
      
      The call to of_find_compatible_node returns a node pointer with refcount
      incremented thus it must be explicitly decremented after the last
      usage.
      
      Detected by coccinelle with the following warnings:
      ./drivers/cpufreq/armada-8k-cpufreq.c:187:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 130, but without a corresponding object release within this function.
      ./drivers/cpufreq/armada-8k-cpufreq.c:191:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 130, but without a corresponding object release within this function.
      Signed-off-by: default avatarWen Yang <wen.yang99@zte.com.cn>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Andrew Lunn <andrew@lunn.ch>
      Cc: Gregory Clement <gregory.clement@bootlin.com>
      Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Viresh Kumar <viresh.kumar@linaro.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-pm@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      91efbd9d
    • Wen Yang's avatar
      cpufreq: imx6q: fix possible object reference leak · 9e2a8a94
      Wen Yang authored
      [ Upstream commit ddb64c5d ]
      
      The call to of_node_get returns a node pointer with refcount
      incremented thus it must be explicitly decremented after the last
      usage.
      
      Detected by coccinelle with the following warnings:
      ./drivers/cpufreq/imx6q-cpufreq.c:391:4-10: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 348, but without a corresponding object release within this function.
      ./drivers/cpufreq/imx6q-cpufreq.c:395:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 348, but without a corresponding object release within this function.
      Signed-off-by: default avatarWen Yang <wen.yang99@zte.com.cn>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Viresh Kumar <viresh.kumar@linaro.org>
      Cc: Shawn Guo <shawnguo@kernel.org>
      Cc: Sascha Hauer <s.hauer@pengutronix.de>
      Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
      Cc: Fabio Estevam <festevam@gmail.com>
      Cc: NXP Linux Team <linux-imx@nxp.com>
      Cc: linux-pm@vger.kernel.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9e2a8a94
    • Wen Yang's avatar
      cpufreq: kirkwood: fix possible object reference leak · 6446fdec
      Wen Yang authored
      [ Upstream commit 7c468966 ]
      
      The call to of_get_child_by_name returns a node pointer with refcount
      incremented thus it must be explicitly decremented after the last
      usage.
      
      Detected by coccinelle with the following warnings:
      ./drivers/cpufreq/kirkwood-cpufreq.c:127:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 118, but without a corresponding object release within this function.
      ./drivers/cpufreq/kirkwood-cpufreq.c:133:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 118, but without a corresponding object release within this function.
      
      and also do some cleanup:
      - of_node_put(np);
      - np = NULL;
      ...
      of_node_put(np);
      Signed-off-by: default avatarWen Yang <wen.yang99@zte.com.cn>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Viresh Kumar <viresh.kumar@linaro.org>
      Cc: linux-pm@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6446fdec
    • Wen Yang's avatar
      cpufreq: pmac32: fix possible object reference leak · e84c252b
      Wen Yang authored
      [ Upstream commit 8d10dc28 ]
      
      The call to of_find_node_by_name returns a node pointer with refcount
      incremented thus it must be explicitly decremented after the last
      usage.
      
      Detected by coccinelle with the following warnings:
      ./drivers/cpufreq/pmac32-cpufreq.c:557:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 552, but without a corresponding object release within this function.
      ./drivers/cpufreq/pmac32-cpufreq.c:569:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 552, but without a corresponding object release within this function.
      ./drivers/cpufreq/pmac32-cpufreq.c:598:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 587, but without a corresponding object release within this function.
      Signed-off-by: default avatarWen Yang <wen.yang99@zte.com.cn>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Viresh Kumar <viresh.kumar@linaro.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: linux-pm@vger.kernel.org
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e84c252b
    • Wen Yang's avatar
      cpufreq/pasemi: fix possible object reference leak · 37792ced
      Wen Yang authored
      [ Upstream commit a9acc26b ]
      
      The call to of_get_cpu_node returns a node pointer with refcount
      incremented thus it must be explicitly decremented after the last
      usage.
      
      Detected by coccinelle with the following warnings:
      ./drivers/cpufreq/pasemi-cpufreq.c:212:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 147, but without a corresponding object release within this function.
      ./drivers/cpufreq/pasemi-cpufreq.c:220:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 147, but without a corresponding object release within this function.
      Signed-off-by: default avatarWen Yang <wen.yang99@zte.com.cn>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Viresh Kumar <viresh.kumar@linaro.org>
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: linux-pm@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      37792ced
    • Wen Yang's avatar
      cpufreq: ppc_cbe: fix possible object reference leak · d1f82d91
      Wen Yang authored
      [ Upstream commit 23329803 ]
      
      The call to of_get_cpu_node returns a node pointer with refcount
      incremented thus it must be explicitly decremented after the last
      usage.
      
      Detected by coccinelle with the following warnings:
      ./drivers/cpufreq/ppc_cbe_cpufreq.c:89:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 76, but without a corresponding object release within this function.
      ./drivers/cpufreq/ppc_cbe_cpufreq.c:89:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 76, but without a corresponding object release within this function.
      Signed-off-by: default avatarWen Yang <wen.yang99@zte.com.cn>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Viresh Kumar <viresh.kumar@linaro.org>
      Cc: linux-pm@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d1f82d91
    • Huazhong Tan's avatar
      net: hns3: add error handler for initializing command queue · bbc8d4d4
      Huazhong Tan authored
      [ Upstream commit 4339ef39 ]
      
      This patch adds error handler for the failure of command queue
      initialization both PF and VF.
      Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bbc8d4d4
    • Kristian Evensen's avatar
      qmi_wwan: Add quirk for Quectel dynamic config · 3063f0f5
      Kristian Evensen authored
      [ Upstream commit e4bf6348 ]
      
      Most, if not all, Quectel devices use dynamic interface numbers, and
      users are able to change the USB configuration at will. Matching on for
      example interface number is therefore not possible.
      
      Instead, the QMI device can be identified by looking at the interface
      class, subclass and protocol (all 0xff), as well as the number of
      endpoints. The reason we need to look at the number of endpoints, is
      that the diagnostic port interface has the same class, subclass and
      protocol as QMI. However, the diagnostic port only has two endpoints,
      while QMI has three.
      
      Until now, we have identified the QMI device by combining a match on
      class, subclass and protocol, with a call to the function
      quectel_diag_detect(). In quectel_diag_detect(), we check if the number
      of endpoints matches for known Quectel vendor/product ids.
      
      Adding new vendor/product ids to quectel_diag_detect() is not a good
      long-term solution. This commit replaces the function with a quirk, and
      applies the quirk to affected Quectel devices that I have been able to
      test the change with (EP06, EM12 and EC25). If the quirk is set and the
      number of endpoints equal two, we return from qmi_wwan_probe() with
      -ENODEV.
      Signed-off-by: default avatarKristian Evensen <kristian.evensen@gmail.com>
      Acked-by: default avatarBjørn Mork <bjorn@mork.no>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3063f0f5
    • Huazhong Tan's avatar
      net: hns3: fix keep_alive_timer not stop problem · e88bd7e3
      Huazhong Tan authored
      [ Upstream commit e233516e ]
      
      When hclgevf_client_start() fails or VF driver unloaded, there is
      nobody to disable keep_alive_timer.
      
      So this patch fixes them.
      
      Fixes: a6d818e3 ("net: hns3: Add vport alive state checking support")
      Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e88bd7e3
    • Roman Gushchin's avatar
      selftests: cgroup: fix cleanup path in test_memcg_subtree_control() · 930d69e9
      Roman Gushchin authored
      [ Upstream commit e14d314c ]
      
      Dan reported, that cleanup path in test_memcg_subtree_control()
      triggers a static checker warning:
        ./tools/testing/selftests/cgroup/test_memcontrol.c:76 \
        test_memcg_subtree_control()
        error: uninitialized symbol 'child2'.
      
      Fix this by initializing child2 and parent2 variables and
      split the cleanup path into few stages.
      Signed-off-by: default avatarRoman Gushchin <guro@fb.com>
      Fixes: 84092dbc ("selftests: cgroup: add memory controller self-tests")
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Cc: Dan Carpenter <dan.carpenter@oracle.com>
      Cc: Shuah Khan (Samsung OSG) <shuah@kernel.org>
      Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
      Signed-off-by: default avatarShuah Khan <shuah@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      930d69e9
    • Wenjing Liu's avatar
      drm/amd/display: use proper formula to calculate bandwidth from timing · ccbab981
      Wenjing Liu authored
      [ Upstream commit e49f6936 ]
      
      [why]
      The existing calculation uses a wrong formula to
      calculate bandwidth from timing.
      
      [how]
      Expose the existing proper function that calculates the bandwidth,
      so dc_link can use it to calculate timing bandwidth correctly.
      Signed-off-by: default avatarWenjing Liu <Wenjing.Liu@amd.com>
      Reviewed-by: default avatarJun Lei <Jun.Lei@amd.com>
      Acked-by: default avatarLeo Li <sunpeng.li@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ccbab981
    • Arnd Bergmann's avatar
      s390: cio: fix cio_irb declaration · bb7401e7
      Arnd Bergmann authored
      [ Upstream commit e91012ee ]
      
      clang points out that the declaration of cio_irb does not match the
      definition exactly, it is missing the alignment attribute:
      
      ../drivers/s390/cio/cio.c:50:1: warning: section does not match previous declaration [-Wsection]
      DEFINE_PER_CPU_ALIGNED(struct irb, cio_irb);
      ^
      ../include/linux/percpu-defs.h:150:2: note: expanded from macro 'DEFINE_PER_CPU_ALIGNED'
              DEFINE_PER_CPU_SECTION(type, name, PER_CPU_ALIGNED_SECTION)     \
              ^
      ../include/linux/percpu-defs.h:93:9: note: expanded from macro 'DEFINE_PER_CPU_SECTION'
              extern __PCPU_ATTRS(sec) __typeof__(type) name;                 \
                     ^
      ../include/linux/percpu-defs.h:49:26: note: expanded from macro '__PCPU_ATTRS'
              __percpu __attribute__((section(PER_CPU_BASE_SECTION sec)))     \
                                      ^
      ../drivers/s390/cio/cio.h:118:1: note: previous attribute is here
      DECLARE_PER_CPU(struct irb, cio_irb);
      ^
      ../include/linux/percpu-defs.h:111:2: note: expanded from macro 'DECLARE_PER_CPU'
              DECLARE_PER_CPU_SECTION(type, name, "")
              ^
      ../include/linux/percpu-defs.h:87:9: note: expanded from macro 'DECLARE_PER_CPU_SECTION'
              extern __PCPU_ATTRS(sec) __typeof__(type) name
                     ^
      ../include/linux/percpu-defs.h:49:26: note: expanded from macro '__PCPU_ATTRS'
              __percpu __attribute__((section(PER_CPU_BASE_SECTION sec)))     \
                                      ^
      Use DECLARE_PER_CPU_ALIGNED() here, to make the two match.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarSebastian Ott <sebott@linux.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bb7401e7
    • Thomas Huth's avatar
      s390/mm: silence compiler warning when compiling without CONFIG_PGSTE · a5615d32
      Thomas Huth authored
      [ Upstream commit 81a8f2be ]
      
      If CONFIG_PGSTE is not set (e.g. when compiling without KVM), GCC complains:
      
        CC      arch/s390/mm/pgtable.o
      arch/s390/mm/pgtable.c:413:15: warning: ‘pmd_alloc_map’ defined but not
       used [-Wunused-function]
       static pmd_t *pmd_alloc_map(struct mm_struct *mm, unsigned long addr)
                     ^~~~~~~~~~~~~
      
      Wrap the function with "#ifdef CONFIG_PGSTE" to silence the warning.
      Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a5615d32
    • Nicholas Kazlauskas's avatar
      drm/amd/display: Initialize stream_update with memset · 28968ec7
      Nicholas Kazlauskas authored
      [ Upstream commit 2aa632c5 ]
      
      The brace initialization used here generates warnings on some
      compilers. For example, on GCC 4.9:
      
      [...] In function ‘dm_determine_update_type_for_commit’:
      [...] error: missing braces around initializer [-Werror=missing-braces]
         struct dc_stream_update stream_update = { 0 };
                ^
      
      Use memset to make this more portable.
      
      v2: Specify the compiler / diagnostic in the commit message (Paul)
      
      Cc: Sun peng Li <Sunpeng.Li@amd.com>
      Cc: Harry Wentland <Harry.Wentland@amd.com>
      Signed-off-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
      Reviewed-by: default avatarLeo Li <sunpeng.li@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      28968ec7
    • Borislav Petkov's avatar
      x86/microcode: Fix the ancient deprecated microcode loading method · 82222b96
      Borislav Petkov authored
      [ Upstream commit 24613a04 ]
      
      Commit
      
        2613f36e ("x86/microcode: Attempt late loading only when new microcode is present")
      
      added the new define UCODE_NEW to denote that an update should happen
      only when newer microcode (than installed on the system) has been found.
      
      But it missed adjusting that for the old /dev/cpu/microcode loading
      interface. Fix it.
      
      Fixes: 2613f36e ("x86/microcode: Attempt late loading only when new microcode is present")
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Jann Horn <jannh@google.com>
      Link: https://lkml.kernel.org/r/20190405133010.24249-3-bp@alien8.deSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
      82222b96
    • Arnd Bergmann's avatar
      s390: zcrypt: initialize variables before_use · 73205be1
      Arnd Bergmann authored
      [ Upstream commit 913140e2 ]
      
      The 'func_code' variable gets printed in debug statements without
      a prior initialization in multiple functions, as reported when building
      with clang:
      
      drivers/s390/crypto/zcrypt_api.c:659:6: warning: variable 'func_code' is used uninitialized whenever 'if' condition is true
            [-Wsometimes-uninitialized]
              if (mex->outputdatalength < mex->inputdatalength) {
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/s390/crypto/zcrypt_api.c:725:29: note: uninitialized use occurs here
              trace_s390_zcrypt_rep(mex, func_code, rc,
                                         ^~~~~~~~~
      drivers/s390/crypto/zcrypt_api.c:659:2: note: remove the 'if' if its condition is always false
              if (mex->outputdatalength < mex->inputdatalength) {
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/s390/crypto/zcrypt_api.c:654:24: note: initialize the variable 'func_code' to silence this warning
              unsigned int func_code;
                                    ^
      
      Add initializations to all affected code paths to shut up the warning
      and make the warning output consistent.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      73205be1
    • Michael Tretter's avatar
      clk: zynqmp: fix check for fractional clock · d1058b17
      Michael Tretter authored
      [ Upstream commit c06e6440 ]
      
      The firmware sets BIT(13) in clkflag to mark a divider as fractional
      divider. The clock driver copies the clkflag straight to the flags of
      the common clock framework. In the common clk framework flags, BIT(13)
      is defined as CLK_DUTY_CYCLE_PARENT.
      
      Add a new field to the zynqmp_clk_divider to specify if a divider is a
      fractional devider. Set this field based on the clkflag when registering
      a divider.
      
      At the same time, unset BIT(13) from clkflag when copying the flags to
      the common clk framework flags.
      Signed-off-by: default avatarMichael Tretter <m.tretter@pengutronix.de>
      Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d1058b17
    • Douglas Anderson's avatar
      clk: rockchip: Make rkpwm a critical clock on rk3288 · 4296aca9
      Douglas Anderson authored
      [ Upstream commit dfe7fb21 ]
      
      Most rk3288-based boards are derived from the EVB and thus use a PWM
      regulator for the logic rail.  However, most rk3288-based boards don't
      specify the PWM regulator in their device tree.  We'll deal with that
      by making it critical.
      
      NOTE: it's important to make it critical and not just IGNORE_UNUSED
      because all PWMs in the system share the same clock.  We don't want
      another PWM user to turn the clock on and off and kill the logic rail.
      
      This change is in preparation for actually having the PWMs in the
      rk3288 device tree actually point to the proper PWM clock.  Up until
      now they've all pointed to the clock for the old IP block and they've
      all worked due to the fact that rkpwm was IGNORE_UNUSED and that the
      clock rates for both clocks were the same.
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4296aca9
    • Charles Keepax's avatar
      extcon: arizona: Disable mic detect if running when driver is removed · 95c559cb
      Charles Keepax authored
      [ Upstream commit 00053de5 ]
      
      Microphone detection provides the button detection features on the
      Arizona CODECs as such it will be running if the jack is currently
      inserted. If the driver is unbound whilst the jack is still inserted
      this will cause warnings from the regulator framework as the MICVDD
      regulator is put but was never disabled.
      
      Correct this by disabling microphone detection on driver removal and if
      the microphone detection was running disable the regulator and put the
      runtime reference that was currently held.
      Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
      Signed-off-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      95c559cb
    • Douglas Anderson's avatar
      clk: rockchip: Fix video codec clocks on rk3288 · 038c427d
      Douglas Anderson authored
      [ Upstream commit 00c0cd9e ]
      
      It appears that there is a typo in the rk3288 TRM.  For
      GRF_SOC_CON0[7] it says that 0 means "vepu" and 1 means "vdpu".  It's
      the other way around.
      
      How do I know?  Here's my evidence:
      
      1. Prior to commit 4d3e84f9 ("clk: rockchip: describe aclk_vcodec
         using the new muxgrf type on rk3288") we always pretended that we
         were using "aclk_vdpu" and the comment in the code said that this
         matched the default setting in the system.  In fact the default
         setting is 0 according to the TRM and according to reading memory
         at bootup.  In addition rk3288-based Chromebooks ran like this and
         the video codecs worked.
      2. With the existing clock code if you boot up and try to enable the
         new VIDEO_ROCKCHIP_VPU as a module (and without "clk_ignore_unused"
         on the command line), you get errors like "failed to get ack on
         domain 'pd_video', val=0x80208".  After flipping vepu/vdpu things
         init OK.
      3. If I export and add both the vepu and vdpu to the list of clocks
         for RK3288_PD_VIDEO I can get past the power domain errors, but now
         I freeze when the vpu_mmu gets initted.
      4. If I just mark the "vdpu" as IGNORE_UNUSED then everything boots up
         and probes OK showing that somehow the "vdpu" was important to keep
         enabled.  This is because we were actually using it as a parent.
      5. After this change I can hack "aclk_vcodec_pre" to parent from
         "aclk_vepu" using assigned-clocks and the video codec still probes
         OK.
      6. Rockchip has said so on the mailing list [1].
      
      ...so let's fix it.
      
      Let's also add CLK_SET_RATE_PARENT to "aclk_vcodec_pre" as suggested
      by Jonas Karlman.  Prior to the same commit you could do
      clk_set_rate() on "aclk_vcodec" and it would change "aclk_vdpu".
      That's because "aclk_vcodec" was a simple gate clock (always gets
      CLK_SET_RATE_PARENT) and its direct parent was "aclk_vdpu".  After
      that commit "aclk_vcodec_pre" gets in the way so we need to add
      CLK_SET_RATE_PARENT to it too.
      
      [1] https://lkml.kernel.org/r/1d17b015-9e17-34b9-baf8-c285dc1957aa@rock-chips.com
      
      Fixes: 4d3e84f9 ("clk: rockchip: describe aclk_vcodec using the new muxgrf type on rk3288")
      Suggested-by: default avatarJonas Karlman <jonas@kwiboo.se>
      Suggested-by: default avatarRandy Li <ayaka@soulik.info>
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      038c427d
    • Ulf Hansson's avatar
      PM / core: Propagate dev->power.wakeup_path when no callbacks · fdb3ecd0
      Ulf Hansson authored
      [ Upstream commit dc351d4c ]
      
      The dev->power.direct_complete flag may become set in device_prepare() in
      case the device don't have any PM callbacks (dev->power.no_pm_callbacks is
      set). This leads to a broken behaviour, when there is child having wakeup
      enabled and relies on its parent to be used in the wakeup path.
      
      More precisely, when the direct complete path becomes selected for the
      child in __device_suspend(), the propagation of the dev->power.wakeup_path
      becomes skipped as well.
      
      Let's address this problem, by checking if the device is a part the wakeup
      path or has wakeup enabled, then prevent the direct complete path from
      being used.
      Reported-by: default avatarLoic Pallardy <loic.pallardy@st.com>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      [ rjw: Comment cleanup ]
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fdb3ecd0
    • Christian König's avatar
      drm/amdgpu: fix old fence check in amdgpu_fence_emit · 5344c9ef
      Christian König authored
      [ Upstream commit 3d2aca8c ]
      
      We don't hold a reference to the old fence, so it can go away
      any time we are waiting for it to signal.
      Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
      Reviewed-by: default avatarChunming Zhou <david1.zhou@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5344c9ef
    • Peng Li's avatar
      net: hns3: free the pending skb when clean RX ring · 8b4ad8fb
      Peng Li authored
      [ Upstream commit cc5ff6e9 ]
      
      If there is pending skb in RX flow when close the port, and the
      pending buffer is not cleaned, the new packet will be added to
      the pending skb when the port opens again, and the first new
      packet has error data.
      
      This patch cleans the pending skb when clean RX ring.
      Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
      Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8b4ad8fb
    • Yinbo Zhu's avatar
      mmc: sdhci-of-esdhc: add erratum eSDHC-A001 and A-008358 support · 71fb483c
      Yinbo Zhu authored
      [ Upstream commit 05cb6b2a ]
      
      eSDHC-A001: The data timeout counter (SYSCTL[DTOCV]) is not
      reliable for DTOCV values 0x4(2^17 SD clock), 0x8(2^21 SD clock),
      and 0xC(2^25 SD clock). The data timeout counter can count from
      2^13–2^27, but for values 2^17, 2^21, and 2^25, the timeout
      counter counts for only 2^13 SD clocks.
      A-008358: The data timeout counter value loaded into the timeout
      counter is less than expected and can result into early timeout
      error in case of eSDHC data transactions. The table below shows
      the expected vs actual timeout period for different values of
      SYSCTL[DTOCV]:
      these two erratum has the same quirk to control it, and set
      SDHCI_QUIRK_RESET_AFTER_REQUEST to fix above issue.
      Signed-off-by: default avatarYinbo Zhu <yinbo.zhu@nxp.com>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      71fb483c
    • Yinbo Zhu's avatar
      mmc: sdhci-of-esdhc: add erratum A-009204 support · 20b0a12e
      Yinbo Zhu authored
      [ Upstream commit 5dd19552 ]
      
      In the event of that any data error (like, IRQSTAT[DCE]) occurs
      during an eSDHC data transaction where DMA is used for data
      transfer to/from the system memory, setting the SYSCTL[RSTD]
      register may cause a system hang. If software sets the register
      SYSCTL[RSTD] to 1 for error recovery while DMA transferring is
      not complete, eSDHC may hang the system bus. This happens because
      the software register SYSCTL[RSTD] resets the DMA engine without
      waiting for the completion of pending system transactions. This
      erratum is to fix this issue.
      Signed-off-by: default avatarYinbo Zhu <yinbo.zhu@nxp.com>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      20b0a12e
    • Yinbo Zhu's avatar
      mmc: sdhci-of-esdhc: add erratum eSDHC5 support · ebe02058
      Yinbo Zhu authored
      [ Upstream commit a46e4271 ]
      
      Software writing to the Transfer Type configuration register
      (system clock domain) can cause a setup/hold violation in the
      CRC flops (card clock domain), which can cause write accesses
      to be sent with corrupt CRC values. This issue occurs only for
      write preceded by read. this erratum is to fix this issue.
      Signed-off-by: default avatarYinbo Zhu <yinbo.zhu@nxp.com>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ebe02058
    • Kangjie Lu's avatar
      mmc_spi: add a status check for spi_sync_locked · dec5d548
      Kangjie Lu authored
      [ Upstream commit 61102598 ]
      
      In case spi_sync_locked fails, the fix reports the error and
      returns the error code upstream.
      Signed-off-by: default avatarKangjie Lu <kjlu@umn.edu>
      Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      dec5d548
    • Andrea Merello's avatar
      mmc: core: make pwrseq_emmc (partially) support sleepy GPIO controllers · 022d0ac1
      Andrea Merello authored
      [ Upstream commit 002ee28e ]
      
      pwrseq_emmc.c implements a HW reset procedure for eMMC chip by driving a
      GPIO line.
      
      It registers the .reset() cb on mmc_pwrseq_ops and it registers a system
      restart notification handler; both of them perform reset by unconditionally
      calling gpiod_set_value().
      
      If the eMMC reset line is tied to a GPIO controller whose driver can sleep
      (i.e. I2C GPIO controller), then the kernel would spit warnings when trying
      to reset the eMMC chip by means of .reset() mmc_pwrseq_ops cb (that is
      exactly what I'm seeing during boot).
      
      Furthermore, on system reset we would gets to the system restart
      notification handler with disabled interrupts - local_irq_disable() is
      called in machine_restart() at least on ARM/ARM64 - and we would be in
      trouble when the GPIO driver tries to sleep (which indeed doesn't happen
      here, likely because in my case the machine specific code doesn't call
      do_kernel_restart(), I guess..).
      
      This patch fixes the .reset() cb to make use of gpiod_set_value_cansleep(),
      so that the eMMC gets reset on boot without complaints, while, since there
      isn't that much we can do, we avoid register the restart handler if the
      GPIO controller has a sleepy driver (and we spit a dev_notice() message to
      let people know)..
      
      This had been tested on a downstream 4.9 kernel with backported
      commit 83f37ee7ba33 ("mmc: pwrseq: Add reset callback to the struct
      mmc_pwrseq_ops") and commit ae60fb031cf2 ("mmc: core: Don't do eMMC HW
      reset when resuming the eMMC card"), because I couldn't boot my board
      otherwise. Maybe worth to RFT.
      Signed-off-by: default avatarAndrea Merello <andrea.merello@gmail.com>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      022d0ac1
    • John Garry's avatar
      scsi: libsas: Do discovery on empty PHY to update PHY info · 43a25a4a
      John Garry authored
      [ Upstream commit d8649fc1 ]
      
      When we discover the PHY is empty in sas_rediscover_dev(), the PHY
      information (like negotiated linkrate) is not updated.
      
      As such, for a user examining sysfs for that PHY, they would see
      incorrect values:
      
      root@(none)$ cd /sys/class/sas_phy/phy-0:0:20
      root@(none)$ more negotiated_linkrate
      3.0 Gbit
      root@(none)$ echo 0 > enable
      root@(none)$ more negotiated_linkrate
      3.0 Gbit
      
      So fix this, simply discover the PHY again, even though we know it's empty;
      in the above example, this gives us:
      
      root@(none)$ more negotiated_linkrate
      Phy disabled
      
      We must do this after unregistering the device associated with the PHY
      (in sas_unregister_devs_sas_addr()).
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      43a25a4a
    • Guenter Roeck's avatar
      hwmon: (f71805f) Use request_muxed_region for Super-IO accesses · e363683d
      Guenter Roeck authored
      [ Upstream commit 73e6ff71 ]
      
      Super-IO accesses may fail on a system with no or unmapped LPC bus.
      
      Unable to handle kernel paging request at virtual address ffffffbffee0002e
      pgd = ffffffc1d68d4000
      [ffffffbffee0002e] *pgd=0000000000000000, *pud=0000000000000000
      Internal error: Oops: 94000046 [#1] PREEMPT SMP
      Modules linked in: f71805f(+) hwmon
      CPU: 3 PID: 1659 Comm: insmod Not tainted 4.5.0+ #88
      Hardware name: linux,dummy-virt (DT)
      task: ffffffc1f6665400 ti: ffffffc1d6418000 task.ti: ffffffc1d6418000
      PC is at f71805f_find+0x6c/0x358 [f71805f]
      
      Also, other drivers may attempt to access the LPC bus at the same time,
      resulting in undefined behavior.
      
      Use request_muxed_region() to ensure that IO access on the requested
      address space is supported, and to ensure that access by multiple
      drivers is synchronized.
      
      Fixes: e53004e2 ("hwmon: New f71805f driver")
      Reported-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
      Reported-by: default avatarJohn Garry <john.garry@huawei.com>
      Cc: John Garry <john.garry@huawei.com>
      Acked-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e363683d