spi: spi-sn-f-ospi: Use devm_clk_get_enabled()
PATCH 1/3 spi: spi-sn-f-ospi: Use devm_clk_get_enabled()
Replace the combination of devm_clk_get_enable() plus clk_prepare_enable() with devm_clk_get_enabled(). Slightly reduces the amount of boilerplate code.
--- drivers/spi/spi-sn-f-ospi.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/spi/spi-sn-f-ospi.c +1 -12
@@ -634,18 +634,12 @@ static int f_ospi_probe(struct platform_device *pdev) goto err_put_ctlr; } - ospi->clk =devm_clk_get (dev,NULL ); + ospi->clk =devm_clk_get_enabled (dev,NULL );if (IS_ERR (ospi->clk)) { ret =PTR_ERR (ospi->clk); goto err_put_ctlr; } - ret =clk_prepare_enable (ospi->clk); -if (ret) { -dev_err (dev,"Failed to enable the clock\n" ); - goto err_disable_clk; - } -mutex_init (&ospi->mlock); ret =f_ospi_init (ospi);
@@ -661,9 +655,6 @@ static int f_ospi_probe(struct platform_device *pdev) err_destroy_mutex:mutex_destroy (&ospi->mlock); -err_disable_clk: -clk_disable_unprepare (ospi->clk); - err_put_ctlr:spi_controller_put (ctlr);
@@ -674,8 +665,6 @@ static void f_ospi_remove(struct platform_device *pdev) {struct f_ospi *ospi =platform_get_drvdata (pdev); -clk_disable_unprepare (ospi->clk); -mutex_destroy (&ospi->mlock); }
Signature · 1 line
2.30.2
PATCH 2/3 spi: spi-sn-f-ospi: Use min_t instead of opencoding it
Use min_t instead of min with casting the individual arguments.
--- drivers/spi/spi-sn-f-ospi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-sn-f-ospi.c +1 -1
@@ -566,7 +566,7 @@ static bool f_ospi_supports_op(struct spi_mem *mem,static int f_ospi_adjust_op_size (struct spi_mem *mem,struct spi_mem_op *op) { - op->data.nbytes =min ((int )op->data.nbytes, (int )(OSPI_DAT_SIZE_MAX )); + op->data.nbytes =min_t (int, op->data.nbytes,OSPI_DAT_SIZE_MAX );return 0 ; }
Signature · 1 line
2.30.2
PATCH 3/3 spi: spi-sn-f-ospi: Make read-only array `width_available` static const
In reply to Lars-Peter ClausenThe width_available array is currently placed on the f_ospi_supports_op_width() function's stack.
But the array is never modified. Make it static const. This makes the code slightly smaller and more efficient.
--- drivers/spi/spi-sn-f-ospi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-sn-f-ospi.c +1 -1
@@ -526,7 +526,7 @@ static int f_ospi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)static bool f_ospi_supports_op_width (struct spi_mem *mem,const struct spi_mem_op *op) { -u8 width_available[] = {0 ,1 ,2 ,4 ,8 }; +static const u8 width_available[] = {0 ,1 ,2 ,4 ,8 };u8 width_op[] = { op->cmd.buswidth, op->addr.buswidth, op->dummy.buswidth, op->data.buswidth };bool is_match_found;
Signature · 1 line
2.30.2
Mark Brown
maintainerQuoted 5 lines · Lars-Peter Clausen
Replace the combination of
devm_clk_get_enable()plusclk_prepare_enable()withdevm_clk_get_enabled(). Slightly reduces the amount of boilerplate code.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/3] spi: spi-sn-f-ospi: Use devm_clk_get_enabled()
commit: 5363073dfcf087393c0587e9217ef50b1d63fcce
[2/3] spi: spi-sn-f-ospi: Use min_t instead of opencoding it
commit: 282152fa9d54a84a486b93a913934c21503fb5db
[3/3] spi: spi-sn-f-ospi: Make read-only array `width_available` static const
commit: 81ea9a0710bcf74934446f63898f0186aeb2b5b8All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark