* [PATCH AUTOSEL 5.4 196/350] spi: sifive: disable clk when probe fails and remove [not found] <20191210210735.9077-1-sashal@kernel.org> @ 2019-12-10 21:05 ` Sasha Levin 2019-12-10 21:07 ` [PATCH AUTOSEL 5.4 316/350] int128: move __uint128_t compiler test to Kconfig Sasha Levin 1 sibling, 0 replies; 4+ messages in thread From: Sasha Levin @ 2019-12-10 21:05 UTC (permalink / raw) To: linux-kernel, stable Cc: Sasha Levin, Chuhong Yuan, linux-spi, Mark Brown, Palmer Dabbelt, linux-riscv From: Chuhong Yuan <hslester96@gmail.com> [ Upstream commit a725272bda77e61c1b4de85c7b0c875b2ea639b6 ] The driver forgets to disable and unprepare clk when probe fails and remove. Add the calls to fix the problem. Signed-off-by: Chuhong Yuan <hslester96@gmail.com> Reviewed-by: Palmer Dabbelt <palmer@dabbelt.com> Link: https://lore.kernel.org/r/20191101121745.13413-1-hslester96@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> --- drivers/spi/spi-sifive.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-sifive.c b/drivers/spi/spi-sifive.c index 35254bdc42c48..f7c1e20432e07 100644 --- a/drivers/spi/spi-sifive.c +++ b/drivers/spi/spi-sifive.c @@ -357,14 +357,14 @@ static int sifive_spi_probe(struct platform_device *pdev) if (!cs_bits) { dev_err(&pdev->dev, "Could not auto probe CS lines\n"); ret = -EINVAL; - goto put_master; + goto disable_clk; } num_cs = ilog2(cs_bits) + 1; if (num_cs > SIFIVE_SPI_MAX_CS) { dev_err(&pdev->dev, "Invalid number of spi slaves\n"); ret = -EINVAL; - goto put_master; + goto disable_clk; } /* Define our master */ @@ -393,7 +393,7 @@ static int sifive_spi_probe(struct platform_device *pdev) dev_name(&pdev->dev), spi); if (ret) { dev_err(&pdev->dev, "Unable to bind to interrupt\n"); - goto put_master; + goto disable_clk; } dev_info(&pdev->dev, "mapped; irq=%d, cs=%d\n", @@ -402,11 +402,13 @@ static int sifive_spi_probe(struct platform_device *pdev) ret = devm_spi_register_master(&pdev->dev, master); if (ret < 0) { dev_err(&pdev->dev, "spi_register_master failed\n"); - goto put_master; + goto disable_clk; } return 0; +disable_clk: + clk_disable_unprepare(spi->clk); put_master: spi_master_put(master); @@ -420,6 +422,7 @@ static int sifive_spi_remove(struct platform_device *pdev) /* Disable all the interrupts just in case */ sifive_spi_write(spi, SIFIVE_SPI_REG_IE, 0); + clk_disable_unprepare(spi->clk); return 0; } -- 2.20.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH AUTOSEL 5.4 316/350] int128: move __uint128_t compiler test to Kconfig [not found] <20191210210735.9077-1-sashal@kernel.org> 2019-12-10 21:05 ` [PATCH AUTOSEL 5.4 196/350] spi: sifive: disable clk when probe fails and remove Sasha Levin @ 2019-12-10 21:07 ` Sasha Levin 2019-12-11 10:07 ` Ard Biesheuvel 1 sibling, 1 reply; 4+ messages in thread From: Sasha Levin @ 2019-12-10 21:07 UTC (permalink / raw) To: linux-kernel, stable Cc: Sasha Levin, Herbert Xu, Masahiro Yamada, linux-crypto, linux-riscv, Ard Biesheuvel, linux-arm-kernel From: Ard Biesheuvel <ardb@kernel.org> [ Upstream commit c12d3362a74bf0cd9e1d488918d40607b62a3104 ] In order to use 128-bit integer arithmetic in C code, the architecture needs to have declared support for it by setting ARCH_SUPPORTS_INT128, and it requires a version of the toolchain that supports this at build time. This is why all existing tests for ARCH_SUPPORTS_INT128 also test whether __SIZEOF_INT128__ is defined, since this is only the case for compilers that can support 128-bit integers. Let's fold this additional test into the Kconfig declaration of ARCH_SUPPORTS_INT128 so that we can also use the symbol in Makefiles, e.g., to decide whether a certain object needs to be included in the first place. Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org> --- arch/arm64/Kconfig | 2 +- arch/riscv/Kconfig | 2 +- arch/x86/Kconfig | 2 +- crypto/ecc.c | 2 +- init/Kconfig | 4 ++++ lib/ubsan.c | 2 +- lib/ubsan.h | 2 +- 7 files changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 3f047afb982c8..54c38c9cab88a 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -67,7 +67,7 @@ config ARM64 select ARCH_USE_QUEUED_SPINLOCKS select ARCH_SUPPORTS_MEMORY_FAILURE select ARCH_SUPPORTS_ATOMIC_RMW - select ARCH_SUPPORTS_INT128 if GCC_VERSION >= 50000 || CC_IS_CLANG + select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 && (GCC_VERSION >= 50000 || CC_IS_CLANG) select ARCH_SUPPORTS_NUMA_BALANCING select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 8eebbc8860bbd..75a6c91176221 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -164,7 +164,7 @@ config ARCH_RV32I config ARCH_RV64I bool "RV64I" select 64BIT - select ARCH_SUPPORTS_INT128 if GCC_VERSION >= 50000 + select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 && GCC_VERSION >= 50000 select HAVE_FUNCTION_TRACER select HAVE_FUNCTION_GRAPH_TRACER select HAVE_FTRACE_MCOUNT_RECORD diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 8ef85139553f5..f2aed8012e9c0 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -24,7 +24,7 @@ config X86_64 depends on 64BIT # Options that are inherently 64-bit kernel only: select ARCH_HAS_GIGANTIC_PAGE - select ARCH_SUPPORTS_INT128 + select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 select ARCH_USE_CMPXCHG_LOCKREF select HAVE_ARCH_SOFT_DIRTY select MODULES_USE_ELF_RELA diff --git a/crypto/ecc.c b/crypto/ecc.c index dfe114bc0c4af..6e6aab6c987c2 100644 --- a/crypto/ecc.c +++ b/crypto/ecc.c @@ -336,7 +336,7 @@ static u64 vli_usub(u64 *result, const u64 *left, u64 right, static uint128_t mul_64_64(u64 left, u64 right) { uint128_t result; -#if defined(CONFIG_ARCH_SUPPORTS_INT128) && defined(__SIZEOF_INT128__) +#if defined(CONFIG_ARCH_SUPPORTS_INT128) unsigned __int128 m = (unsigned __int128)left * right; result.m_low = m; diff --git a/init/Kconfig b/init/Kconfig index b4daad2bac233..020526f681c03 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -785,6 +785,10 @@ config ARCH_SUPPORTS_NUMA_BALANCING config ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH bool +config CC_HAS_INT128 + def_bool y + depends on !$(cc-option,-D__SIZEOF_INT128__=0) + # # For architectures that know their GCC __int128 support is sound # diff --git a/lib/ubsan.c b/lib/ubsan.c index 0c4681118fcd2..fc552d524ef77 100644 --- a/lib/ubsan.c +++ b/lib/ubsan.c @@ -119,7 +119,7 @@ static void val_to_string(char *str, size_t size, struct type_descriptor *type, { if (type_is_int(type)) { if (type_bit_width(type) == 128) { -#if defined(CONFIG_ARCH_SUPPORTS_INT128) && defined(__SIZEOF_INT128__) +#if defined(CONFIG_ARCH_SUPPORTS_INT128) u_max val = get_unsigned_val(type, value); scnprintf(str, size, "0x%08x%08x%08x%08x", diff --git a/lib/ubsan.h b/lib/ubsan.h index b8fa83864467f..7b56c09473a98 100644 --- a/lib/ubsan.h +++ b/lib/ubsan.h @@ -78,7 +78,7 @@ struct invalid_value_data { struct type_descriptor *type; }; -#if defined(CONFIG_ARCH_SUPPORTS_INT128) && defined(__SIZEOF_INT128__) +#if defined(CONFIG_ARCH_SUPPORTS_INT128) typedef __int128 s_max; typedef unsigned __int128 u_max; #else -- 2.20.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH AUTOSEL 5.4 316/350] int128: move __uint128_t compiler test to Kconfig 2019-12-10 21:07 ` [PATCH AUTOSEL 5.4 316/350] int128: move __uint128_t compiler test to Kconfig Sasha Levin @ 2019-12-11 10:07 ` Ard Biesheuvel 2019-12-19 23:24 ` Sasha Levin 0 siblings, 1 reply; 4+ messages in thread From: Ard Biesheuvel @ 2019-12-11 10:07 UTC (permalink / raw) To: Sasha Levin Cc: Herbert Xu, Linux Kernel Mailing List, stable, Masahiro Yamada, open list:HARDWARE RANDOM NUMBER GENERATOR CORE, linux-riscv, Ard Biesheuvel, linux-arm-kernel On Tue, 10 Dec 2019 at 22:13, Sasha Levin <sashal@kernel.org> wrote: > > From: Ard Biesheuvel <ardb@kernel.org> > > [ Upstream commit c12d3362a74bf0cd9e1d488918d40607b62a3104 ] > > In order to use 128-bit integer arithmetic in C code, the architecture > needs to have declared support for it by setting ARCH_SUPPORTS_INT128, > and it requires a version of the toolchain that supports this at build > time. This is why all existing tests for ARCH_SUPPORTS_INT128 also test > whether __SIZEOF_INT128__ is defined, since this is only the case for > compilers that can support 128-bit integers. > > Let's fold this additional test into the Kconfig declaration of > ARCH_SUPPORTS_INT128 so that we can also use the symbol in Makefiles, > e.g., to decide whether a certain object needs to be included in the > first place. > > Cc: Masahiro Yamada <yamada.masahiro@socionext.com> > Signed-off-by: Ard Biesheuvel <ardb@kernel.org> > Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> > Signed-off-by: Sasha Levin <sashal@kernel.org> This does not fix a bug so no need to put it in -stable > --- > arch/arm64/Kconfig | 2 +- > arch/riscv/Kconfig | 2 +- > arch/x86/Kconfig | 2 +- > crypto/ecc.c | 2 +- > init/Kconfig | 4 ++++ > lib/ubsan.c | 2 +- > lib/ubsan.h | 2 +- > 7 files changed, 10 insertions(+), 6 deletions(-) > > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > index 3f047afb982c8..54c38c9cab88a 100644 > --- a/arch/arm64/Kconfig > +++ b/arch/arm64/Kconfig > @@ -67,7 +67,7 @@ config ARM64 > select ARCH_USE_QUEUED_SPINLOCKS > select ARCH_SUPPORTS_MEMORY_FAILURE > select ARCH_SUPPORTS_ATOMIC_RMW > - select ARCH_SUPPORTS_INT128 if GCC_VERSION >= 50000 || CC_IS_CLANG > + select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 && (GCC_VERSION >= 50000 || CC_IS_CLANG) > select ARCH_SUPPORTS_NUMA_BALANCING > select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT > select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig > index 8eebbc8860bbd..75a6c91176221 100644 > --- a/arch/riscv/Kconfig > +++ b/arch/riscv/Kconfig > @@ -164,7 +164,7 @@ config ARCH_RV32I > config ARCH_RV64I > bool "RV64I" > select 64BIT > - select ARCH_SUPPORTS_INT128 if GCC_VERSION >= 50000 > + select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 && GCC_VERSION >= 50000 > select HAVE_FUNCTION_TRACER > select HAVE_FUNCTION_GRAPH_TRACER > select HAVE_FTRACE_MCOUNT_RECORD > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > index 8ef85139553f5..f2aed8012e9c0 100644 > --- a/arch/x86/Kconfig > +++ b/arch/x86/Kconfig > @@ -24,7 +24,7 @@ config X86_64 > depends on 64BIT > # Options that are inherently 64-bit kernel only: > select ARCH_HAS_GIGANTIC_PAGE > - select ARCH_SUPPORTS_INT128 > + select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 > select ARCH_USE_CMPXCHG_LOCKREF > select HAVE_ARCH_SOFT_DIRTY > select MODULES_USE_ELF_RELA > diff --git a/crypto/ecc.c b/crypto/ecc.c > index dfe114bc0c4af..6e6aab6c987c2 100644 > --- a/crypto/ecc.c > +++ b/crypto/ecc.c > @@ -336,7 +336,7 @@ static u64 vli_usub(u64 *result, const u64 *left, u64 right, > static uint128_t mul_64_64(u64 left, u64 right) > { > uint128_t result; > -#if defined(CONFIG_ARCH_SUPPORTS_INT128) && defined(__SIZEOF_INT128__) > +#if defined(CONFIG_ARCH_SUPPORTS_INT128) > unsigned __int128 m = (unsigned __int128)left * right; > > result.m_low = m; > diff --git a/init/Kconfig b/init/Kconfig > index b4daad2bac233..020526f681c03 100644 > --- a/init/Kconfig > +++ b/init/Kconfig > @@ -785,6 +785,10 @@ config ARCH_SUPPORTS_NUMA_BALANCING > config ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH > bool > > +config CC_HAS_INT128 > + def_bool y > + depends on !$(cc-option,-D__SIZEOF_INT128__=0) > + > # > # For architectures that know their GCC __int128 support is sound > # > diff --git a/lib/ubsan.c b/lib/ubsan.c > index 0c4681118fcd2..fc552d524ef77 100644 > --- a/lib/ubsan.c > +++ b/lib/ubsan.c > @@ -119,7 +119,7 @@ static void val_to_string(char *str, size_t size, struct type_descriptor *type, > { > if (type_is_int(type)) { > if (type_bit_width(type) == 128) { > -#if defined(CONFIG_ARCH_SUPPORTS_INT128) && defined(__SIZEOF_INT128__) > +#if defined(CONFIG_ARCH_SUPPORTS_INT128) > u_max val = get_unsigned_val(type, value); > > scnprintf(str, size, "0x%08x%08x%08x%08x", > diff --git a/lib/ubsan.h b/lib/ubsan.h > index b8fa83864467f..7b56c09473a98 100644 > --- a/lib/ubsan.h > +++ b/lib/ubsan.h > @@ -78,7 +78,7 @@ struct invalid_value_data { > struct type_descriptor *type; > }; > > -#if defined(CONFIG_ARCH_SUPPORTS_INT128) && defined(__SIZEOF_INT128__) > +#if defined(CONFIG_ARCH_SUPPORTS_INT128) > typedef __int128 s_max; > typedef unsigned __int128 u_max; > #else > -- > 2.20.1 > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH AUTOSEL 5.4 316/350] int128: move __uint128_t compiler test to Kconfig 2019-12-11 10:07 ` Ard Biesheuvel @ 2019-12-19 23:24 ` Sasha Levin 0 siblings, 0 replies; 4+ messages in thread From: Sasha Levin @ 2019-12-19 23:24 UTC (permalink / raw) To: Ard Biesheuvel Cc: Herbert Xu, Linux Kernel Mailing List, stable, Masahiro Yamada, open list:HARDWARE RANDOM NUMBER GENERATOR CORE, linux-riscv, Ard Biesheuvel, linux-arm-kernel On Wed, Dec 11, 2019 at 10:07:54AM +0000, Ard Biesheuvel wrote: >On Tue, 10 Dec 2019 at 22:13, Sasha Levin <sashal@kernel.org> wrote: >> >> From: Ard Biesheuvel <ardb@kernel.org> >> >> [ Upstream commit c12d3362a74bf0cd9e1d488918d40607b62a3104 ] >> >> In order to use 128-bit integer arithmetic in C code, the architecture >> needs to have declared support for it by setting ARCH_SUPPORTS_INT128, >> and it requires a version of the toolchain that supports this at build >> time. This is why all existing tests for ARCH_SUPPORTS_INT128 also test >> whether __SIZEOF_INT128__ is defined, since this is only the case for >> compilers that can support 128-bit integers. >> >> Let's fold this additional test into the Kconfig declaration of >> ARCH_SUPPORTS_INT128 so that we can also use the symbol in Makefiles, >> e.g., to decide whether a certain object needs to be included in the >> first place. >> >> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> >> Signed-off-by: Ard Biesheuvel <ardb@kernel.org> >> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> >> Signed-off-by: Sasha Levin <sashal@kernel.org> > >This does not fix a bug so no need to put it in -stable Dropped, thanks! -- Thanks, Sasha ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-12-19 23:24 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <20191210210735.9077-1-sashal@kernel.org> 2019-12-10 21:05 ` [PATCH AUTOSEL 5.4 196/350] spi: sifive: disable clk when probe fails and remove Sasha Levin 2019-12-10 21:07 ` [PATCH AUTOSEL 5.4 316/350] int128: move __uint128_t compiler test to Kconfig Sasha Levin 2019-12-11 10:07 ` Ard Biesheuvel 2019-12-19 23:24 ` Sasha Levin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).