Skip to content

Commit

Permalink
[media] rc-core: improve the lirc protocol reporting
Browse files Browse the repository at this point in the history
Commit 275ddb4 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>
  • Loading branch information
David Härdeman authored and Mauro Carvalho Chehab committed Aug 11, 2015
1 parent f103a9c commit dd6ff6a
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion drivers/media/rc/rc-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit dd6ff6a

Please sign in to comment.