Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp5301455imm; Tue, 26 Jun 2018 09:01:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeAc1lDDAe77gxBweZL0hQ7uMYu6Z4YZvcv58dRROPz8n+6xrwmf6bMJMVovVNmhwFTPu2I X-Received: by 2002:a62:6f86:: with SMTP id k128-v6mr2179446pfc.150.1530028871781; Tue, 26 Jun 2018 09:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530028871; cv=none; d=google.com; s=arc-20160816; b=hM2QDT7p/JQAo4aTuECzJdKMNYqmM/uwEiyMuEsAwjECm3hAb1dqbmAbQkC0aFRV2h /bGlbEgyci+q1D4BXEg03mZAvFpQIrY5vAp6s6s0CzrBtrNFWjKkbAC7OLizr2yE38bV xGNQ55f6DSAtAr9lIqX112516T+qoLfoUMeE88kM0lVLUVe5aA3CmbRvZdejC2+866iX n8gawBSVMTQEMGTk2td5pwpKm27Aa+zOxPk18qikGyn1FZDUErF2yvBrDdx+a8/Bm0C6 LXrJV6e3S3e9BvqW9oFD/VnGsVKFC/q/RU75oWGnxF2IX+EtEa/Z/pGTtYmgqJWUeuNp WlYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=0nVajqu6Vff9Ql4V+MjWVuUOg8A5uuwzfYXxIlAX7Yk=; b=fHkgIcJrpCMMHJNa+n8nKfjVaF81SGbPFWU+yqmlyXse7A8KkKeiXr7uo6JBZSlOE8 JhOyP3OKnDLKniwvH99Zp8H1imrGeKTBrnZrV3natDmCdL8+f5ORTx74U5mtXGgEUmH5 6R1cUMpZ7jJzWs72QmLvBNcWT3i7edsfyQSPBy0nyosPqOwDYcpXKfZhng38TdjmYcwA uLeQqnGIZvuSVDPsrvExHgd0rie0rXJLOu7juDqi0/350DyhyFo/8qKDFEfmOdmF8k8z aLuLhSSFnwWqvqfxSDxsyp/4kdrAnaunMGzrVXd8prtuEaKl8UrOD5rL9nmpH3gni0/v R4cQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t5-v6si1842179plo.113.2018.06.26.09.00.55; Tue, 26 Jun 2018 09:01:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965697AbeFZNzn (ORCPT + 99 others); Tue, 26 Jun 2018 09:55:43 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:57970 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965621AbeFZNzl (ORCPT ); Tue, 26 Jun 2018 09:55:41 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 99E874075797; Tue, 26 Jun 2018 13:55:40 +0000 (UTC) Received: from shalem.localdomain.com (ovpn-116-227.ams2.redhat.com [10.36.116.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7956F2156880; Tue, 26 Jun 2018 13:55:39 +0000 (UTC) From: Hans de Goede To: Bartlomiej Zolnierkiewicz , Petr Mladek , Sergey Senozhatsky Cc: Hans de Goede , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Steven Rostedt , linux-kernel@vger.kernel.org Subject: [PATCH v3 2/3] fbcon: Call WARN_CONSOLE_UNLOCKED() where applicable Date: Tue, 26 Jun 2018 15:55:34 +0200 Message-Id: <20180626135535.2990-3-hdegoede@redhat.com> In-Reply-To: <20180626135535.2990-1-hdegoede@redhat.com> References: <20180626135535.2990-1-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 26 Jun 2018 13:55:40 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 26 Jun 2018 13:55:40 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'hdegoede@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace comments about places where the console lock should be held with calls to WARN_CONSOLE_UNLOCKED() to assert that it is actually held. Signed-off-by: Hans de Goede --- Changes in v3: -New patch in v3 of this patchset --- drivers/video/fbdev/core/fbcon.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index c910e74d46ff..ac2cbdf710ee 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -817,8 +817,6 @@ static void con2fb_init_display(struct vc_data *vc, struct fb_info *info, * * Maps a virtual console @unit to a frame buffer device * @newidx. - * - * This should be called with the console lock held. */ static int set_con2fb_map(int unit, int newidx, int user) { @@ -828,6 +826,8 @@ static int set_con2fb_map(int unit, int newidx, int user) struct fb_info *oldinfo = NULL; int found, err = 0; + WARN_CONSOLE_UNLOCKED(); + if (oldidx == newidx) return 0; @@ -3039,11 +3039,12 @@ static inline int fbcon_unbind(void) } #endif /* CONFIG_VT_HW_CONSOLE_BINDING */ -/* called with console_lock held */ static int fbcon_fb_unbind(int idx) { int i, new_idx = -1, ret = 0; + WARN_CONSOLE_UNLOCKED(); + if (!fbcon_has_console_bind) return 0; @@ -3089,11 +3090,12 @@ static int fbcon_fb_unbind(int idx) return ret; } -/* called with console_lock held */ static int fbcon_fb_unregistered(struct fb_info *info) { int i, idx; + WARN_CONSOLE_UNLOCKED(); + idx = info->node; for (i = first_fb_vc; i <= last_fb_vc; i++) { if (con2fb_map[i] == idx) @@ -3127,10 +3129,12 @@ static int fbcon_fb_unregistered(struct fb_info *info) return 0; } -/* called with console_lock held */ static void fbcon_remap_all(int idx) { int i; + + WARN_CONSOLE_UNLOCKED(); + for (i = first_fb_vc; i <= last_fb_vc; i++) set_con2fb_map(i, idx, 0); @@ -3172,11 +3176,12 @@ static inline void fbcon_select_primary(struct fb_info *info) } #endif /* CONFIG_FRAMEBUFFER_DETECT_PRIMARY */ -/* called with console_lock held */ static int fbcon_fb_registered(struct fb_info *info) { int ret = 0, i, idx; + WARN_CONSOLE_UNLOCKED(); + idx = info->node; fbcon_select_primary(info); @@ -3325,7 +3330,6 @@ static int fbcon_event_notify(struct notifier_block *self, ret = fbcon_fb_unregistered(info); break; case FB_EVENT_SET_CONSOLE_MAP: - /* called with console lock held */ con2fb = event->data; ret = set_con2fb_map(con2fb->console - 1, con2fb->framebuffer, 1); -- 2.17.1