From: Esben Haabendal <eha@doredevelopment.dk>
To: Randy Dunlap <rdunlap@xenotime.net>,
akpm@linux-foundation.org, Richard Purdie <rpurdie@rpsys.net>
Cc: Esben Haabendal <eha@doredevelopment.dk>, linux-kernel@vger.kernel.org
Subject: [PATCH] leds: fix build with CONFIG_LEDS_TRIGGERS disabled
Date: Mon, 9 May 2011 11:16:18 +0200 [thread overview]
Message-ID: <1304932578-14501-1-git-send-email-eha@doredevelopment.dk> (raw)
In-Reply-To: <20110506182341.d2cd8a19.rdunlap@xenotime.net>
Add led_get_trigger_data() function for stubbing out access to trigger_data
when CONFIG_LEDS_TRIGGERS is disabled. This fixes builds with
CONFIG_LEDS_CLASS enabled, which were broken by
leds-support-automatic-start-of-blinking-with-ledtrig-timer.patch
Signed-off-by: Esben Haabendal <eha@doredevelopment.dk>
---
drivers/leds/led-class.c | 2 +-
drivers/leds/leds.h | 7 +++++++
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index d7bdef8..dc3d3d8 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -131,7 +131,7 @@ static void led_set_software_blink(struct led_classdev *led_cdev,
if (!led_cdev->blink_brightness)
led_cdev->blink_brightness = led_cdev->max_brightness;
- if (led_cdev->trigger_data &&
+ if (led_get_trigger_data(led_cdev) &&
delay_on == led_cdev->blink_delay_on &&
delay_off == led_cdev->blink_delay_off)
return;
diff --git a/drivers/leds/leds.h b/drivers/leds/leds.h
index 2dd8ecb..e77c7f8 100644
--- a/drivers/leds/leds.h
+++ b/drivers/leds/leds.h
@@ -40,10 +40,17 @@ void led_trigger_set_default(struct led_classdev *led_cdev);
void led_trigger_set(struct led_classdev *led_cdev,
struct led_trigger *trigger);
void led_trigger_remove(struct led_classdev *led_cdev);
+
+static inline void *led_get_trigger_data(struct led_classdev *led_cdev)
+{
+ return led_cdev->trigger_data;
+}
+
#else
#define led_trigger_set_default(x) do {} while (0)
#define led_trigger_set(x, y) do {} while (0)
#define led_trigger_remove(x) do {} while (0)
+#define led_get_trigger_data(x) (NULL)
#endif
ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr,
--
1.7.1
next prev parent reply other threads:[~2011-05-09 9:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-06 23:39 mmotm 2011-05-06-16-39 uploaded akpm
2011-05-07 1:23 ` mmotm 2011-05-06-16-39 uploaded (leds) Randy Dunlap
2011-05-07 6:23 ` Esben Haabendal
2011-05-09 9:16 ` Esben Haabendal [this message]
2011-05-09 15:51 ` [PATCH] leds: fix build with CONFIG_LEDS_TRIGGERS disabled Randy Dunlap
2011-05-07 1:35 ` mmotm 2011-05-06-16-39 uploaded (fs/proc/task_mmu) Randy Dunlap
2011-05-07 5:37 ` Stephen Wilson
2011-05-10 8:57 ` mmotm 2011-05-06-16-39 uploaded KAMEZAWA Hiroyuki
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=1304932578-14501-1-git-send-email-eha@doredevelopment.dk \
--to=eha@doredevelopment.dk \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@xenotime.net \
--cc=rpurdie@rpsys.net \
/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).