From patchwork Thu Feb 11 07:30:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 8276911 Return-Path: X-Original-To: patchwork-dri-devel@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 DA76DBEEE5 for ; Thu, 11 Feb 2016 07:30:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C369920376 for ; Thu, 11 Feb 2016 07:30:36 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 6370620270 for ; Thu, 11 Feb 2016 07:30:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9C4266E7C9; Wed, 10 Feb 2016 23:30:34 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lb1-smtp-cloud2.xs4all.net (lb1-smtp-cloud2.xs4all.net [194.109.24.21]) by gabe.freedesktop.org (Postfix) with ESMTPS id B90EB6E7C9 for ; Wed, 10 Feb 2016 23:30:33 -0800 (PST) Received: from tschai.lan ([90.149.38.145]) by smtp-cloud2.xs4all.net with ESMTP id GvWT1s00C37uBN201vWW0Q; Thu, 11 Feb 2016 08:30:31 +0100 Received: from [127.0.0.1] (localhost [127.0.0.1]) by tschai.lan (Postfix) with ESMTPSA id 63C79180E9A; Thu, 11 Feb 2016 08:30:27 +0100 (CET) Subject: [PATCHv12 18/17] cec: check for RC_CORE support To: linux-media@vger.kernel.org References: <1455108711-29850-1-git-send-email-hverkuil@xs4all.nl> <1455108711-29850-18-git-send-email-hverkuil@xs4all.nl> From: Hans Verkuil Message-ID: <56BC3893.10208@xs4all.nl> Date: Thu, 11 Feb 2016 08:30:27 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.5.0 MIME-Version: 1.0 In-Reply-To: <1455108711-29850-18-git-send-email-hverkuil@xs4all.nl> Cc: linux-samsung-soc@vger.kernel.org, linux@arm.linux.org.uk, dri-devel@lists.freedesktop.org, lars@opdenkamp.eu, Hans Verkuil , linux-input@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 If CONFIG_RC_CORE is not enabled, then remove the rc support, otherwise the module won't link. This will be folded into patch 07/17 for the final pull request. Signed-off-by: Hans Verkuil --- drivers/media/Kconfig | 2 -- drivers/media/cec.c | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index 4f7fd52..ef8192e 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig @@ -82,8 +82,6 @@ config MEDIA_RC_SUPPORT config MEDIA_CEC tristate "CEC API (EXPERIMENTAL)" - depends on MEDIA_RC_SUPPORT - select RC_CORE ---help--- Enable the CEC API. diff --git a/drivers/media/cec.c b/drivers/media/cec.c index a14ac73..e9fa698 100644 --- a/drivers/media/cec.c +++ b/drivers/media/cec.c @@ -744,6 +744,7 @@ static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg, if (!(adap->capabilities & CEC_CAP_RC)) break; +#if IS_ENABLED(CONFIG_RC_CORE) switch (msg->msg[2]) { /* * Play function, this message can have variable length @@ -773,12 +774,15 @@ static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg, rc_keydown(adap->rc, RC_TYPE_CEC, msg->msg[2], 0); break; } +#endif break; case CEC_MSG_USER_CONTROL_RELEASED: if (!(adap->capabilities & CEC_CAP_RC)) break; +#if IS_ENABLED(CONFIG_RC_CORE) rc_keyup(adap->rc); +#endif break; /* @@ -2059,6 +2063,7 @@ struct cec_adapter *cec_create_adapter(const struct cec_adap_ops *ops, if (!(caps & CEC_CAP_RC)) return adap; +#if IS_ENABLED(CONFIG_RC_CORE) /* Prepare the RC input device */ adap->rc = rc_allocate_device(); if (!adap->rc) { @@ -2089,6 +2094,9 @@ struct cec_adapter *cec_create_adapter(const struct cec_adap_ops *ops, adap->rc->priv = adap; adap->rc->map_name = RC_MAP_CEC; adap->rc->timeout = MS_TO_NS(100); +#else + adap->capabilities &= ~CEC_CAP_RC; +#endif return adap; } EXPORT_SYMBOL_GPL(cec_create_adapter); @@ -2097,6 +2105,7 @@ int cec_register_adapter(struct cec_adapter *adap) { int res; +#if IS_ENABLED(CONFIG_RC_CORE) if (adap->capabilities & CEC_CAP_RC) { res = rc_register_device(adap->rc); @@ -2108,13 +2117,16 @@ int cec_register_adapter(struct cec_adapter *adap) return res; } } +#endif res = cec_devnode_register(&adap->devnode, adap->owner); +#if IS_ENABLED(CONFIG_RC_CORE) if (res) { /* Note: rc_unregister also calls rc_free */ rc_unregister_device(adap->rc); adap->rc = NULL; } +#endif return res; } EXPORT_SYMBOL_GPL(cec_register_adapter); @@ -2123,9 +2135,11 @@ void cec_unregister_adapter(struct cec_adapter *adap) { if (IS_ERR_OR_NULL(adap)) return; +#if IS_ENABLED(CONFIG_RC_CORE) /* Note: rc_unregister also calls rc_free */ rc_unregister_device(adap->rc); adap->rc = NULL; +#endif cec_devnode_unregister(&adap->devnode); } EXPORT_SYMBOL_GPL(cec_unregister_adapter); @@ -2139,8 +2153,10 @@ void cec_delete_adapter(struct cec_adapter *adap) kthread_stop(adap->kthread_config); if (adap->is_enabled) cec_enable(adap, false); +#if IS_ENABLED(CONFIG_RC_CORE) if (adap->rc) rc_free_device(adap->rc); +#endif kfree(adap->name); kfree(adap); }