From: anarsoul@gmail.com (Vasily Khoruzhick)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] h1940-leds: Fix compile issue introduced by latch-related changes
Date: Mon, 8 Nov 2010 22:31:48 +0200 [thread overview]
Message-ID: <1289248308-21272-2-git-send-email-anarsoul@gmail.com> (raw)
In-Reply-To: <1289248308-21272-1-git-send-email-anarsoul@gmail.com>
Latch API was converted to gpiolib API as result we got this compile
error:
drivers/leds/leds-h1940.c: In function 'h1940_greenled_set':
drivers/leds/leds-h1940.c:33: error: implicit declaration of function
'h1940_latch_control
Adapt h1940-leds driver to new changes and fix compile issue.
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
drivers/leds/leds-h1940.c | 67 ++++++++++++++++++++++++++++++++-------------
1 files changed, 48 insertions(+), 19 deletions(-)
diff --git a/drivers/leds/leds-h1940.c b/drivers/leds/leds-h1940.c
index 173d104..d9c2729 100644
--- a/drivers/leds/leds-h1940.c
+++ b/drivers/leds/leds-h1940.c
@@ -30,18 +30,18 @@ static void h1940_greenled_set(struct led_classdev *led_dev,
{
switch (value) {
case LED_HALF:
- h1940_latch_control(0, H1940_LATCH_LED_FLASH);
- s3c2410_gpio_setpin(S3C2410_GPA7, 1);
+ gpio_set_value(H1940_LATCH_LED_FLASH, 1);
+ gpio_set_value(S3C2410_GPA(7), 1);
break;
case LED_FULL:
- h1940_latch_control(0, H1940_LATCH_LED_GREEN);
- s3c2410_gpio_setpin(S3C2410_GPA7, 1);
+ gpio_set_value(H1940_LATCH_LED_GREEN, 1);
+ gpio_set_value(S3C2410_GPA(7), 1);
break;
default:
case LED_OFF:
- h1940_latch_control(H1940_LATCH_LED_FLASH, 0);
- h1940_latch_control(H1940_LATCH_LED_GREEN, 0);
- s3c2410_gpio_setpin(S3C2410_GPA7, 0);
+ gpio_set_value(H1940_LATCH_LED_FLASH, 0);
+ gpio_set_value(H1940_LATCH_LED_GREEN, 0);
+ gpio_set_value(S3C2410_GPA(7), 0);
break;
}
}
@@ -60,18 +60,18 @@ static void h1940_redled_set(struct led_classdev *led_dev,
{
switch (value) {
case LED_HALF:
- h1940_latch_control(0, H1940_LATCH_LED_FLASH);
- s3c2410_gpio_setpin(S3C2410_GPA1, 1);
+ gpio_set_value(H1940_LATCH_LED_FLASH, 1);
+ gpio_set_value(S3C2410_GPA(1), 1);
break;
case LED_FULL:
- h1940_latch_control(0, H1940_LATCH_LED_RED);
- s3c2410_gpio_setpin(S3C2410_GPA1, 1);
+ gpio_set_value(H1940_LATCH_LED_RED, 1);
+ gpio_set_value(S3C2410_GPA(1), 1);
break;
default:
case LED_OFF:
- h1940_latch_control(H1940_LATCH_LED_FLASH, 0);
- h1940_latch_control(H1940_LATCH_LED_RED, 0);
- s3c2410_gpio_setpin(S3C2410_GPA1, 0);
+ gpio_set_value(H1940_LATCH_LED_FLASH, 0);
+ gpio_set_value(H1940_LATCH_LED_RED, 0);
+ gpio_set_value(S3C2410_GPA(1), 0);
break;
}
}
@@ -91,11 +91,11 @@ static void h1940_blueled_set(struct led_classdev *led_dev,
{
if (value) {
/* flashing Blue */
- h1940_latch_control(0, H1940_LATCH_LED_FLASH);
- s3c2410_gpio_setpin(S3C2410_GPA3, 1);
+ gpio_set_value(H1940_LATCH_LED_FLASH, 1);
+ gpio_set_value(S3C2410_GPA(3), 1);
} else {
- h1940_latch_control(H1940_LATCH_LED_FLASH, 0);
- s3c2410_gpio_setpin(S3C2410_GPA3, 0);
+ gpio_set_value(H1940_LATCH_LED_FLASH, 0);
+ gpio_set_value(S3C2410_GPA(3), 0);
}
}
@@ -108,7 +108,24 @@ static struct led_classdev h1940_blueled = {
static int __devinit h1940leds_probe(struct platform_device *pdev)
{
- int ret;
+ int ret, gpioidx = 0;
+ int led_gpios[] = {
+ H1940_LATCH_LED_GREEN,
+ H1940_LATCH_LED_RED,
+ H1940_LATCH_LED_FLASH,
+ S3C2410_GPA(1),
+ S3C2410_GPA(3),
+ S3C2410_GPA(7),
+ };
+
+ for (gpioidx = 0; gpioidx < ARRAY_SIZE(led_gpios); gpioidx++) {
+ ret = gpio_request(led_gpios[gpioidx], "h1940 leds");
+ if (ret < 0)
+ goto err_gpio;
+ ret = gpio_direction_output(led_gpios[gpioidx], 0);
+ if (ret < 0)
+ goto err_gpio;
+ }
ret = led_classdev_register(&pdev->dev, &h1940_greenled);
if (ret)
@@ -129,6 +146,10 @@ err_blue:
err_red:
led_classdev_unregister(&h1940_greenled);
err_green:
+err_gpio:
+ while (--gpioidx >= 0)
+ gpio_free(led_gpios[gpioidx]);
+
return ret;
}
@@ -137,6 +158,14 @@ static int h1940leds_remove(struct platform_device *pdev)
led_classdev_unregister(&h1940_greenled);
led_classdev_unregister(&h1940_redled);
led_classdev_unregister(&h1940_blueled);
+
+ gpio_free(H1940_LATCH_LED_GREEN);
+ gpio_free(H1940_LATCH_LED_RED);
+ gpio_free(H1940_LATCH_LED_FLASH);
+ gpio_free(S3C2410_GPA(1));
+ gpio_free(S3C2410_GPA(3));
+ gpio_free(S3C2410_GPA(7));
+
return 0;
}
--
1.7.3.2
next prev parent reply other threads:[~2010-11-08 20:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-08 20:31 [PATCH 1/2] ARM: S3C2410: H1940: Adapt h1940-bluetooth to gpiolib changes Vasily Khoruzhick
2010-11-08 20:31 ` Vasily Khoruzhick [this message]
2010-11-15 3:55 ` [PATCH 2/2] h1940-leds: Fix compile issue introduced by latch-related changes Kukjin Kim
2010-11-16 23:12 ` Ben Dooks
2010-11-17 6:55 ` Vasily Khoruzhick
2010-12-06 16:43 ` Vasily Khoruzhick
2010-11-16 9:20 ` [PATCH 1/2] ARM: S3C2410: H1940: Adapt h1940-bluetooth to gpiolib changes Kukjin Kim
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=1289248308-21272-2-git-send-email-anarsoul@gmail.com \
--to=anarsoul@gmail.com \
--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;
as well as URLs for NNTP newsgroup(s).