diff options
author | Mark Brown <broonie@kernel.org> | 2022-08-29 23:53:30 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-08-29 23:53:30 +0300 |
commit | 44eb125b9ef6e6dc68e42da8fb1b66ff656895e1 (patch) | |
tree | c6c829750bb05b2ce432a8d666788e5885158029 /drivers/spi | |
parent | 7bb5b8268ef36ecad2f3e2a8e39be61a44816117 (diff) | |
parent | 4a5cc683543f5f6ed586944095c65cb4da4b9273 (diff) | |
download | linux-44eb125b9ef6e6dc68e42da8fb1b66ff656895e1.tar.xz |
spi: mt7621: Fix an erroneous message + clean-ups
Merge series from Christophe JAILLET <christophe.jaillet@wanadoo.fr>:
Patch 1 fixes an issue about an error code that is erroneously logged.
Patch 2-4 are just clean-ups spotted while fixing it.
Additional comments are added below --- in patches 2 and 3.
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-mt7621.c | 42 |
1 files changed, 6 insertions, 36 deletions
diff --git a/drivers/spi/spi-mt7621.c b/drivers/spi/spi-mt7621.c index b4b9b7309b5e..c4cc8e2f85e2 100644 --- a/drivers/spi/spi-mt7621.c +++ b/drivers/spi/spi-mt7621.c @@ -55,7 +55,6 @@ struct mt7621_spi { void __iomem *base; unsigned int sys_freq; unsigned int speed; - struct clk *clk; int pending_write; }; @@ -327,7 +326,6 @@ static int mt7621_spi_probe(struct platform_device *pdev) struct spi_controller *master; struct mt7621_spi *rs; void __iomem *base; - int status = 0; struct clk *clk; int ret; @@ -339,21 +337,14 @@ static int mt7621_spi_probe(struct platform_device *pdev) if (IS_ERR(base)) return PTR_ERR(base); - clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(clk)) { - dev_err(&pdev->dev, "unable to get SYS clock, err=%d\n", - status); - return PTR_ERR(clk); - } - - status = clk_prepare_enable(clk); - if (status) - return status; + clk = devm_clk_get_enabled(&pdev->dev, NULL); + if (IS_ERR(clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(clk), + "unable to get SYS clock\n"); master = devm_spi_alloc_master(&pdev->dev, sizeof(*rs)); if (!master) { dev_info(&pdev->dev, "master allocation failed\n"); - clk_disable_unprepare(clk); return -ENOMEM; } @@ -369,38 +360,18 @@ static int mt7621_spi_probe(struct platform_device *pdev) rs = spi_controller_get_devdata(master); rs->base = base; - rs->clk = clk; rs->master = master; - rs->sys_freq = clk_get_rate(rs->clk); + rs->sys_freq = clk_get_rate(clk); rs->pending_write = 0; dev_info(&pdev->dev, "sys_freq: %u\n", rs->sys_freq); ret = device_reset(&pdev->dev); if (ret) { dev_err(&pdev->dev, "SPI reset failed!\n"); - clk_disable_unprepare(clk); return ret; } - ret = spi_register_controller(master); - if (ret) - clk_disable_unprepare(clk); - - return ret; -} - -static int mt7621_spi_remove(struct platform_device *pdev) -{ - struct spi_controller *master; - struct mt7621_spi *rs; - - master = dev_get_drvdata(&pdev->dev); - rs = spi_controller_get_devdata(master); - - spi_unregister_controller(master); - clk_disable_unprepare(rs->clk); - - return 0; + return devm_spi_register_controller(&pdev->dev, master); } MODULE_ALIAS("platform:" DRIVER_NAME); @@ -411,7 +382,6 @@ static struct platform_driver mt7621_spi_driver = { .of_match_table = mt7621_spi_match, }, .probe = mt7621_spi_probe, - .remove = mt7621_spi_remove, }; module_platform_driver(mt7621_spi_driver); |