mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yangtao Li <frank.li@vivo.com>
To: Hugues Fruchet <hugues.fruchet@foss.st.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: Yangtao Li <frank.li@vivo.com>,
	linux-media@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 08/11] media: stm32-dcmi: Use devm_platform_get_and_ioremap_resource()
Date: Thu,  6 Jul 2023 18:10:56 +0800	[thread overview]
Message-ID: <20230706101100.75654-8-frank.li@vivo.com> (raw)
In-Reply-To: <20230706101100.75654-1-frank.li@vivo.com>

Convert platform_get_resource(), devm_ioremap_resource() to a single
call to devm_platform_get_and_ioremap_resource(), as this is exactly
what this function does.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/media/platform/st/stm32/stm32-dcmi.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/media/platform/st/stm32/stm32-dcmi.c b/drivers/media/platform/st/stm32/stm32-dcmi.c
index dad6e22e4ce4..b2e2af593291 100644
--- a/drivers/media/platform/st/stm32/stm32-dcmi.c
+++ b/drivers/media/platform/st/stm32/stm32-dcmi.c
@@ -1932,7 +1932,6 @@ static int dcmi_probe(struct platform_device *pdev)
 	struct dma_chan *chan;
 	struct dma_slave_caps caps;
 	struct clk *mclk;
-	int irq;
 	int ret = 0;
 
 	match = of_match_device(of_match_ptr(stm32_dcmi_of_match), &pdev->dev);
@@ -1981,19 +1980,11 @@ static int dcmi_probe(struct platform_device *pdev)
 	dcmi->bus.data_shift = ep.bus.parallel.data_shift;
 	dcmi->bus_type = ep.bus_type;
 
-	irq = platform_get_irq(pdev, 0);
-	if (irq <= 0)
-		return irq ? irq : -ENXIO;
+	dcmi->irq = platform_get_irq(pdev, 0);
+	if (dcmi->irq < 0)
+		return dcmi->irq;
 
-	dcmi->irq = irq;
-
-	dcmi->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!dcmi->res) {
-		dev_err(&pdev->dev, "Could not get resource\n");
-		return -ENODEV;
-	}
-
-	dcmi->regs = devm_ioremap_resource(&pdev->dev, dcmi->res);
+	dcmi->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &dcmi->res);
 	if (IS_ERR(dcmi->regs))
 		return PTR_ERR(dcmi->regs);
 
-- 
2.39.0


  parent reply	other threads:[~2023-07-06 10:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-06 10:10 [PATCH 01/11] media: atmel-isi: Convert to devm_platform_ioremap_resource() Yangtao Li
2023-07-06 10:10 ` [PATCH 02/11] media: pxa_camera: Use devm_platform_get_and_ioremap_resource() Yangtao Li
2023-07-06 10:10 ` [PATCH 03/11] media: marvell: " Yangtao Li
2023-07-06 10:10 ` [PATCH 04/11] media: microchip-sama5d2-isc: Convert to devm_platform_ioremap_resource() Yangtao Li
2023-07-06 10:10 ` [PATCH 05/11] media: fimc-lite: " Yangtao Li
2023-07-06 10:10 ` [PATCH 06/11] media: microchip-sama7g5-isc: " Yangtao Li
2023-07-06 10:10 ` [PATCH 07/11] media: verisilicon: Convert to devm_platform_ioremap_resource() and devm_platform_ioremap_resource_byname() Yangtao Li
2023-07-07  8:26   ` Chen-Yu Tsai
2023-07-06 10:10 ` Yangtao Li [this message]
2023-07-06 10:10 ` [PATCH 09/11] media: platform: ti: Use devm_platform_get_and_ioremap_resource() Yangtao Li
2023-07-07  8:37   ` Laurent Pinchart
2023-07-06 10:10 ` [PATCH 10/11] media: fimc-core: Convert to devm_platform_ioremap_resource() Yangtao Li
2023-07-06 10:10 ` [PATCH 11/11] media: sh_vou: " Yangtao Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230706101100.75654-8-frank.li@vivo.com \
    --to=frank.li@vivo.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=hugues.fruchet@foss.st.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mchehab@kernel.org \
    --cc=mcoquelin.stm32@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®