summaryrefslogtreecommitdiff
path: root/drivers/hwspinlock
AgeCommit message (Collapse)AuthorFilesLines
2024-03-06hwspinlock: omap: Use index to get hwspinlock pointerAndrew Davis1-3/+2
For loops with multiple initializers and increments are hard to read and reason about, simplify this by using the looping index to index into the hwspinlock array. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240208165114.63148-4-afd@ti.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2024-03-06hwspinlock: omap: Use devm_hwspin_lock_register() helperAndrew Davis1-16/+1
This will unregister the HW spinlock on module exit automatically for us, currently we manually unregister which can be error-prone if not done in the right order. This also allows us to remove the remove callback. Do that here. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240208165114.63148-3-afd@ti.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2024-03-06hwspinlock: omap: Use devm_pm_runtime_enable() helperAndrew Davis1-25/+8
This disables runtime PM on module exit automatically for us, currently we manually disable runtime PM which can be error-prone if not done in the right order or missed in some exit path. This also allows us to simplify the probe exit path and remove callbacks. Do that here. While here, as we can now return right after registering our hwspinlock, simply return directly and remove the extra debug message. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240208165114.63148-2-afd@ti.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2024-03-06hwspinlock: omap: Remove unneeded check for OF nodeAndrew Davis1-4/+0
We do not use the OF node anymore, nor does it matter how we got to probe, so remove the check for of_node. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240208165114.63148-1-afd@ti.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2023-12-08hwspinlock/core: fix kernel-doc warningsRandy Dunlap1-24/+29
Correct function comments to prevent kernel-doc warnings found when using "W=1". hwspinlock_core.c:208: warning: Excess function parameter 'timeout' description in '__hwspin_lock_timeout' hwspinlock_core.c:318: warning: Excess function parameter 'bank' description in 'of_hwspin_lock_simple_xlate' hwspinlock_core.c:647: warning: Function parameter or member 'hwlock' not described in '__hwspin_lock_request' and 17 warnings like: hwspinlock_core.c:487: warning: No description found for return value of 'hwspin_lock_register' Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Cc: Ohad Ben-Cohen <ohad@wizery.com> Cc: Bjorn Andersson <andersson@kernel.org> Cc: Baolin Wang <baolin.wang7@gmail.com> Cc: linux-remoteproc@vger.kernel.org Link: https://lore.kernel.org/r/20231206055439.671-1-rdunlap@infradead.org Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2023-12-08hwspinlock: qcom: Remove IPQ6018 SOC specific compatibleVignesh Viswanathan1-1/+0
IPQ6018 has 32 tcsr_mutex hwlock registers with stride 0x1000. The compatible string qcom,ipq6018-tcsr-mutex is mapped to of_msm8226_tcsr_mutex which has 32 locks configured with stride of 0x80 and doesn't match the HW present in IPQ6018. Remove IPQ6018 specific compatible string so that it fallsback to of_tcsr_mutex data which maps to the correct configuration for IPQ6018. Fixes: 5d4753f741d8 ("hwspinlock: qcom: add support for MMIO on older SoCs") Signed-off-by: Vignesh Viswanathan <quic_viswanat@quicinc.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://lore.kernel.org/r/20230905095535.1263113-3-quic_viswanat@quicinc.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2023-07-17hwspinlock: qcom: add missing regmap config for SFPB MMIO implementationChristian Marangi1-0/+9
Commit 5d4753f741d8 ("hwspinlock: qcom: add support for MMIO on older SoCs") introduced and made regmap_config mandatory in the of_data struct but didn't add the regmap_config for sfpb based devices. SFPB based devices can both use the legacy syscon way to probe or the new MMIO way and currently device that use the MMIO way are broken as they lack the definition of the now required regmap_config and always return -EINVAL (and indirectly makes fail probing everything that depends on it, smem, nandc with smem-parser...) Fix this by correctly adding the missing regmap_config and restore function of hwspinlock on SFPB based devices with MMIO implementation. Cc: stable@vger.kernel.org Fixes: 5d4753f741d8 ("hwspinlock: qcom: add support for MMIO on older SoCs") Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> Link: https://lore.kernel.org/r/20230716022804.21239-1-ansuelsmth@gmail.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2023-07-15hwspinlock: u8500: Convert to platform remove callback returning voidUwe Kleine-König1-4/+2
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Baolin Wang <baolin.wang@linux.alibaba.com> Link: https://lore.kernel.org/r/20230314180241.2865888-1-u.kleine-koenig@pengutronix.de Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2023-07-15hwspinlock: omap: Convert to platform remove callback returning voidUwe Kleine-König1-5/+3
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Baolin Wang <baolin.wang@linux.alibaba.com> Link: https://lore.kernel.org/r/20230314180100.2865801-2-u.kleine-koenig@pengutronix.de Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2023-07-15hwspinlock: omap: Emit only one error message for errors in .remove()Uwe Kleine-König1-1/+1
If a remove callback of a platform driver returns a non-zero value, the driver core emits an error message, otherwise ignores the value and completes unbinding the device. As omap_hwspinlock_remove() already emits an error message, suppress the core's error message by returning zero. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Baolin Wang <baolin.wang@linux.alibaba.com> Link: https://lore.kernel.org/r/20230314180100.2865801-1-u.kleine-koenig@pengutronix.de Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2023-07-15hwspinlock: add a check of devm_regmap_field_alloc in qcom_hwspinlock_probeKang Chen1-0/+2
devm_regmap_field_alloc may fails, priv field might be error pointer and cause illegal address access later. Signed-off-by: Kang Chen <void0red@gmail.com> Link: https://lore.kernel.org/r/20230227004116.1273988-1-void0red@gmail.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2023-06-14hwspinlock: omap: drop of_match_ptr for ID tableKrzysztof Kozlowski1-1/+1
The driver can match only via the DT table so the table should be always used and the of_match_ptr does not have any sense (this also allows ACPI matching via PRP0001, even though it might not be relevant here). drivers/hwspinlock/omap_hwspinlock.c:164:34: error: ‘omap_hwspinlock_of_match’ defined but not used [-Werror=unused-const-variable=] Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Bjorn Andersson <andersson@kernel.org> Link: https://lore.kernel.org/r/20230512164520.212312-1-krzysztof.kozlowski@linaro.org
2023-04-13hwspinlock: remove MODULE_LICENSE in non-modulesNick Alcock1-1/+0
Since commit 8b41fc4454e ("kbuild: create modules.builtin without Makefile.modbuiltin or tristate.conf"), MODULE_LICENSE declarations are used to identify modules. As a consequence, uses of the macro in non-modules will cause modprobe to misidentify their containing object file as a module when it is not (false positives), and modprobe might succeed rather than failing with a suitable error message. So remove it in the files in this commit, none of which can be built as modules. Signed-off-by: Nick Alcock <nick.alcock@oracle.com> Suggested-by: Luis Chamberlain <mcgrof@kernel.org> Cc: Luis Chamberlain <mcgrof@kernel.org> Cc: linux-modules@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: Hitomi Hasegawa <hasegawa-hitomi@fujitsu.com> Cc: Ohad Ben-Cohen <ohad@wizery.com> Cc: Bjorn Andersson <andersson@kernel.org> Cc: linux-remoteproc@vger.kernel.org Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
2022-12-28hwspinlock: Use device_match_of_node()ye xingchen1-1/+1
Replace the open-code with device_match_of_node(). Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com> Signed-off-by: Bjorn Andersson <andersson@kernel.org> Link: https://lore.kernel.org/r/202211251544369078587@zte.com.cn
2022-09-14hwspinlock: qcom: add support for MMIO on older SoCsKrzysztof Kozlowski1-10/+32
Older Qualcomm SoCs have TCSR mutex registers with 0x80 stride, instead of 0x1000. Add dedicated compatibles and regmap for such case. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Bjorn Andersson <andersson@kernel.org> Link: https://lore.kernel.org/r/20220909092035.223915-5-krzysztof.kozlowski@linaro.org
2022-09-14hwspinlock: qcom: correct MMIO max register for newer SoCsKrzysztof Kozlowski1-1/+1
Newer ARMv8 Qualcomm SoCs using 0x1000 register stride have maximum register 0x20000 (32 mutexes * 0x1000). Fixes: 7a1e6fb1c606 ("hwspinlock: qcom: Allow mmio usage in addition to syscon") Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Konrad Dybcio <konrad.dybcio@somainline.org> Signed-off-by: Bjorn Andersson <andersson@kernel.org> Link: https://lore.kernel.org/r/20220909092035.223915-4-krzysztof.kozlowski@linaro.org
2022-07-17hwspinlock: qcom: Add support for mmio usage to sfpb-mutexChristian Marangi1-5/+23
Allow sfpb-mutex to use mmio in addition to syscon. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220707102040.1859-1-ansuelsmth@gmail.com
2022-04-23hwspinlock: using pm_runtime_resume_and_get instead of pm_runtime_get_syncMinghao Chi1-4/+2
Using pm_runtime_resume_and_get is more appropriate for simplifing code Reported-by: Zeal Robot <zealci@zte.com.cn> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220418105508.2558696-1-chi.minghao@zte.com.cn
2022-03-11hwspinlock: sprd: Use struct_size() helper in devm_kzalloc()Gustavo A. R. Silva1-2/+1
Make use of the struct_size() helper instead of an open-coded version, in order to avoid any potential type mistakes or integer overflows that, in the worst scenario, could lead to heap overflows. Also, address the following sparse warnings: drivers/hwspinlock/sprd_hwspinlock.c:96:36: warning: using sizeof on a flexible structure Link: https://github.com/KSPP/linux/issues/174 Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Reviewed-by: Baolin Wang <baolin.wang7@gmail.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220125225723.GA78256@embeddedor
2022-03-11hwspinlock: stm32: Use struct_size() helper in devm_kzalloc()Gustavo A. R. Silva1-3/+1
Make use of the struct_size() helper instead of an open-coded version, in order to avoid any potential type mistakes or integer overflows that, in the worst scenario, could lead to heap overflows. Also, address the following sparse warnings: drivers/hwspinlock/stm32_hwspinlock.c:84:32: warning: using sizeof on a flexible structure Link: https://github.com/KSPP/linux/issues/174 Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Reviewed-by: Baolin Wang <baolin.wang7@gmail.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220125021353.GA29777@embeddedor
2021-11-18hwspinlock: stm32: enable clock at probeFabien Dessenne1-21/+37
Set the clock during probe and keep its control during suspend / resume operations. This fixes an issue when CONFIG_PM is not set and where the clock is never enabled. Make use of devm_ functions to simplify the code. Signed-off-by: Fabien Dessenne <fabien.dessenne@foss.st.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20211011135836.1045437-1-fabien.dessenne@foss.st.com
2021-05-28hwspinlock: add sun6i hardware spinlock supportWilken Gottwalt3-0/+220
Adds the sun6i_hwspinlock driver for the hardware spinlock unit found in most of the sun6i compatible SoCs. This unit provides at least 32 spinlocks in hardware. The implementation supports 32, 64, 128 or 256 32bit registers. A lock can be taken by reading a register and released by writing a 0 to it. This driver supports all 4 spinlock setups, but for now only the first setup (32 locks) seem to exist in available devices. This spinlock unit is shared between all ARM cores and the embedded companion core. All of them can take/release a lock with a single cycle operation. It can be used to sync access to devices shared by the ARM cores and the companion core. There are two ways to check if a lock is taken. The first way is to read a lock. If a 0 is returned, the lock was free and is taken now. If an 1 is returned, the caller has to try again. Which means the lock is taken. The second way is to read a 32bit wide status register where every bit represents one of the 32 first locks. According to the datasheets this status register supports only the 32 first locks. This is the reason the first way (lock read/write) approach is used to be able to cover all 256 locks in future devices. The driver also reports the amount of supported locks via debugfs. Reviewed-by: Samuel Holland <samuel@sholland.org> Acked-by: Maxime Ripard <maxime@cerno.tech> Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net> Link: https://lore.kernel.org/r/bfd2b97307c2321b15c09683f4bd5e1fcc792f13.1615713499.git.wilken.gottwalt@posteo.net Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2021-03-18hwspinlock: remove sirf driverArnd Bergmann3-117/+0
The CSR SiRF prima2/atlas platforms are getting removed, so this driver is no longer needed. Cc: Barry Song <baohua@kernel.org> Link: https://lore.kernel.org/linux-arm-kernel/20210120124812.2800027-1-arnd@kernel.org/T/ Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20210120132537.2285157-1-arnd@kernel.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2021-02-09hwspinlock: omap: Add support for K3 AM64x SoCsSuman Anna1-1/+3
The AM64x SoC contains a HwSpinlock IP instance in the MAIN domain, and is a minor variant of the IP on the current TI K3 SoCs such as AM64x, J721E or J7200 SoCs. The IP is not built with the K3 safety feature in hardware, and has slightly different integration into the overall SoC. Add the support for this IP through a new compatible. Signed-off-by: Suman Anna <s-anna@ti.com> Link: https://lore.kernel.org/r/20210209172240.2305-3-s-anna@ti.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-12-10hwspinlock: sirf: Remove the redundant 'of_match_ptr'Baolin Wang1-1/+1
Remove the the redundant 'of_match_ptr' macro to fix below warning when the CONFIG_OF is not selected. All warnings: drivers/hwspinlock/sirf_hwspinlock.c:87:34: warning: unused variable 'sirf_hwpinlock_ids' [-Wunused-const-variable] Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Baolin Wang <baolin.wang7@gmail.com> Link: https://lore.kernel.org/r/250d35cb489c3c4c066f7ce256d27f36712a1979.1591618255.git.baolin.wang7@gmail.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-11-18hwspinlock: sprd: fixed warning of unused variable 'sprd_hwspinlock_of_match'Chunyan Zhang1-1/+1
The macro function of_match_ptr() is NULL if CONFIG_OF is not set, in this case Clang compiler would complain the of_device_id variable is unused. Reviewed-by: Baolin Wang <baolin.wang7@gmail.com> Reported-by: kernel test robot <lkp@intel.com> Fixes: d8c8bbbb1aba ("hwspinlock: sprd: Add hardware spinlock driver") Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com> Link: https://lore.kernel.org/r/20201112070410.14810-1-zhang.lyra@gmail.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-11-03hwspinlock: sprd: use module_platform_driver() instead postcore initcallChunyan Zhang1-12/+1
The hardware spinlock devices are defined in the DT, there's no need for init calls order, remove boilerplate code by using module_platform_driver. Reviewed-by: Baolin Wang <baolin.wang7@gmail.com> Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com> Link: https://lore.kernel.org/r/20201030034654.15775-3-zhang.lyra@gmail.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-10-26hwspinlock: sprd: Remove redundant header filesBaolin Wang1-2/+0
Remove redundant header files. Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com> Link: https://lore.kernel.org/r/1590991552-93643-1-git-send-email-baolin.wang@linux.alibaba.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-07-14hwspinlock: qcom: Allow mmio usage in addition to sysconBjorn Andersson1-16/+54
In modern Qualcomm platforms the mutex region of the TCSR is forked off into its own block, all with a offset of 0 and stride of 4096, and in some of these platforms no other registers in this region is accessed from Linux. So add support for directly memory mapping this register space, to avoid the need to represent this block using a syscon. Reviewed-by: Baolin Wang <baolin.wang7@gmail.com> Reviewed-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20200622075956.171058-4-bjorn.andersson@linaro.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-06-21hwspinlock: Simplify KconfigEzequiel Garcia1-6/+4
Every hwspinlock driver is expected to depend on the hwspinlock core, so it's possible to simplify the Kconfig, factoring out the HWSPINLOCK dependency. Reviewed-by: Baolin Wang <baolin.wang7@gmail.com> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> Link: https://lore.kernel.org/r/20200414220943.6203-1-ezequiel@collabora.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-03-26hwspinlock: hwspinlock_internal.h: Replace zero-length array with ↵Gustavo A. R. Silva1-1/+1
flexible-array member The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member[1][2], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being inadvertently introduced[3] to the codebase from now on. Also, notice that, dynamic memory allocations won't be affected by this change: "Flexible array members have incomplete type, and so the sizeof operator may not be applied. As a quirk of the original implementation of zero-length arrays, sizeof evaluates to zero."[1] This issue was found with the help of Coccinelle. [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://github.com/KSPP/linux/issues/21 [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") Reviewed-by: Baolin Wang <baolin.wang7@gmail.com> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Link: https://lore.kernel.org/r/20200319213839.GA10669@embeddedor.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-03-26hwspinlock: Allow drivers to be built with COMPILE_TESTBaolin Wang1-6/+6
Allow drivers to be built with COMPILE_TEST. Signed-off-by: Baolin Wang <baolin.wang7@gmail.com> Link: https://lore.kernel.org/r/5a95c3de07ef020a4e2f2776fa5adb00637ee387.1581324976.git.baolin.wang7@gmail.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-01-22hwspinlock: sirf: Use devm_hwspin_lock_register() to register hwlock controllerBaolin Wang1-18/+3
Use devm_hwspin_lock_register() to register the hwlock controller instead of unregistering the hwlock controller explicitly when removing the device. Signed-off-by: Baolin Wang <baolin.wang7@gmail.com> Link: https://lore.kernel.org/r/8f94e67b5f9af20a93418a2fc9cc71b194f1285c.1578453662.git.baolin.wang7@gmail.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-01-22hwspinlock: sirf: Remove redundant PM runtime functionsBaolin Wang1-18/+4
Since the hwspinlock core has changed the PM runtime to be optional, and the SIRF hardware spinlock has no pm runtime requirement, thus remove these redundant PM runtime functions. Signed-off-by: Baolin Wang <baolin.wang7@gmail.com> Link: https://lore.kernel.org/r/c921e391aa2a652d8d6ae0e4041202cec9d917e7.1578453662.git.baolin.wang7@gmail.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-01-22hwspinlock: sirf: Change to use devm_platform_ioremap_resource()Baolin Wang1-6/+3
Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together, which can simpify the code. Signed-off-by: Baolin Wang <baolin.wang7@gmail.com> Link: https://lore.kernel.org/r/dfa043f317c609a6172468ac11598968dd751bce.1578453662.git.baolin.wang7@gmail.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-01-22hwspinlock: omap: Use devm_kzalloc() to allocate memoryBaolin Wang1-5/+3
Use devm_kzalloc() to allocate memory, which can simplify the error handling. Signed-off-by: Baolin Wang <baolin.wang7@gmail.com> Link: https://lore.kernel.org/r/c066ad704c1a5fd52c3002cac80ddd59b3901b01.1578453062.git.baolin.wang7@gmail.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-01-22hwspinlock: omap: Change to use devm_platform_ioremap_resource()Baolin Wang1-16/+8
Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together, which can simpify the code. Meanwhile renaming the error label to make more sense after removing iounmap(). Signed-off-by: Baolin Wang <baolin.wang7@gmail.com> Link: https://lore.kernel.org/r/6c09c5034a7e68fdfc22d2cb5daa375bccb33a66.1578453062.git.baolin.wang7@gmail.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-01-22hwspinlock: qcom: Use devm_hwspin_lock_register() to register hwlock controllerBaolin Wang1-17/+2
Use devm_hwspin_lock_register() to register the hwlock controller instead of unregistering the hwlock controller explicitly when removing the device. Signed-off-by: Baolin Wang <baolin.wang7@gmail.com> Link: https://lore.kernel.org/r/d69ad8611a68b0cac3c927d19901f3c113c5435c.1578452735.git.baolin.wang7@gmail.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-01-22hwspinlock: qcom: Remove redundant PM runtime functionsBaolin Wang1-11/+2
Since the hwspinlock core has changed the PM runtime to be optional, and the Qualcomm hardware spinlock has no pm runtime requirement, thus remove these redundant PM runtime functions. Signed-off-by: Baolin Wang <baolin.wang7@gmail.com> Link: https://lore.kernel.org/r/e0bb751feb7af709f92e52a07d0e8ebcf1ee44ff.1578452735.git.baolin.wang7@gmail.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-12-29hwspinlock: stm32: convert to devm_platform_ioremap_resourceYangtao Li1-3/+1
Use devm_platform_ioremap_resource() to simplify code. Signed-off-by: Yangtao Li <tiny.windzz@gmail.com> Link: https://lore.kernel.org/r/20191228191541.26999-1-tiny.windzz@gmail.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-11-09hwspinlock: u8500_hsem: Remove redundant PM runtime implementationBaolin Wang1-15/+4
Since the hwspinlock core has changed the PM runtime to be optional, thus remove the redundant PM runtime implementation in the u8500 HWSEM driver. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-11-09hwspinlock: sprd: Remove redundant PM runtime implementationBaolin Wang1-18/+3
Since the hwspinlock core has changed the PM runtime to be optional, thus remove the redundant PM runtime implementation in the Spreadtrum hwlock driver. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-11-09hwspinlock: Let the PM runtime can be optionalBaolin Wang1-4/+4
Now some hwspinlock controllers did not have the requirement to implement the PM runtime, but drivers must enable the PM runtime to comply with the hwspinlock core. Thus we can change the PM runtime support to be optional by validating the -EACCES error number which means the PM runtime is not enabled, and removing the return value validating of pm_runtime_put(). So that we can remove some redundant PM runtime code in drivers. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-11-09hwspinlock: Remove BUG_ON() from the hwspinlock coreBaolin Wang1-4/+4
The original code use BUG_ON() to validate the parameters when locking or unlocking one hardware lock, but we should not crash the whole kernel though the hwlock parameters are incorrect, instead we can return the error number for users and give some warning. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-10-05hwspinlock: sprd: Use devm_hwspin_lock_register() to register hwlock controllerBaolin Wang1-5/+3
Use devm_hwspin_lock_register() to register the hwlock controller instead of unregistering the hwlock controller explicitly when removing the device. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-10-05hwspinlock: sprd: Use devm_add_action_or_reset() for calls to ↵Baolin Wang1-2/+15
clk_disable_unprepare() Use devm_add_action_or_reset() for calls to clk_disable_unprepare(), which can simplify the error handling. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-10-05hwspinlock: sprd: Check the return value of clk_prepare_enable()Baolin Wang1-1/+3
We must check the return value of clk_prepare_enable() to make sure the hardware spinlock controller can be enabled successfully, otherwise we should return error. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-10-05hwspinlock: sprd: Change to use devm_platform_ioremap_resource()Baolin Wang1-3/+1
Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together, which can simpify the code. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-10-05hwspinlock: u8500_hsem: Use devm_hwspin_lock_register() to register hwlock ↵Baolin Wang1-9/+2
controller Use devm_hwspin_lock_register() to register the hwlock controller instead of unregistering the hwlock controller explicitly when removing the device. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-10-05hwspinlock: u8500_hsem: Use devm_kzalloc() to allocate memoryBaolin Wang1-9/+6
Use devm_kzalloc() to allocate memory. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>