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: 8276921 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2E9059F38B for ; Thu, 11 Feb 2016 07:30:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C77BC20395 for ; Thu, 11 Feb 2016 07:30:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9C9DA202B8 for ; Thu, 11 Feb 2016 07:30:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751817AbcBKHae (ORCPT ); Thu, 11 Feb 2016 02:30:34 -0500 Received: from lb3-smtp-cloud2.xs4all.net ([194.109.24.29]:48635 "EHLO lb3-smtp-cloud2.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750905AbcBKHad (ORCPT ); Thu, 11 Feb 2016 02:30:33 -0500 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> Cc: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-input@vger.kernel.org, lars@opdenkamp.eu, linux@arm.linux.org.uk, Hans Verkuil 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> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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); }