summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2015-07-22 22:55:24 +0200
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-08-11 18:18:13 +0200
commitdd6ff6a05b3d467acff47131759e15d40933656c (patch)
tree0eee9c4578cfc8ea629e6e500f093b8d9f1e6211 /drivers/media
parent[media] staging: Drop owner assignment from i2c_driver (diff)
downloadlinux-dd6ff6a05b3d467acff47131759e15d40933656c.tar.xz
linux-dd6ff6a05b3d467acff47131759e15d40933656c.zip
[media] rc-core: improve the lirc protocol reporting
Commit 275ddb40bcf686d210d86c6718e42425a6a0bc76 removed the lirc "protocol" but kept backwards compatibility by always listing the protocol as present and enabled. This patch further improves the logic by only listing the protocol if the lirc module is loaded (or if lirc is builtin). Signed-off-by: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/rc/rc-main.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index c80816561181..d08cedb03c74 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -828,6 +828,23 @@ struct rc_filter_attribute {
.mask = (_mask), \
}
+static bool lirc_is_present(void)
+{
+#if defined(CONFIG_LIRC_MODULE)
+ struct module *lirc;
+
+ mutex_lock(&module_mutex);
+ lirc = find_module("lirc_dev");
+ mutex_unlock(&module_mutex);
+
+ return lirc ? true : false;
+#elif defined(CONFIG_LIRC)
+ return true;
+#else
+ return false;
+#endif
+}
+
/**
* show_protocols() - shows the current/wakeup IR protocol(s)
* @device: the device descriptor
@@ -884,7 +901,7 @@ static ssize_t show_protocols(struct device *device,
allowed &= ~proto_names[i].type;
}
- if (dev->driver_type == RC_DRIVER_IR_RAW)
+ if (dev->driver_type == RC_DRIVER_IR_RAW && lirc_is_present())
tmp += sprintf(tmp, "[lirc] ");
if (tmp != buf)