Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3519888pxf; Mon, 15 Mar 2021 11:22:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzr3qcDp+0o1O9zrZ+I6sZj0x7tw0pQtzoujD5XO7rS1xCaOsXUlSSFe7WTSl3n1rIYVd/m X-Received: by 2002:a17:906:719b:: with SMTP id h27mr24795179ejk.123.1615832527450; Mon, 15 Mar 2021 11:22:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832527; cv=none; d=google.com; s=arc-20160816; b=JUjWtRxE9NaCEIyYrGlQGClu39R6ay4Kt29hfneb1K2RPCLTQpbVZC20fSR4T+iv7k sQhHRwlhDibAV69cW3OrSZJ52FJ/A2Tbx0HQ4i72R5cxogGvUD24crZqHTv8teH5a3Zs 8+0BAqfYJ8X0TEdlvhfpUmp8qXKHC5D+74p/3fumy0Pb+GyLsIEeWo3qiY3CAIKYUzeu 9cnuPKvf3oMxRN6b/4wHk6scY2NrSeaUY11keYz4u0q8pyQo1+k9UZeKumzogdvIv0Cq L1o+b/QGdZnUl/lXT/XB/ktEHV1AwAAR+XpyTUvLY7kQ+VY6qJOdJ9VfBnyUA8Y45jI9 qR6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JPnOt8AgqJvbdeRES+fGMRdJIB5QnWwVfdOO3wrFZhw=; b=CYipf9NL9gNm+IpS6jO7MTs1C+86ZXdeSA/WeZRooXk8bGMs8OfamWSabYqwmlNpz+ /fpIwT1qyEZHQJthUGEnm7yQpoVMlb/jyua5ZtCYKeym7qwBRpoy5fcL7+KJJ0FNjAOH 3xb1e64lpeJfxuzbPadGs8etoYLXyxbuLzgB0/RXKRS42Gb6iGlAqjO1ZbfoeksGICMc zGQ4sdKmx2IQ8MgRRfdQYjoPf5eSHAylGRkoPS0regonxOO7F6BIGkqY2Z/h0lRfZJfW STBRqfhBtyd6/tSzGzIyIpHQlY+x0ZAkmzLeNqJTe7gvnov5AUAyJIx9ik6zlgGhTsid icQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TdYJdIfL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f20si11699214edr.318.2021.03.15.11.21.45; Mon, 15 Mar 2021 11:22:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TdYJdIfL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233605AbhCOOVG (ORCPT + 99 others); Mon, 15 Mar 2021 10:21:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:35610 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232803AbhCON75 (ORCPT ); Mon, 15 Mar 2021 09:59:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F2A5D64F27; Mon, 15 Mar 2021 13:59:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816779; bh=SmkaahNmjuMD/+bb5iHDas9E0xh7WN3DAKY9tEEcZ9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TdYJdIfLpXhvVEbPnTVkQ/k1Oc3ldG/uMdRGonHG6Qdch/LOjT075To4CKEc2IbDv p3xzuEpv3swYqqzLj+y694JJexO0XCWipvLI05j6s8EZcE3S7vyJE/eF2/ttQLTfCA cvzOCgjsVPhCL6zchOYOqFDdyhV04xAzpiYcqM1I= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans Verkuil , Hans de Goede , Sean Young , Mauro Carvalho Chehab Subject: [PATCH 5.11 120/306] media: rc: compile rc-cec.c into rc-core Date: Mon, 15 Mar 2021 14:53:03 +0100 Message-Id: <20210315135511.715374231@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Hans Verkuil commit f09f9f93afad770a04b35235a0aa465fcc8d6e3d upstream. The rc-cec keymap is unusual in that it can't be built as a module, instead it is registered directly in rc-main.c if CONFIG_MEDIA_CEC_RC is set. This is because it can be called from drm_dp_cec_set_edid() via cec_register_adapter() in an asynchronous context, and it is not allowed to use request_module() to load rc-cec.ko in that case. Trying to do so results in a 'WARN_ON_ONCE(wait && current_is_async())'. Since this keymap is only used if CONFIG_MEDIA_CEC_RC is set, we just compile this keymap into the rc-core module and never as a separate module. Signed-off-by: Hans Verkuil Fixes: 2c6d1fffa1d9 (drm: add support for DisplayPort CEC-Tunneling-over-AUX) Reported-by: Hans de Goede Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/rc/Makefile | 1 + drivers/media/rc/keymaps/Makefile | 1 - drivers/media/rc/keymaps/rc-cec.c | 28 +++++++++++----------------- drivers/media/rc/rc-main.c | 6 ++++++ include/media/rc-map.h | 7 +++++++ 5 files changed, 25 insertions(+), 18 deletions(-) --- a/drivers/media/rc/Makefile +++ b/drivers/media/rc/Makefile @@ -5,6 +5,7 @@ obj-y += keymaps/ obj-$(CONFIG_RC_CORE) += rc-core.o rc-core-y := rc-main.o rc-ir-raw.o rc-core-$(CONFIG_LIRC) += lirc_dev.o +rc-core-$(CONFIG_MEDIA_CEC_RC) += keymaps/rc-cec.o rc-core-$(CONFIG_BPF_LIRC_MODE2) += bpf-lirc.o obj-$(CONFIG_IR_NEC_DECODER) += ir-nec-decoder.o obj-$(CONFIG_IR_RC5_DECODER) += ir-rc5-decoder.o --- a/drivers/media/rc/keymaps/Makefile +++ b/drivers/media/rc/keymaps/Makefile @@ -21,7 +21,6 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t rc-behold.o \ rc-behold-columbus.o \ rc-budget-ci-old.o \ - rc-cec.o \ rc-cinergy-1400.o \ rc-cinergy.o \ rc-d680-dmb.o \ --- a/drivers/media/rc/keymaps/rc-cec.c +++ b/drivers/media/rc/keymaps/rc-cec.c @@ -1,6 +1,16 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* Keytable for the CEC remote control * + * This keymap is unusual in that it can't be built as a module, + * instead it is registered directly in rc-main.c if CONFIG_MEDIA_CEC_RC + * is set. This is because it can be called from drm_dp_cec_set_edid() via + * cec_register_adapter() in an asynchronous context, and it is not + * allowed to use request_module() to load rc-cec.ko in that case. + * + * Since this keymap is only used if CONFIG_MEDIA_CEC_RC is set, we + * just compile this keymap into the rc-core module and never as a + * separate module. + * * Copyright (c) 2015 by Kamil Debski */ @@ -152,7 +162,7 @@ static struct rc_map_table cec[] = { /* 0x77-0xff: Reserved */ }; -static struct rc_map_list cec_map = { +struct rc_map_list cec_map = { .map = { .scan = cec, .size = ARRAY_SIZE(cec), @@ -160,19 +170,3 @@ static struct rc_map_list cec_map = { .name = RC_MAP_CEC, } }; - -static int __init init_rc_map_cec(void) -{ - return rc_map_register(&cec_map); -} - -static void __exit exit_rc_map_cec(void) -{ - rc_map_unregister(&cec_map); -} - -module_init(init_rc_map_cec); -module_exit(exit_rc_map_cec); - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Kamil Debski"); --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -2069,6 +2069,9 @@ static int __init rc_core_init(void) led_trigger_register_simple("rc-feedback", &led_feedback); rc_map_register(&empty_map); +#ifdef CONFIG_MEDIA_CEC_RC + rc_map_register(&cec_map); +#endif return 0; } @@ -2078,6 +2081,9 @@ static void __exit rc_core_exit(void) lirc_dev_exit(); class_unregister(&rc_class); led_trigger_unregister_simple(led_feedback); +#ifdef CONFIG_MEDIA_CEC_RC + rc_map_unregister(&cec_map); +#endif rc_map_unregister(&empty_map); } --- a/include/media/rc-map.h +++ b/include/media/rc-map.h @@ -175,6 +175,13 @@ struct rc_map_list { struct rc_map map; }; +#ifdef CONFIG_MEDIA_CEC_RC +/* + * rc_map_list from rc-cec.c + */ +extern struct rc_map_list cec_map; +#endif + /* Routines from rc-map.c */ /**