All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: BlueZ development <linux-bluetooth@vger.kernel.org>
Subject: [PATCH] bluetooth: core: use managed version of led_trigger_register in LED trigger
Date: Mon, 25 Jan 2016 20:46:21 +0100	[thread overview]
Message-ID: <56A67B8D.2010501@gmail.com> (raw)

Recently a managed version of led_trigger_register was introduced.
Using devm_led_trigger_register allows to simplify the LED trigger code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 net/bluetooth/hci_core.c | 2 --
 net/bluetooth/leds.c     | 8 +-------
 net/bluetooth/leds.h     | 2 --
 3 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 06f603a..541760f 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3134,8 +3134,6 @@ void hci_unregister_dev(struct hci_dev *hdev)
 
 	id = hdev->id;
 
-	hci_leds_exit(hdev);
-
 	write_lock(&hci_dev_list_lock);
 	list_del(&hdev->list);
 	write_unlock(&hci_dev_list_lock);
diff --git a/net/bluetooth/leds.c b/net/bluetooth/leds.c
index ded7c88..8319c84 100644
--- a/net/bluetooth/leds.c
+++ b/net/bluetooth/leds.c
@@ -55,7 +55,7 @@ static struct led_trigger *led_allocate_basic(struct hci_dev *hdev,
 	if (!htrig->led_trigger.name)
 		goto err_alloc;
 
-	if (led_trigger_register(&htrig->led_trigger))
+	if (devm_led_trigger_register(&hdev->dev, &htrig->led_trigger))
 		goto err_register;
 
 	return &htrig->led_trigger;
@@ -72,9 +72,3 @@ void hci_leds_init(struct hci_dev *hdev)
 	/* initialize power_led */
 	hdev->power_led = led_allocate_basic(hdev, power_activate, "power");
 }
-
-void hci_leds_exit(struct hci_dev *hdev)
-{
-	if (hdev->power_led)
-		led_trigger_unregister(hdev->power_led);
-}
diff --git a/net/bluetooth/leds.h b/net/bluetooth/leds.h
index 068261a..a9c4d6e 100644
--- a/net/bluetooth/leds.h
+++ b/net/bluetooth/leds.h
@@ -9,10 +9,8 @@
 #if IS_ENABLED(CONFIG_BT_LEDS)
 void hci_leds_update_powered(struct hci_dev *hdev, bool enabled);
 void hci_leds_init(struct hci_dev *hdev);
-void hci_leds_exit(struct hci_dev *hdev);
 #else
 static inline void hci_leds_update_powered(struct hci_dev *hdev,
 					   bool enabled) {}
 static inline void hci_leds_init(struct hci_dev *hdev) {}
-static inline void hci_leds_exit(struct hci_dev *hdev) {}
 #endif
-- 
2.7.0

             reply	other threads:[~2016-01-25 19:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-25 19:46 Heiner Kallweit [this message]
2016-01-29 11:10 ` [PATCH] bluetooth: core: use managed version of led_trigger_register in LED trigger Marcel Holtmann

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=56A67B8D.2010501@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.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 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.