All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bluez v2 1/2] plugin: handle ENOSYS as not-supported
@ 2013-10-02 15:57 David Herrmann
  2013-10-02 15:57 ` [PATCH bluez v2 2/2] bnep: improve error-msg if bnep.ko is not loaded David Herrmann
  2013-10-03  6:56 ` [PATCH bluez v2 1/2] plugin: handle ENOSYS as not-supported Johan Hedberg
  0 siblings, 2 replies; 3+ messages in thread
From: David Herrmann @ 2013-10-02 15:57 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Marcel Holtmann, Johan Hedberg, David Herrmann

Allow plugins to return -ENOSYS during registration and handle it as
"not-supported" error. It makes the error messages slightly more useful in
case kernel-support is missing for a particular subsystem.
---
 src/plugin.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/plugin.c b/src/plugin.c
index 51c98bc..9c3225e 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -119,6 +119,7 @@ gboolean plugin_init(const char *enable, const char *disable)
 	const char *file;
 	char **cli_disabled, **cli_enabled;
 	unsigned int i;
+	int err;
 
 	/* Make a call to BtIO API so its symbols got resolved before the
 	 * plugins are loaded. */
@@ -196,8 +197,14 @@ start:
 	for (list = plugins; list; list = list->next) {
 		struct bluetooth_plugin *plugin = list->data;
 
-		if (plugin->desc->init() < 0) {
-			error("Failed to init %s plugin", plugin->desc->name);
+		err = plugin->desc->init();
+		if (err < 0) {
+			if (err == -ENOSYS)
+				warn("System does not support %s plugin",
+							plugin->desc->name);
+			else
+				error("Failed to init %s plugin",
+							plugin->desc->name);
 			continue;
 		}
 
-- 
1.8.4

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

end of thread, other threads:[~2013-10-03  6:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-02 15:57 [PATCH bluez v2 1/2] plugin: handle ENOSYS as not-supported David Herrmann
2013-10-02 15:57 ` [PATCH bluez v2 2/2] bnep: improve error-msg if bnep.ko is not loaded David Herrmann
2013-10-03  6:56 ` [PATCH bluez v2 1/2] plugin: handle ENOSYS as not-supported Johan Hedberg

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.