All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: hverkuil-cisco@xs4all.nl
Cc: rui.silva@linaro.org, slongerbeam@gmail.com,
	p.zabel@pengutronix.de, linux-media@vger.kernel.org,
	sebastien.szymanski@armadeus.com, otavio@ossystems.com.br,
	robh+dt@kernel.org, devicetree@vger.kernel.org,
	Fabio Estevam <festevam@gmail.com>
Subject: [PATCH 3/8] media: imx7-media-csi: Use devm_platform_ioremap_resource()
Date: Sat,  4 May 2019 11:40:21 -0300	[thread overview]
Message-ID: <20190504144027.31920-2-festevam@gmail.com> (raw)
In-Reply-To: <20190504144027.31920-1-festevam@gmail.com>

Use devm_platform_ioremap_resource() to simplify the code a bit.

While at it, propagate the real error value in case of 
devm_platform_ioremap_resource() failure.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 drivers/staging/media/imx/imx7-media-csi.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c
index 3e02cfa2f07c..e0286c322fad 100644
--- a/drivers/staging/media/imx/imx7-media-csi.c
+++ b/drivers/staging/media/imx/imx7-media-csi.c
@@ -1188,7 +1188,6 @@ static int imx7_csi_probe(struct platform_device *pdev)
 	struct device_node *node = dev->of_node;
 	struct imx_media_dev *imxmd;
 	struct imx7_csi *csi;
-	struct resource *res;
 	int ret;
 
 	csi = devm_kzalloc(&pdev->dev, sizeof(*csi), GFP_KERNEL);
@@ -1204,17 +1203,16 @@ static int imx7_csi_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	csi->irq = platform_get_irq(pdev, 0);
-	if (!res || csi->irq < 0) {
+	if (csi->irq < 0) {
 		dev_err(dev, "Missing platform resources data\n");
 		return -ENODEV;
 	}
 
-	csi->regbase = devm_ioremap_resource(dev, res);
+	csi->regbase = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(csi->regbase)) {
 		dev_err(dev, "Failed platform resources map\n");
-		return -ENODEV;
+		return PTR_ERR(csi->regbase);
 	}
 
 	spin_lock_init(&csi->irqlock);
-- 
2.17.1

  reply	other threads:[~2019-05-04 14:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-04 14:40 [PATCH 2/8] media: imx7-media-csi: Acquire a single clock Fabio Estevam
2019-05-04 14:40 ` Fabio Estevam [this message]
2019-05-04 14:40 ` [PATCH 4/8] media: imx7-media-csi: Propagate the correct error for platform_get_irq() Fabio Estevam
2019-05-04 14:40 ` [PATCH 5/8] media: imx7-media-csi: Propagate the correct error for devm_request_irq() Fabio Estevam
2019-05-04 14:40 ` [PATCH 6/8] media: imx7-media-csi: Remove unneeded break Fabio Estevam
2019-05-04 14:40 ` [PATCH 1/8] media: dt-bindings: imx7-csi: Document a single CSI clock Fabio Estevam
2019-05-06 21:21   ` Rui Miguel Silva
2019-05-27 20:18   ` Fabio Estevam
2019-06-13 18:07   ` Rob Herring
2019-06-13 18:07     ` Rob Herring
2019-05-04 14:40 ` [PATCH 7/8] media: imx7-media-csi: Check the return value from clk_prepare_enable() Fabio Estevam
2019-05-04 14:40 ` [PATCH 8/8] media: imx7-media-csi: Change imx7_csi_enable() to void Fabio Estevam

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=20190504144027.31920-2-festevam@gmail.com \
    --to=festevam@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=otavio@ossystems.com.br \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=rui.silva@linaro.org \
    --cc=sebastien.szymanski@armadeus.com \
    --cc=slongerbeam@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.