public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: rmk+kernel@armlinux.org.uk (Russell King)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/8] video: sa1100fb: use devm_gpio_request_one()
Date: Fri, 29 Sep 2017 11:51:17 +0100	[thread overview]
Message-ID: <E1dxst3-0006jG-JT@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <20170929105004.GY20805@n2100.armlinux.org.uk>

Switch to using devm_gpio_request_one() to request the shannon gpio
and move the request before the video memory allocation, so we request
all device managed resources before this large allocation attempt.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 drivers/video/fbdev/sa1100fb.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/video/fbdev/sa1100fb.c b/drivers/video/fbdev/sa1100fb.c
index a48fdb676f3e..7fa6c8f74ec6 100644
--- a/drivers/video/fbdev/sa1100fb.c
+++ b/drivers/video/fbdev/sa1100fb.c
@@ -1246,18 +1246,18 @@ static int sa1100fb_probe(struct platform_device *pdev)
 		goto failed;
 	}
 
-	/* Initialize video memory */
-	ret = sa1100fb_map_video_memory(fbi);
-	if (ret)
-		goto failed;
-
 	if (machine_is_shannon()) {
-		ret = gpio_request_one(SHANNON_GPIO_DISP_EN,
+		ret = devm_gpio_request_one(&pdev->dev, SHANNON_GPIO_DISP_EN,
 			GPIOF_OUT_INIT_LOW, "display enable");
 		if (ret)
 			goto failed;
 	}
 
+	/* Initialize video memory */
+	ret = sa1100fb_map_video_memory(fbi);
+	if (ret)
+		goto failed;
+
 	/*
 	 * This makes sure that our colour bitfield
 	 * descriptors are correctly initialised.
@@ -1268,7 +1268,7 @@ static int sa1100fb_probe(struct platform_device *pdev)
 
 	ret = register_framebuffer(&fbi->fb);
 	if (ret < 0)
-		goto err_reg_fb;
+		goto failed;
 
 #ifdef CONFIG_CPU_FREQ
 	fbi->freq_transition.notifier_call = sa1100fb_freq_transition;
@@ -1280,9 +1280,6 @@ static int sa1100fb_probe(struct platform_device *pdev)
 	/* This driver cannot be unloaded at the moment */
 	return 0;
 
- err_reg_fb:
-	if (machine_is_shannon())
-		gpio_free(SHANNON_GPIO_DISP_EN);
  failed:
 	return ret;
 }
-- 
2.7.4

  parent reply	other threads:[~2017-09-29 10:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170929105024epcas5p336177e386c65b530c4cb5fac379cedfa@epcas5p3.samsung.com>
2017-09-29 10:50 ` [PATCH 0/8] sa1100fb updates Russell King - ARM Linux
2017-09-29 10:50   ` [PATCH 1/8] video: sa1100fb: use devm_kzalloc() Russell King
2017-09-29 10:51   ` [PATCH 2/8] video: sa1100fb: use devm_clk_get() Russell King
2017-09-29 10:51   ` [PATCH 3/8] video: sa1100fb: use devm_ioremap_resource() Russell King
2017-09-29 10:51   ` [PATCH 4/8] video: sa1100fb: use devm_request_irq() Russell King
2017-09-29 10:51   ` Russell King [this message]
2017-09-29 10:51   ` [PATCH 6/8] video: sa1100fb: clean up failure path Russell King
2017-09-29 10:51   ` [PATCH 7/8] video: sa1100fb: fix video memory allocation leak Russell King
2017-09-29 10:51   ` [PATCH 8/8] video: sa1100fb: move pseudo palette into sa1100fb_info structure Russell King
2017-10-17 13:32   ` [PATCH 0/8] sa1100fb updates Bartlomiej Zolnierkiewicz
2017-11-27 17:11     ` Russell King - ARM Linux
2017-11-27 17:30       ` Bartlomiej Zolnierkiewicz
2017-11-27 17:40         ` Russell King - ARM Linux

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=E1dxst3-0006jG-JT@rmk-PC.armlinux.org.uk \
    --to=rmk+kernel@armlinux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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