spi: use devm_platform_ioremap_resource() in sh-hspi and jcore
cover spi: use devm_platform_ioremap_resource() in sh-hspi and jcore
Convert these two SPI drivers to the devm_platform_ioremap_resource() helper to simplify the probe paths.
Aayush Kumar (2):
spi: sh-hspi: Use devm_platform_ioremap_resource()
spi: jcore: Use devm_platform_ioremap_resource()
drivers/spi/spi-jcore.c | 14 +++----------- drivers/spi/spi-sh-hspi.c | 15 +++------------ 2 files changed, 6 insertions(+), 23 deletions(-)
Signature · 1 line
2.56.0
PATCH 1/2 spi: sh-hspi: Use devm_platform_ioremap_resource()
Use the devm_platform_ioremap_resource() helper instead of calling platform_get_resource() and devm_ioremap() separately.
--- drivers/spi/spi-sh-hspi.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/spi/spi-sh-hspi.c +3 -12
@@ -211,19 +211,11 @@ static int hspi_transfer_one_message(struct spi_controller *ctlr,static int hspi_probe (struct platform_device *pdev) { -struct resource *res;struct spi_controller *ctlr;struct hspi_priv *hspi;struct clk *clk;int ret; -/* get base addr */ - res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (!res) { -dev_err (&pdev->dev,"invalid resource\n" ); -return -EINVAL ; - } - ctlr =devm_spi_alloc_host (&pdev->dev,sizeof (*hspi));if (!ctlr)return -ENOMEM ;
@@ -241,10 +233,9 @@ static int hspi_probe(struct platform_device *pdev) hspi->ctlr = ctlr; hspi->dev = &pdev->dev; hspi->clk = clk; - hspi->addr =devm_ioremap (hspi->dev, - res->start,resource_size (res)); -if (!hspi->addr) { - ret = -ENOMEM ; + hspi->addr =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (hspi->addr)) { + ret =PTR_ERR (hspi->addr); goto error1; }
Signature · 1 line
2.56.0
PATCH 2/2 spi: jcore: Use devm_platform_ioremap_resource()
In reply to Aayush KumarUse the devm_platform_ioremap_resource() helper instead of calling platform_get_resource(), devm_request_mem_region() and devm_ioremap() separately.
--- drivers/spi/spi-jcore.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/spi/spi-jcore.c +3 -11
@@ -143,7 +143,6 @@ static int jcore_spi_probe(struct platform_device *pdev)struct device_node *node = pdev->dev.of_node;struct jcore_spi *hw;struct spi_controller *host; -struct resource *res;u32 clock_freq;struct clk *clk;
@@ -164,16 +163,9 @@ static int jcore_spi_probe(struct platform_device *pdev)platform_set_drvdata (pdev, hw);/* Find and map our resources */ - res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (!res) -return -EBUSY ; -if (!devm_request_mem_region (&pdev->dev, res->start, -resource_size (res), pdev->name)) -return -EBUSY ; - hw->base =devm_ioremap (&pdev->dev, res->start, -resource_size (res)); -if (!hw->base) -return -EBUSY ; + hw->base =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (hw->base)) +return PTR_ERR (hw->base);/* * The SPI clock rate controlled via a configurable clock divider
Signature · 1 line
2.56.0
Mark Brown
maintainerQuoted 10 lines · Aayush Kumar
spi: use
devm_platform_ioremap_resource()in sh-hspi and jcoreConvert these two SPI drivers to the
devm_platform_ioremap_resource()helper to simplify the probe paths.Aayush Kumar (2):
spi: sh-hspi: Usedevm_platform_ioremap_resource()
spi: jcore: Usedevm_platform_ioremap_resource()[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-7.4
Thanks!
[1/2] spi: sh-hspi: Use devm_platform_ioremap_resource()
https://git.kernel.org/broonie/spi/c/e796a187fbe3 [2/2] spi: jcore: Use devm_platform_ioremap_resource() https://git.kernel.org/broonie/spi/c/a0b70663dddf
All 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