From patchwork Wed Jul 22 20:55:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?RGF2aWQgSMODwqRyZGVtYW4=?= X-Patchwork-Id: 6846731 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9E7CEC05AC for ; Wed, 22 Jul 2015 20:55:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C81F120670 for ; Wed, 22 Jul 2015 20:55:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 98EFB20570 for ; Wed, 22 Jul 2015 20:55:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752828AbbGVUz2 (ORCPT ); Wed, 22 Jul 2015 16:55:28 -0400 Received: from vader.hardeman.nu ([95.142.160.32]:52669 "EHLO hardeman.nu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752024AbbGVUz1 (ORCPT ); Wed, 22 Jul 2015 16:55:27 -0400 Received: from zeus.hardeman.nu (ppp-93-104-101-11.dynamic.mnet-online.de [93.104.101.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by vader.hardeman.nu (Postfix) with ESMTPSA id A420B5B5; Wed, 22 Jul 2015 22:55:25 +0200 (CEST) Received: by zeus.hardeman.nu (Postfix, from userid 1000) id 03B633282CB7; Wed, 22 Jul 2015 22:55:24 +0200 (CEST) Subject: [PATCH] rc-core: improve the lirc protocol reporting From: David =?utf-8?b?SMOkcmRlbWFu?= To: linux-media@vger.kernel.org Cc: m.chehab@samsung.com Date: Wed, 22 Jul 2015 22:55:24 +0200 Message-ID: <20150722205524.1907.37521.stgit@zeus.muc.hardeman.nu> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/media/rc/rc-main.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index ecaee02..3f0f71a 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 @@ -882,7 +899,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)