All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: linux-media@vger.kernel.org
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 <hans.verkuil@cisco.com>
Subject: [PATCHv12 18/17] cec: check for RC_CORE support
Date: Thu, 11 Feb 2016 08:30:27 +0100	[thread overview]
Message-ID: <56BC3893.10208@xs4all.nl> (raw)
In-Reply-To: <1455108711-29850-18-git-send-email-hverkuil@xs4all.nl>

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 <hans.verkuil@cisco.com>
---
 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);
 }
-- 
2.7.0



      reply	other threads:[~2016-02-11  7:30 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-10 12:51 [PATCHv12 00/17] HDMI CEC framework Hans Verkuil
2016-02-10 12:51 ` [PATCHv12 01/17] dts: exynos4*: add HDMI CEC pin definition to pinctrl Hans Verkuil
2016-02-10 12:51 ` [PATCHv12 02/17] dts: exynos4: add node for the HDMI CEC device Hans Verkuil
2016-02-10 12:51 ` [PATCHv12 03/17] dts: exynos4412-odroid*: enable " Hans Verkuil
2016-02-10 12:51   ` Hans Verkuil
2016-02-10 12:51 ` [PATCHv12 04/17] input.h: add BUS_CEC type Hans Verkuil
2016-02-10 12:51 ` [PATCHv12 05/17] HID: add HDMI CEC specific keycodes Hans Verkuil
2016-02-10 12:51   ` Hans Verkuil
2016-02-12  9:27   ` Hans Verkuil
2016-02-24  8:31     ` Hans Verkuil
2016-03-04 12:27       ` Hans Verkuil
2016-03-04 19:58   ` Dmitry Torokhov
2016-03-05  8:44     ` Hans Verkuil
2016-03-05 17:50       ` Dmitry Torokhov
2016-02-10 12:51 ` [PATCHv12 06/17] rc: Add HDMI CEC protocol handling Hans Verkuil
2016-02-10 12:51   ` Hans Verkuil
2016-02-10 12:51 ` [PATCHv12 07/17] cec: add HDMI CEC framework Hans Verkuil
2016-02-10 12:51   ` Hans Verkuil
2016-02-10 12:51 ` [PATCHv12 08/17] cec: add compat32 ioctl support Hans Verkuil
2016-02-10 12:51   ` Hans Verkuil
2016-02-10 12:51 ` [PATCHv12 09/17] cec.txt: add CEC framework documentation Hans Verkuil
2016-02-10 12:51   ` Hans Verkuil
2016-02-10 12:51 ` [PATCHv12 10/17] DocBook/media: add CEC documentation Hans Verkuil
2016-02-10 12:51 ` [PATCHv12 11/17] v4l2-subdev: add HDMI CEC ops Hans Verkuil
2016-02-10 12:51 ` [PATCHv12 12/17] cec: adv7604: add cec support Hans Verkuil
2016-02-10 12:51 ` [PATCHv12 13/17] cec: adv7842: " Hans Verkuil
2016-02-10 12:51   ` Hans Verkuil
2016-02-10 12:51 ` [PATCHv12 14/17] cec: adv7511: " Hans Verkuil
2016-02-10 12:51 ` [PATCHv12 15/17] cobalt: " Hans Verkuil
2016-02-10 12:51   ` Hans Verkuil
2016-02-10 12:51 ` [PATCHv12 16/17] cec: s5p-cec: Add s5p-cec driver Hans Verkuil
2016-02-10 12:51   ` Hans Verkuil
2016-02-10 12:51 ` [PATCHv12 17/17] vivid: add CEC emulation Hans Verkuil
2016-02-10 12:51   ` Hans Verkuil
2016-02-11  7:30   ` Hans Verkuil [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56BC3893.10208@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hans.verkuil@cisco.com \
    --cc=lars@opdenkamp.eu \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.