linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/komeda: Use devm_platform_ioremap_resource() in komeda_dev_create()
@ 2019-09-21 17:50 Markus Elfring
  2019-09-23  6:54 ` james qian wang (Arm Technology China)
  2019-10-09  8:57 ` james qian wang (Arm Technology China)
  0 siblings, 2 replies; 4+ messages in thread
From: Markus Elfring @ 2019-09-21 17:50 UTC (permalink / raw)
  To: dri-devel, Brian Starkey, Daniel Vetter, David Airlie,
	James (Qian) Wang, Liviu Dudau
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 21 Sep 2019 19:43:51 +0200

Simplify this function implementation by using a known wrapper function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
index ca64a129c594..a387d923962e 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
@@ -172,19 +172,12 @@ struct komeda_dev *komeda_dev_create(struct device *dev)
 	struct platform_device *pdev = to_platform_device(dev);
 	const struct komeda_product_data *product;
 	struct komeda_dev *mdev;
-	struct resource *io_res;
 	int err = 0;

 	product = of_device_get_match_data(dev);
 	if (!product)
 		return ERR_PTR(-ENODEV);

-	io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!io_res) {
-		DRM_ERROR("No registers defined.\n");
-		return ERR_PTR(-ENODEV);
-	}
-
 	mdev = devm_kzalloc(dev, sizeof(*mdev), GFP_KERNEL);
 	if (!mdev)
 		return ERR_PTR(-ENOMEM);
@@ -192,7 +185,7 @@ struct komeda_dev *komeda_dev_create(struct device *dev)
 	mutex_init(&mdev->lock);

 	mdev->dev = dev;
-	mdev->reg_base = devm_ioremap_resource(dev, io_res);
+	mdev->reg_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(mdev->reg_base)) {
 		DRM_ERROR("Map register space failed.\n");
 		err = PTR_ERR(mdev->reg_base);
--
2.23.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-06 17:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-21 17:50 [PATCH] drm/komeda: Use devm_platform_ioremap_resource() in komeda_dev_create() Markus Elfring
2019-09-23  6:54 ` james qian wang (Arm Technology China)
2019-10-09  8:57 ` james qian wang (Arm Technology China)
2019-11-06 17:51   ` Mihail Atanassov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).