From patchwork Mon May 20 08:21:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950349 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 81E35912 for ; Mon, 20 May 2019 08:22:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7488228698 for ; Mon, 20 May 2019 08:22:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 682722873B; Mon, 20 May 2019 08:22:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1CB39286B2 for ; Mon, 20 May 2019 08:22:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AE89C8925D; Mon, 20 May 2019 08:22:26 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9A25B89255 for ; Mon, 20 May 2019 08:22:25 +0000 (UTC) Received: by mail-ed1-x542.google.com with SMTP id w11so22519380edl.5 for ; Mon, 20 May 2019 01:22:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SbM4kkl5EWVc1Lud+LN0uVoCMIXyfC33Tfm6rZ3mnEI=; b=Jnyv7SD758KplV1AamRgLFDkLa85ctrpLIDOc64FA6AdGZYdSC1doM3n8npN5hdA+y 3j8iwPuMdqG6YtOE6jMOKciyMJSKI3L5xjPkV9f36T59kmL23OfpB9CWcrlA3Hoh2KUS CKYtX7lYOueEEGCGinfh9leDMu/YP1wpvukwQij7/i+TUPu1t3bJsODvAKAS6Qzw/g7z GQPuKfya+P98psvDRy4G9YcpWhNML+BLDmbea6zi1+cDXr+Bn03fHm4UyPqvVZh3GXxx MfFNJ9gjQ7zLnkqQ0f04HHjsFx/Oe0gjNmuCVstKlkpvzcw5x03KVRGXpjTIwxOuAmHT glpg== X-Gm-Message-State: APjAAAU/IDj/esu0xD4a1Be9zC3+q87t080EPSu+LBU/WCovGaQ/CNW6 NDSJAQfZsEAPVRYXgww5SL2WV/Xjwwk= X-Google-Smtp-Source: APXvYqxqPql4lZWwJLVOFFGLuWmPeQWFMGasN2gXQcRCWWC75MWt4Ank1BJS5Y0nm96pOu/UVBpZqQ== X-Received: by 2002:a17:906:e0c5:: with SMTP id gl5mr57097610ejb.212.1558340543985; Mon, 20 May 2019 01:22:23 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:23 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 01/33] dummycon: Sprinkle locking checks Date: Mon, 20 May 2019 10:21:44 +0200 Message-Id: <20190520082216.26273-2-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SbM4kkl5EWVc1Lud+LN0uVoCMIXyfC33Tfm6rZ3mnEI=; b=SW60b7nIdATIPrwIWT9oaGpKEoAZHbdQlROc0UqUsAS10sCqELdn+dY7HDkmX5YTds yZ5phBYpFJyDH5V9PQPmkhmxB7CtZmaxADWsHNnsI9mYQppWf25NMEL5tGf9F4QVcodj 8X4ejWbghPqnUvuMd2Uq38ikh4YOZRHHgb8IY= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicolas Pitre , Kees Cook , Bartlomiej Zolnierkiewicz , Daniel Vetter , Intel Graphics Development , LKML , Hans de Goede , Greg Kroah-Hartman , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP As part of trying to understand the locking (or lack thereof) in the fbcon/vt/fbdev maze, annotate everything. Signed-off-by: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Hans de Goede Cc: Daniel Vetter Cc: Greg Kroah-Hartman Cc: Kees Cook Cc: Nicolas Pitre --- drivers/video/console/dummycon.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c index 45ad925ad5f8..2352b4c37826 100644 --- a/drivers/video/console/dummycon.c +++ b/drivers/video/console/dummycon.c @@ -33,6 +33,8 @@ static bool dummycon_putc_called; void dummycon_register_output_notifier(struct notifier_block *nb) { + WARN_CONSOLE_UNLOCKED(); + raw_notifier_chain_register(&dummycon_output_nh, nb); if (dummycon_putc_called) @@ -41,11 +43,15 @@ void dummycon_register_output_notifier(struct notifier_block *nb) void dummycon_unregister_output_notifier(struct notifier_block *nb) { + WARN_CONSOLE_UNLOCKED(); + raw_notifier_chain_unregister(&dummycon_output_nh, nb); } static void dummycon_putc(struct vc_data *vc, int c, int ypos, int xpos) { + WARN_CONSOLE_UNLOCKED(); + dummycon_putc_called = true; raw_notifier_call_chain(&dummycon_output_nh, 0, NULL); } From patchwork Mon May 20 08:21:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950355 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 078681395 for ; Mon, 20 May 2019 08:22:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF17B286AC for ; Mon, 20 May 2019 08:22:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E34862869D; Mon, 20 May 2019 08:22:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 731FF2873D for ; Mon, 20 May 2019 08:22:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6B97A89256; Mon, 20 May 2019 08:22:30 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id E2E1689258 for ; Mon, 20 May 2019 08:22:26 +0000 (UTC) Received: by mail-ed1-x543.google.com with SMTP id w11so22519436edl.5 for ; Mon, 20 May 2019 01:22:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=G+7lASPDHVp4K6Shi6AhuJ3vCu7cy9RDPQGFtgAVXYo=; b=P6zl4UUy46nmmva/2nVqatP9C2Tw3Z+Fs0Mj0IakaPt3xpF9issCxO9GfxuYE6kfpW BNyMPmNvhLK0n2x1H5QtAuK+RRwCLKvO4fjGWlU1nKeBGb2vxpxxQFGrnJf8T7r27HlS RSnNFjVWfQYBgC25APyNWbHpdozEFDo6i/jceFYFeBHfjltdMYGszrFQ0WWTIIVaD5lu jWuSKZAVwqSLIDWoXmjr54El0Il3Q0o7+rRAvKw7dKzE7ba1PTqUs1PjSEIfUvJQDt8J wpcfZe+HkvK+ELsxFJVeadw4XQnDXimQW1Azqq9sRsx/1uKvZ/j9mGCEEH3JcXSCK46I VWfA== X-Gm-Message-State: APjAAAV6cpH5Djw1ScUBlbrCQ/yh9rnIlsfLqI6eSrymXLrUbm8GLl7+ B11191gKdfXbpKDOg1ZBsaBLEiYhzqU= X-Google-Smtp-Source: APXvYqzH5cPNdv7MYAD+y/4MNq7TDcKB1eyAl64aeRO4GzFk1JnGrIJO/wyx6J/F/ggn0Pw2mY0qXA== X-Received: by 2002:a17:906:6603:: with SMTP id b3mr57042868ejp.128.1558340545071; Mon, 20 May 2019 01:22:25 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:24 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 02/33] fbdev: locking check for fb_set_suspend Date: Mon, 20 May 2019 10:21:45 +0200 Message-Id: <20190520082216.26273-3-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=G+7lASPDHVp4K6Shi6AhuJ3vCu7cy9RDPQGFtgAVXYo=; b=fdxIA47EdjdY0cAD59y+tCVIUFAcmt0tExaffadsAFlVmlZ8JqvFsP8koUpxE9wSpH k+EmmKz6vl+ykzYBeKPaQCP9IAnfqdF7RppIkaJCFu/UcmKLRSVP7teK6x0UwcvAxlkF FQf4alrfYArjUBDWAskQ29Ppbr4fa71rZV97s= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kees Cook , Bartlomiej Zolnierkiewicz , Manfred Schlaegl , Daniel Vetter , Intel Graphics Development , LKML , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Hans de Goede , Mikulas Patocka , Thomas Zimmermann , Daniel Vetter , Peter Rosin Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Just drive-by, nothing systematic yet. Signed-off-by: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: "Michał Mirosław" Cc: Peter Rosin Cc: Hans de Goede Cc: Thomas Zimmermann Cc: Manfred Schlaegl Cc: Mikulas Patocka Cc: Kees Cook --- drivers/video/fbdev/core/fbmem.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 4721491e6c8c..fc3d34a8ea5b 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1964,6 +1964,8 @@ void fb_set_suspend(struct fb_info *info, int state) { struct fb_event event; + WARN_CONSOLE_UNLOCKED(); + event.info = info; if (state) { fb_notifier_call_chain(FB_EVENT_SUSPEND, &event); From patchwork Mon May 20 08:21:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950359 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D6D57912 for ; Mon, 20 May 2019 08:22:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C89DC2873B for ; Mon, 20 May 2019 08:22:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C4D3828698; Mon, 20 May 2019 08:22:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CCFF328698 for ; Mon, 20 May 2019 08:22:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 039F489255; Mon, 20 May 2019 08:22:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1F06289257 for ; Mon, 20 May 2019 08:22:28 +0000 (UTC) Received: by mail-ed1-x541.google.com with SMTP id l25so22497730eda.9 for ; Mon, 20 May 2019 01:22:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mVMSkVkXVXoA7bd+CVw0neKzoieyYhVCa/oZdeVcz6s=; b=K9oR8KEDowMcgtRLtv3JwP6NBBAvg3baaprbCEQ9cbAr6Z+57VO+vjDxqJ27wdpHiZ qmcvSAMna9g/+HqrZYf9zPaNCrRgYxd01OeIgtOXwan4BV2dcGkypxFGUk0vHxFr8PrO pWAqZv1qsX/V/i1ZkENVEncdazyCfXc6mHq4l2oFt8QariG0rw9sSDKxtYqV8tzQkwQt Mh3Z5LOtAntg/KohEuub2kKGNCc3bnLWiLeJi77XQBUf96MK+aLnsEIZR0RDkS6wcVgX 9Dsu7lydKYzQzFnqTAOmqhHZrG/nLwm7P2KKTnTPiTZJqlYXPA/JCqWzQYO/uPcLM3s3 /B8w== X-Gm-Message-State: APjAAAU3sLOiZfg/7XhGo+y0yCqRmq5fnDdsh5+4+WJVhCWFTRlLN6So seYU/DcVhNfnOJAh9+wZ5hOX0NyZcv4= X-Google-Smtp-Source: APXvYqzgHYK7jVIgS4gfI7+Dv9xMQJnk2fhjsWys9x/6q7TmowQ0BrrlSYyon+rIUQknLGOfs4YtBw== X-Received: by 2002:a50:ba4f:: with SMTP id 15mr18344027eds.210.1558340546096; Mon, 20 May 2019 01:22:26 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:25 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 03/33] vt: might_sleep() annotation for do_blank_screen Date: Mon, 20 May 2019 10:21:46 +0200 Message-Id: <20190520082216.26273-4-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mVMSkVkXVXoA7bd+CVw0neKzoieyYhVCa/oZdeVcz6s=; b=Sa5zP3JT5hyfGQAExSIWnPbCd2RrgT54fuBK2oWIXdhjEzKYlwkv2mj33KHHgR9Tb1 OPZ84ScC4qk6uW/A2vVDIiq7WJFLyKaLezunk6D82VjXFVZkwLK6sw6PcT1GveLks2U6 hhkRii8j3WVTGHSloOOpdQQ+9gDCXElisP1DY= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicolas Pitre , Adam Borowski , Daniel Vetter , Intel Graphics Development , LKML , Martin Hostettler , Mikulas Patocka , Greg Kroah-Hartman , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP For symmetry reasons with do_unblank_screen, except without the oops_in_progress special case. Just a drive-by annotation while I'm trying to untangle the fbcon vs. fbdev screen blank/unblank maze. Signed-off-by: Daniel Vetter Cc: Greg Kroah-Hartman Cc: Nicolas Pitre Cc: Adam Borowski Cc: Martin Hostettler Cc: Daniel Vetter Cc: Mikulas Patocka --- drivers/tty/vt/vt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 650c66886c80..8b4b3a49ec33 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -4158,6 +4158,8 @@ void do_blank_screen(int entering_gfx) struct vc_data *vc = vc_cons[fg_console].d; int i; + might_sleep(); + WARN_CONSOLE_UNLOCKED(); if (console_blanked) { From patchwork Mon May 20 08:21:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950369 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0716F912 for ; Mon, 20 May 2019 08:22:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED4C62873D for ; Mon, 20 May 2019 08:22:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1B0D20134; Mon, 20 May 2019 08:22:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8D92F2873B for ; Mon, 20 May 2019 08:22:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 989F189248; Mon, 20 May 2019 08:22:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by gabe.freedesktop.org (Postfix) with ESMTPS id 26A0F89267 for ; Mon, 20 May 2019 08:22:29 +0000 (UTC) Received: by mail-ed1-x541.google.com with SMTP id p26so22580170edr.2 for ; Mon, 20 May 2019 01:22:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eGgrLKE2df25ULz21985aqzcbzro9NwOlgEwwTc5Zzc=; b=B8eMn/TSEjtUuQGeaZ6qiEc6Kk4AFVZtG1rPg36j65D6Ci73usafhYxiUMNSVtZPFy 5rD1MB2bdUYKwswDws/DCt7yhLZyENsy5SsmXEBmzzWRqmLD6ntMfqWwOrfYoMr+3Mge AsFRmdrukHHD6b+whJfEeE/YVjKAE9AMDc0SfXbD+vXqxoyypONKbwEipvkJhiVdlUED V4AMy/xcRHPmotEtEhS9wKecL+4/TqOiyKVlO5+SScyd/qyMb8lzyCehUkMgrl86I7lv UUudSovySqCGJbiS3n0wTrF8XLmTP/F6tydtdKEw7DwL36Y7YZoipYkTgHZO+wn16Xj4 Re7Q== X-Gm-Message-State: APjAAAWcWxTkPGftPyUxRX8bRh8Kv6YC6UbDz18ALcAW2BTsuac4H7OH nIEeq01vk2mWh0IGDGbJj7cARbmBP1o= X-Google-Smtp-Source: APXvYqx7YzC0MJ93NDDxrKOPv8V2UlfbQHlJo8bGF+j+Ew1CJ09B+PCH5y8spsqLQYD7mw+uuSgrTw== X-Received: by 2002:a17:906:a950:: with SMTP id hh16mr20399701ejb.136.1558340547229; Mon, 20 May 2019 01:22:27 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:26 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 04/33] vt: More locking checks Date: Mon, 20 May 2019 10:21:47 +0200 Message-Id: <20190520082216.26273-5-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eGgrLKE2df25ULz21985aqzcbzro9NwOlgEwwTc5Zzc=; b=imk5KPXbRHmyM+OGJsrvU50iu0pRYSH4CQqAEYUC50IR7Unb8WAmHx/5xDSKShl4Ms md2CbhXU/wCTBL9n61NPg+DXyNyuLx//HhKu7qBKwmA6U/dMwqcXtR/aG1FezRv5EDZk lLWq9pUMZUOD2LKJFQRnQCeul+IsxkHvQfMv8= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicolas Pitre , Adam Borowski , Daniel Vetter , Intel Graphics Development , LKML , Martin Hostettler , Mikulas Patocka , Greg Kroah-Hartman , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP I honestly have no idea what the subtle differences between con_is_visible, con_is_fg (internal to vt.c) and con_is_bound are. But it looks like both vc->vc_display_fg and con_driver_map are protected by the console_lock, so probably better if we hold that when checking this. To do that I had to deinline the con_is_visible function. Signed-off-by: Daniel Vetter Cc: Greg Kroah-Hartman Cc: Nicolas Pitre Cc: Martin Hostettler Cc: Adam Borowski Cc: Daniel Vetter Cc: Mikulas Patocka --- drivers/tty/vt/vt.c | 16 ++++++++++++++++ include/linux/console_struct.h | 5 +---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 8b4b3a49ec33..0ed234ac5a6b 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -3814,6 +3814,8 @@ int con_is_bound(const struct consw *csw) { int i, bound = 0; + WARN_CONSOLE_UNLOCKED(); + for (i = 0; i < MAX_NR_CONSOLES; i++) { if (con_driver_map[i] == csw) { bound = 1; @@ -3825,6 +3827,20 @@ int con_is_bound(const struct consw *csw) } EXPORT_SYMBOL(con_is_bound); +/** + * con_is_visible - checks whether the current console is visible + * @vc: virtual console + * + * RETURNS: zero if not visible, nonzero if visible + */ +bool con_is_visible(const struct vc_data *vc) +{ + WARN_CONSOLE_UNLOCKED(); + + return *vc->vc_display_fg == vc; +} +EXPORT_SYMBOL(con_is_visible); + /** * con_debug_enter - prepare the console for the kernel debugger * @sw: console driver diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h index ed798e114663..24d4c16e3ae0 100644 --- a/include/linux/console_struct.h +++ b/include/linux/console_struct.h @@ -168,9 +168,6 @@ extern void vc_SAK(struct work_struct *work); #define CUR_DEFAULT CUR_UNDERLINE -static inline bool con_is_visible(const struct vc_data *vc) -{ - return *vc->vc_display_fg == vc; -} +bool con_is_visible(const struct vc_data *vc); #endif /* _LINUX_CONSOLE_STRUCT_H */ From patchwork Mon May 20 08:21:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950385 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 46F58912 for ; Mon, 20 May 2019 08:23:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38684284A3 for ; Mon, 20 May 2019 08:23:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2CAB52862A; Mon, 20 May 2019 08:23:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E51A3286B2 for ; Mon, 20 May 2019 08:23:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 17B9C89259; Mon, 20 May 2019 08:22:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id 97D9D89247 for ; Mon, 20 May 2019 08:22:30 +0000 (UTC) Received: by mail-ed1-x544.google.com with SMTP id w37so22552140edw.4 for ; Mon, 20 May 2019 01:22:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4UC6980ATt6g2nqFDn2Bpgan2GTqp4ZZAGnr3VO2LjI=; b=ShFXqs5Pmem8DMxZmaWBUiJMTaqo0bRoiibSfwN2m3H/LwnbkQBfLWv2cXYob0YYZG jo8mbWAmCDmllZ4+GtDIsmXY0LsqGh64tKhapxqu+vXjXMyRzJb94sf9BDKm+mvtqQZA 6AdTNknN8Vhn0Miz21C86ulFdzCAG3G506COJqFZtISjd1nKT9iJhCR0xY8yEs2lgefr iYDRrmvXi8X0A8OfCQcO7BqSaRQyWoboHGtD9n/OA0eUipkb8ZnyV8rXAQn4+nWRzGZt ccn0gXvMQaURR9oqDswSSsnem+tlyuyZR7yQTU1fa02WG6SBxkM9Xazf6enC3BfWOc/b k+1g== X-Gm-Message-State: APjAAAU0jaoCZCjzVnHUWSCXJeta6cNHvZjLJcuEnSSnhV+uvz4PO0dv z2KIQeRmS6+sIens10rb8K+h/+J5Zn4= X-Google-Smtp-Source: APXvYqzDLu9/GndEePgiMrQ6/ujxXJCreTf5PlH4FgvtQmGS1mXtvAIi9EhfVpK0KKXgJ8vPKQxX3Q== X-Received: by 2002:a17:906:b741:: with SMTP id fx1mr5110659ejb.45.1558340548318; Mon, 20 May 2019 01:22:28 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:27 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 05/33] fbdev/sa1100fb: Remove dead code Date: Mon, 20 May 2019 10:21:48 +0200 Message-Id: <20190520082216.26273-6-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4UC6980ATt6g2nqFDn2Bpgan2GTqp4ZZAGnr3VO2LjI=; b=dAezrIqrBzbowSUT4bmjJHvFuoRDUot4TIt1DhCg1IdwLfIZ3foHIhAdtsVYqWZwkH LtfD6E9Lp7CdA0Ph5XoRHNGw3IYX/hRpt6SrjJ0o0ikqzT8aSMWH8VLcAZjH2VdaA0DA +zsohuUeum3CLs9yqrlxm9Bd+Anxdag2Obl88= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Intel Graphics Development , LKML , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Motivated because it contains a struct display, which is a fbcon internal data structure that I want to rename. It seems to have been formerly used in drivers, but that's very long time ago. Signed-off-by: Daniel Vetter Cc: Daniel Vetter --- drivers/video/fbdev/sa1100fb.c | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/drivers/video/fbdev/sa1100fb.c b/drivers/video/fbdev/sa1100fb.c index 15ae50063296..f7f8dee044b1 100644 --- a/drivers/video/fbdev/sa1100fb.c +++ b/drivers/video/fbdev/sa1100fb.c @@ -974,35 +974,10 @@ static void sa1100fb_task(struct work_struct *w) */ static unsigned int sa1100fb_min_dma_period(struct sa1100fb_info *fbi) { -#if 0 - unsigned int min_period = (unsigned int)-1; - int i; - - for (i = 0; i < MAX_NR_CONSOLES; i++) { - struct display *disp = &fb_display[i]; - unsigned int period; - - /* - * Do we own this display? - */ - if (disp->fb_info != &fbi->fb) - continue; - - /* - * Ok, calculate its DMA period - */ - period = sa1100fb_display_dma_period(&disp->var); - if (period < min_period) - min_period = period; - } - - return min_period; -#else /* * FIXME: we need to verify _all_ consoles. */ return sa1100fb_display_dma_period(&fbi->fb.var); -#endif } /* From patchwork Mon May 20 08:21:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950397 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7B17976 for ; Mon, 20 May 2019 08:23:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6ED872871F for ; Mon, 20 May 2019 08:23:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6338F2874C; Mon, 20 May 2019 08:23:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3085A2871F for ; Mon, 20 May 2019 08:23:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0869B8926A; Mon, 20 May 2019 08:22:39 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8592189258 for ; Mon, 20 May 2019 08:22:31 +0000 (UTC) Received: by mail-ed1-x543.google.com with SMTP id a8so22558873edx.3 for ; Mon, 20 May 2019 01:22:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yy90SY5/chDu3adwLkHoQhEeL0uOM1NOJmociVMUU4s=; b=aepXMg85t+zdVLv/zhLJjtlMR1JETW8UHy2q4D4pqzmzqGx/DXq7XNVvbs3z/TZDT4 hG0iGjSkLxXDnHtALjZfcuHKXhDt4m5HYjyEmuhbDAbpiaGOeRlRgkeMRUG796tRUxre zd8XuWvIUWr7DOB9+57C2L7s2Sgum3IaPno3soFntQ47yHijZzoFsFDx4cKEh5NEDEU3 F8hKCKj1fltO5NYuazWVYHqWSwxudENKqHs2C4vNbt1+jyXskDHYgnwCdtgc9QNo0k5B X86ix7JRNG0MXFr1aGB1Kd4sCGih/aHtj6Y9w8m+RvVqVahch+DIQTDA2AMMiwXLSL99 SyJw== X-Gm-Message-State: APjAAAVd5Yd1yuj1dMXBVe7Y4S4FD6GCsnYJYlkxMoEWtCw52RLlqcgc ezohFi40oFqqkZutuhXFvN0EzrnNw1U= X-Google-Smtp-Source: APXvYqxdWi1IjK9CrOPrKCYsIFhwO9cGwKSyfvFscq7wlo2HQm/gpu93fgQpMudhegtDzz3SNq4bcg== X-Received: by 2002:a50:ad18:: with SMTP id y24mr74100466edc.64.1558340549704; Mon, 20 May 2019 01:22:29 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:28 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 06/33] fbdev/cyber2000: Remove struct display Date: Mon, 20 May 2019 10:21:49 +0200 Message-Id: <20190520082216.26273-7-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yy90SY5/chDu3adwLkHoQhEeL0uOM1NOJmociVMUU4s=; b=Br4lGjx6AYOmC8birJ2u22FSo+1D2WHdSA9O7P/G/jGX+VR9ZzrMY5zOKWlSMg+Ekk U7S4K5dfKQHB99S8s5RnjHdJHlT5nyX5dtAmtsyHAEu9H79HKy9hUb5l02yVlqUVeu2L gQtPbGsCys6UMB9HaTvvsi7CVFRsYrnsCEO8I= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Intel Graphics Development , Russell King , LKML , Daniel Vetter , linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Entirely unused. Signed-off-by: Daniel Vetter Cc: Russell King Cc: linux-arm-kernel@lists.infradead.org --- drivers/video/fbdev/cyber2000fb.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/video/fbdev/cyber2000fb.c b/drivers/video/fbdev/cyber2000fb.c index 9a5751cb4e16..452ef07b3a06 100644 --- a/drivers/video/fbdev/cyber2000fb.c +++ b/drivers/video/fbdev/cyber2000fb.c @@ -61,7 +61,6 @@ struct cfb_info { struct fb_info fb; struct display_switch *dispsw; - struct display *display; unsigned char __iomem *region; unsigned char __iomem *regs; u_int id; From patchwork Mon May 20 08:21:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950373 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2E9C0912 for ; Mon, 20 May 2019 08:22:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F0961FF13 for ; Mon, 20 May 2019 08:22:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 137662869D; Mon, 20 May 2019 08:22:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AE52C286AE for ; Mon, 20 May 2019 08:22:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 37B6F89258; Mon, 20 May 2019 08:22:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id 59A0589267 for ; Mon, 20 May 2019 08:22:33 +0000 (UTC) Received: by mail-ed1-x542.google.com with SMTP id e24so22524339edq.6 for ; Mon, 20 May 2019 01:22:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5Yi2X1g2LDOK5pARSqfDRbgYny8Ht12DRNhi7B8kudE=; b=U9WF7UxajthLPA4F3yQpcOAgQWUOK8Q5SMOcKgGPfM6+G4DfGXyFldwzT9qoNE8U+D BGlZ0BiVG2+WepaRI/0uziBrSnKD3Y9kXsq3Ud1QQiXcAebR7V5XQ4x5mkNkRk16XF/d D/4jOb5HHYpDrcukayEdCNjNHdrXndE6yGZW0j4HRRt5YoUcO4NP2PAUIaCRQQ4VWAea OV/gGeyo0Xb6dRj725JrB+bVKEvQTgLAfljuIBosqFFLOBrc1m5/BSQGl48uxm9x6qwW 67C1x4c5GsSnarTohdSGHHZlp5C04VP/FCv4/FgFchSMkB9eKiYw4Pf3QiXblol2go54 XA3w== X-Gm-Message-State: APjAAAURB1BbDhFWUkwPKY+VJ0heC8f+4NJdE2qoX/k0zK0thnsUGFvz GYYEzhz/5S84f13fKw7mx+FgwjeYhgw= X-Google-Smtp-Source: APXvYqx1KMcrcgpQkz4bO2jVYqWxeEYutnIUAq9EK8LkqC8rGjLsuq/dv8waUJ8jpDkNsjUkAr/k7w== X-Received: by 2002:a17:906:2cd1:: with SMTP id r17mr57422258ejr.101.1558340550757; Mon, 20 May 2019 01:22:30 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:30 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 07/33] fbdev/aty128fb: Remove dead code Date: Mon, 20 May 2019 10:21:50 +0200 Message-Id: <20190520082216.26273-8-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5Yi2X1g2LDOK5pARSqfDRbgYny8Ht12DRNhi7B8kudE=; b=G0YJ7vs27y+V7OdMp+ENPD1lSgTa7pNGdeswUFxkTwXtbtAumSLGCgWrIYQVT55Q9W 1QcmoAdHvvy0lrdBljaNzs8QH2Pl1vBp/eZd4v9sjDPKQ3L6aCcyxlfACZbPsj5X2VZr s61clzBKGrQItY414cJdscFjWMzl/7+tRX4ho= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fbdev@vger.kernel.org, Daniel Vetter , Intel Graphics Development , LKML , Paul Mackerras , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Motivated because it contains a struct display, which is a fbcon internal data structure that I want to rename. It seems to have been formerly used in drivers, but that's very long time ago. Signed-off-by: Daniel Vetter Cc: Paul Mackerras Cc: linux-fbdev@vger.kernel.org --- drivers/video/fbdev/aty/aty128fb.c | 64 ------------------------------ 1 file changed, 64 deletions(-) diff --git a/drivers/video/fbdev/aty/aty128fb.c b/drivers/video/fbdev/aty/aty128fb.c index 6cc46867ff57..c022ad7a49c2 100644 --- a/drivers/video/fbdev/aty/aty128fb.c +++ b/drivers/video/fbdev/aty/aty128fb.c @@ -2349,70 +2349,6 @@ static int aty128fb_ioctl(struct fb_info *info, u_int cmd, u_long arg) return -EINVAL; } -#if 0 - /* - * Accelerated functions - */ - -static inline void aty128_rectcopy(int srcx, int srcy, int dstx, int dsty, - u_int width, u_int height, - struct fb_info_aty128 *par) -{ - u32 save_dp_datatype, save_dp_cntl, dstval; - - if (!width || !height) - return; - - dstval = depth_to_dst(par->current_par.crtc.depth); - if (dstval == DST_24BPP) { - srcx *= 3; - dstx *= 3; - width *= 3; - } else if (dstval == -EINVAL) { - printk("aty128fb: invalid depth or RGBA\n"); - return; - } - - wait_for_fifo(2, par); - save_dp_datatype = aty_ld_le32(DP_DATATYPE); - save_dp_cntl = aty_ld_le32(DP_CNTL); - - wait_for_fifo(6, par); - aty_st_le32(SRC_Y_X, (srcy << 16) | srcx); - aty_st_le32(DP_MIX, ROP3_SRCCOPY | DP_SRC_RECT); - aty_st_le32(DP_CNTL, DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM); - aty_st_le32(DP_DATATYPE, save_dp_datatype | dstval | SRC_DSTCOLOR); - - aty_st_le32(DST_Y_X, (dsty << 16) | dstx); - aty_st_le32(DST_HEIGHT_WIDTH, (height << 16) | width); - - par->blitter_may_be_busy = 1; - - wait_for_fifo(2, par); - aty_st_le32(DP_DATATYPE, save_dp_datatype); - aty_st_le32(DP_CNTL, save_dp_cntl); -} - - - /* - * Text mode accelerated functions - */ - -static void fbcon_aty128_bmove(struct display *p, int sy, int sx, int dy, - int dx, int height, int width) -{ - sx *= fontwidth(p); - sy *= fontheight(p); - dx *= fontwidth(p); - dy *= fontheight(p); - width *= fontwidth(p); - height *= fontheight(p); - - aty128_rectcopy(sx, sy, dx, dy, width, height, - (struct fb_info_aty128 *)p->fb_info); -} -#endif /* 0 */ - static void aty128_set_suspend(struct aty128fb_par *par, int suspend) { u32 pmgt; From patchwork Mon May 20 08:21:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950389 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 77A2676 for ; Mon, 20 May 2019 08:23:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 677D128749 for ; Mon, 20 May 2019 08:23:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B86D2874A; Mon, 20 May 2019 08:23:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 61A3628740 for ; Mon, 20 May 2019 08:23:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 232D58926E; Mon, 20 May 2019 08:22:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id 44AD489259 for ; Mon, 20 May 2019 08:22:34 +0000 (UTC) Received: by mail-ed1-x543.google.com with SMTP id p26so22580501edr.2 for ; Mon, 20 May 2019 01:22:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tADEcmya8Zj9yL52UmRYxDj9tUtqHK1u8fQT1VLgcFs=; b=ba6BjG7r5PouvgN2YeDo8uZgdbh03CrZzYsPrVR/m8a0bpN0VX19SeWiwy152olpC1 O4xqIcdATQ4JKSwAc2Asv+HJwCqAkqGUer+094ZmRFBvN7bbyrcHZWn0aX73z5zPx9Ed ClwXfGLD+IpB2dJPmuo7Iey/9qwdpG3g1NMXnaDi4Rz7VCAR7fZL79Ju3TvuZqVOr+l9 gfUqMeu4uBEe5EzcUJ8HxYeJf2GJrKxFINyNLAy5MwPJrVA1c1Vvzbhp6myf+asEJ6go +CNXMGcpPNLA6pbocphoXbFbqBdXzDPyjHsC3qWR8+zQDb9Krj3hyWe3lI/MTw/FiWbP DIxA== X-Gm-Message-State: APjAAAUkRFUn/XFZJH9rQKlbsOka0CfQ/JKKqEGru89I+ZBV2jb+OP7v EAGF6gYaSVFYiV33cH4WxdNYmVUD/8k= X-Google-Smtp-Source: APXvYqzLgdWT64X/UTefChg6POkbgjlulNHd/FhCXr85KzaAiRj90RXCV3WnZJlWrPaOX5JDHs7P4g== X-Received: by 2002:a17:906:1343:: with SMTP id x3mr56409107ejb.218.1558340551984; Mon, 20 May 2019 01:22:31 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:31 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 08/33] fbcon: s/struct display/struct fbcon_display/ Date: Mon, 20 May 2019 10:21:51 +0200 Message-Id: <20190520082216.26273-9-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tADEcmya8Zj9yL52UmRYxDj9tUtqHK1u8fQT1VLgcFs=; b=PK5IrWl+PKGW84a6I9uO94QLyiz4cSP0/5jH6R+1i50WIziKGaHZbznTYITkEJavHd L4CM7+phhp5X6jYAfXI/BfN1QoNXYGAVlv8VictXcr0UKFjW0z32sUvhiux46gGSN5mI bvFdyfXJXRR45XsqvCElOfbSQxr/qnOqJEigw= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Prarit Bhargava , Kees Cook , Bartlomiej Zolnierkiewicz , Daniel Vetter , Intel Graphics Development , LKML , Yisheng Xie , Hans de Goede , Greg Kroah-Hartman , Daniel Vetter , Peter Rosin , Konstantin Khorenko Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This was formerly used in fbdev drivers (not sure why, predates most git history), but now it's entirely an fbcon internal thing. Give it a more specific name. Signed-off-by: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: Hans de Goede Cc: Greg Kroah-Hartman Cc: Kees Cook Cc: Prarit Bhargava Cc: Konstantin Khorenko Cc: Peter Rosin Cc: Yisheng Xie --- drivers/video/fbdev/core/fbcon.c | 74 ++++++++++++++++---------------- drivers/video/fbdev/core/fbcon.h | 6 +-- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index cd059a801662..2b2082615ca1 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -93,7 +93,7 @@ enum { FBCON_LOGO_DONTSHOW = -3 /* do not show the logo */ }; -static struct display fb_display[MAX_NR_CONSOLES]; +static struct fbcon_display fb_display[MAX_NR_CONSOLES]; static signed char con2fb_map[MAX_NR_CONSOLES]; static signed char con2fb_map_boot[MAX_NR_CONSOLES]; @@ -185,11 +185,11 @@ static __inline__ void ywrap_up(struct vc_data *vc, int count); static __inline__ void ywrap_down(struct vc_data *vc, int count); static __inline__ void ypan_up(struct vc_data *vc, int count); static __inline__ void ypan_down(struct vc_data *vc, int count); -static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int sx, +static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx, int dy, int dx, int height, int width, u_int y_break); static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var, int unit); -static void fbcon_redraw_move(struct vc_data *vc, struct display *p, +static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p, int line, int count, int dy); static void fbcon_modechanged(struct fb_info *info); static void fbcon_set_all_vcs(struct fb_info *info); @@ -220,7 +220,7 @@ static void fbcon_rotate(struct fb_info *info, u32 rotate) fb_info = registered_fb[con2fb_map[ops->currcon]]; if (info == fb_info) { - struct display *p = &fb_display[ops->currcon]; + struct fbcon_display *p = &fb_display[ops->currcon]; if (rotate < 4) p->con_rotate = rotate; @@ -235,7 +235,7 @@ static void fbcon_rotate_all(struct fb_info *info, u32 rotate) { struct fbcon_ops *ops = info->fbcon_par; struct vc_data *vc; - struct display *p; + struct fbcon_display *p; int i; if (!ops || ops->currcon < 0 || rotate > 3) @@ -900,7 +900,7 @@ static int set_con2fb_map(int unit, int newidx, int user) * Low Level Operations */ /* NOTE: fbcon cannot be __init: it may be called from do_take_over_console later */ -static int var_to_display(struct display *disp, +static int var_to_display(struct fbcon_display *disp, struct fb_var_screeninfo *var, struct fb_info *info) { @@ -925,7 +925,7 @@ static int var_to_display(struct display *disp, } static void display_to_var(struct fb_var_screeninfo *var, - struct display *disp) + struct fbcon_display *disp) { fb_videomode_to_var(var, disp->mode); var->xres_virtual = disp->xres_virtual; @@ -946,7 +946,7 @@ static void display_to_var(struct fb_var_screeninfo *var, static const char *fbcon_startup(void) { const char *display_desc = "frame buffer device"; - struct display *p = &fb_display[fg_console]; + struct fbcon_display *p = &fb_display[fg_console]; struct vc_data *vc = vc_cons[fg_console].d; const struct font_desc *font = NULL; struct module *owner; @@ -1060,7 +1060,7 @@ static void fbcon_init(struct vc_data *vc, int init) struct fbcon_ops *ops; struct vc_data **default_mode = vc->vc_display_fg; struct vc_data *svc = *default_mode; - struct display *t, *p = &fb_display[vc->vc_num]; + struct fbcon_display *t, *p = &fb_display[vc->vc_num]; int logo = 1, new_rows, new_cols, rows, cols, charcnt = 256; int cap, ret; @@ -1203,7 +1203,7 @@ static void fbcon_init(struct vc_data *vc, int init) ops->p = &fb_display[fg_console]; } -static void fbcon_free_font(struct display *p, bool freefont) +static void fbcon_free_font(struct fbcon_display *p, bool freefont) { if (freefont && p->userfont && p->fontdata && (--REFCOUNT(p->fontdata) == 0)) kfree(p->fontdata - FONT_EXTRA_WORDS * sizeof(int)); @@ -1215,7 +1215,7 @@ static void set_vc_hi_font(struct vc_data *vc, bool set); static void fbcon_deinit(struct vc_data *vc) { - struct display *p = &fb_display[vc->vc_num]; + struct fbcon_display *p = &fb_display[vc->vc_num]; struct fb_info *info; struct fbcon_ops *ops; int idx; @@ -1288,7 +1288,7 @@ static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height, struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; struct fbcon_ops *ops = info->fbcon_par; - struct display *p = &fb_display[vc->vc_num]; + struct fbcon_display *p = &fb_display[vc->vc_num]; u_int y_break; if (fbcon_is_inactive(vc, info)) @@ -1324,7 +1324,7 @@ static void fbcon_putcs(struct vc_data *vc, const unsigned short *s, int count, int ypos, int xpos) { struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; - struct display *p = &fb_display[vc->vc_num]; + struct fbcon_display *p = &fb_display[vc->vc_num]; struct fbcon_ops *ops = info->fbcon_par; if (!fbcon_is_inactive(vc, info)) @@ -1388,7 +1388,7 @@ static int scrollback_current = 0; static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var, int unit) { - struct display *p, *t; + struct fbcon_display *p, *t; struct vc_data **default_mode, *vc; struct vc_data *svc; struct fbcon_ops *ops = info->fbcon_par; @@ -1457,7 +1457,7 @@ static __inline__ void ywrap_up(struct vc_data *vc, int count) { struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; struct fbcon_ops *ops = info->fbcon_par; - struct display *p = &fb_display[vc->vc_num]; + struct fbcon_display *p = &fb_display[vc->vc_num]; p->yscroll += count; if (p->yscroll >= p->vrows) /* Deal with wrap */ @@ -1476,7 +1476,7 @@ static __inline__ void ywrap_down(struct vc_data *vc, int count) { struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; struct fbcon_ops *ops = info->fbcon_par; - struct display *p = &fb_display[vc->vc_num]; + struct fbcon_display *p = &fb_display[vc->vc_num]; p->yscroll -= count; if (p->yscroll < 0) /* Deal with wrap */ @@ -1494,7 +1494,7 @@ static __inline__ void ywrap_down(struct vc_data *vc, int count) static __inline__ void ypan_up(struct vc_data *vc, int count) { struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; - struct display *p = &fb_display[vc->vc_num]; + struct fbcon_display *p = &fb_display[vc->vc_num]; struct fbcon_ops *ops = info->fbcon_par; p->yscroll += count; @@ -1519,7 +1519,7 @@ static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count) { struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; struct fbcon_ops *ops = info->fbcon_par; - struct display *p = &fb_display[vc->vc_num]; + struct fbcon_display *p = &fb_display[vc->vc_num]; p->yscroll += count; @@ -1542,7 +1542,7 @@ static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count) static __inline__ void ypan_down(struct vc_data *vc, int count) { struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; - struct display *p = &fb_display[vc->vc_num]; + struct fbcon_display *p = &fb_display[vc->vc_num]; struct fbcon_ops *ops = info->fbcon_par; p->yscroll -= count; @@ -1567,7 +1567,7 @@ static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count) { struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; struct fbcon_ops *ops = info->fbcon_par; - struct display *p = &fb_display[vc->vc_num]; + struct fbcon_display *p = &fb_display[vc->vc_num]; p->yscroll -= count; @@ -1587,7 +1587,7 @@ static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count) scrollback_current = 0; } -static void fbcon_redraw_softback(struct vc_data *vc, struct display *p, +static void fbcon_redraw_softback(struct vc_data *vc, struct fbcon_display *p, long delta) { int count = vc->vc_rows; @@ -1680,7 +1680,7 @@ static void fbcon_redraw_softback(struct vc_data *vc, struct display *p, } } -static void fbcon_redraw_move(struct vc_data *vc, struct display *p, +static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p, int line, int count, int dy) { unsigned short *s = (unsigned short *) @@ -1715,7 +1715,7 @@ static void fbcon_redraw_move(struct vc_data *vc, struct display *p, } static void fbcon_redraw_blit(struct vc_data *vc, struct fb_info *info, - struct display *p, int line, int count, int ycount) + struct fbcon_display *p, int line, int count, int ycount) { int offset = ycount * vc->vc_cols; unsigned short *d = (unsigned short *) @@ -1764,7 +1764,7 @@ static void fbcon_redraw_blit(struct vc_data *vc, struct fb_info *info, } } -static void fbcon_redraw(struct vc_data *vc, struct display *p, +static void fbcon_redraw(struct vc_data *vc, struct fbcon_display *p, int line, int count, int offset) { unsigned short *d = (unsigned short *) @@ -1848,7 +1848,7 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b, enum con_scroll dir, unsigned int count) { struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; - struct display *p = &fb_display[vc->vc_num]; + struct fbcon_display *p = &fb_display[vc->vc_num]; int scroll_partial = info->flags & FBINFO_PARTIAL_PAN_OK; if (fbcon_is_inactive(vc, info)) @@ -2052,7 +2052,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx, int height, int width) { struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; - struct display *p = &fb_display[vc->vc_num]; + struct fbcon_display *p = &fb_display[vc->vc_num]; if (fbcon_is_inactive(vc, info)) return; @@ -2071,7 +2071,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx, p->vrows - p->yscroll); } -static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int sx, +static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx, int dy, int dx, int height, int width, u_int y_break) { struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; @@ -2113,7 +2113,7 @@ static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int s height, width); } -static void updatescrollmode(struct display *p, +static void updatescrollmode(struct fbcon_display *p, struct fb_info *info, struct vc_data *vc) { @@ -2165,7 +2165,7 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width, { struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; struct fbcon_ops *ops = info->fbcon_par; - struct display *p = &fb_display[vc->vc_num]; + struct fbcon_display *p = &fb_display[vc->vc_num]; struct fb_var_screeninfo var = info->var; int x_diff, y_diff, virt_w, virt_h, virt_fw, virt_fh; @@ -2210,7 +2210,7 @@ static int fbcon_switch(struct vc_data *vc) { struct fb_info *info, *old_info = NULL; struct fbcon_ops *ops; - struct display *p = &fb_display[vc->vc_num]; + struct fbcon_display *p = &fb_display[vc->vc_num]; struct fb_var_screeninfo var; int i, ret, prev_console, charcnt = 256; @@ -2553,7 +2553,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, { struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; struct fbcon_ops *ops = info->fbcon_par; - struct display *p = &fb_display[vc->vc_num]; + struct fbcon_display *p = &fb_display[vc->vc_num]; int resize; int cnt; char *old_data = NULL; @@ -2601,7 +2601,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, static int fbcon_copy_font(struct vc_data *vc, int con) { - struct display *od = &fb_display[con]; + struct fbcon_display *od = &fb_display[con]; struct console_font *f = &vc->vc_font; if (od->fontdata == f->data) @@ -2826,7 +2826,7 @@ static void fbcon_scrolldelta(struct vc_data *vc, int lines) { struct fb_info *info = registered_fb[con2fb_map[fg_console]]; struct fbcon_ops *ops = info->fbcon_par; - struct display *disp = &fb_display[fg_console]; + struct fbcon_display *disp = &fb_display[fg_console]; int offset, limit, scrollback_old; if (softback_top) { @@ -2947,7 +2947,7 @@ static void fbcon_modechanged(struct fb_info *info) { struct fbcon_ops *ops = info->fbcon_par; struct vc_data *vc; - struct display *p; + struct fbcon_display *p; int rows, cols; if (!ops || ops->currcon < 0) @@ -2987,7 +2987,7 @@ static void fbcon_set_all_vcs(struct fb_info *info) { struct fbcon_ops *ops = info->fbcon_par; struct vc_data *vc; - struct display *p; + struct fbcon_display *p; int i, rows, cols, fg = -1; if (!ops || ops->currcon < 0) @@ -3022,7 +3022,7 @@ static int fbcon_mode_deleted(struct fb_info *info, struct fb_videomode *mode) { struct fb_info *fb_info; - struct display *p; + struct fbcon_display *p; int i, j, found = 0; /* before deletion, ensure that mode is not in use */ @@ -3294,7 +3294,7 @@ static void fbcon_get_requirement(struct fb_info *info, struct fb_blit_caps *caps) { struct vc_data *vc; - struct display *p; + struct fbcon_display *p; if (caps->flags) { int i, charcnt; diff --git a/drivers/video/fbdev/core/fbcon.h b/drivers/video/fbdev/core/fbcon.h index 21912a3ba32f..20dea853765f 100644 --- a/drivers/video/fbdev/core/fbcon.h +++ b/drivers/video/fbdev/core/fbcon.h @@ -25,7 +25,7 @@ * low-level frame buffer device */ -struct display { +struct fbcon_display { /* Filled in by the low-level console driver */ const u_char *fontdata; int userfont; /* != 0 if fontdata kmalloc()ed */ @@ -68,7 +68,7 @@ struct fbcon_ops { struct fb_var_screeninfo var; /* copy of the current fb_var_screeninfo */ struct timer_list cursor_timer; /* Cursor timer */ struct fb_cursor cursor_state; - struct display *p; + struct fbcon_display *p; struct fb_info *info; int currcon; /* Current VC. */ int cur_blink_jiffies; @@ -225,7 +225,7 @@ extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor); #define FBCON_ATTRIBUTE_REVERSE 2 #define FBCON_ATTRIBUTE_BOLD 4 -static inline int real_y(struct display *p, int ypos) +static inline int real_y(struct fbcon_display *p, int ypos) { int rows = p->vrows; From patchwork Mon May 20 08:21:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950393 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 484B0912 for ; Mon, 20 May 2019 08:23:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3968520000 for ; Mon, 20 May 2019 08:23:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D7F228748; Mon, 20 May 2019 08:23:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B37B9286B2 for ; Mon, 20 May 2019 08:23:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E544889286; Mon, 20 May 2019 08:22:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by gabe.freedesktop.org (Postfix) with ESMTPS id 837678926E for ; Mon, 20 May 2019 08:22:35 +0000 (UTC) Received: by mail-ed1-x541.google.com with SMTP id b8so22488411edm.11 for ; Mon, 20 May 2019 01:22:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lwFpKjbpcVfpxavAIzY2FLdOXjuwdFWEEdQZCv4IdjM=; b=d0Iwopkgue3hdgVVz5qP2ZneAOr06I/xpTBV95GGQmdxr6/9B7oaeCo2aNCDLWTn8I mXyNjm148f7EiTbkFGc9k/5l8Tz8lYSuTYRyE6X36Aj3ouoSCVMJnKCBAE9niFhNxm1I DjIzK0pgU8nVZV5MOoBDLi3jrHNlcecd9mbaP8sqy0s3xK4CFnW3IExkooFscfrN9C1v XA/7JMIwgOdVdS/Qmp3VqufGednZCXZKME9ey208ScyUJYluR1sus6umYe5IM2rP+Y1c +qYwxKCe+8+nN1n5bzvuvgWfmGYdH8pq+vulHPSb0S1Yr14CykN4fxy1KeAiJUHlG3r8 AL1w== X-Gm-Message-State: APjAAAVkDuaF4yM2v0v1bB1Jf34VCAdm/XWMNpBW6GfCM7yLM/+q5VEi 2P7oftOrCOOTbocjkApA7WGUZYSz+3I= X-Google-Smtp-Source: APXvYqyaF3UDCmRImjTKmK2S0jUqa2Jdsisz4g5gCuh/2C8JABswvXs+xL3FfvnEiNUWEG4UegO6aw== X-Received: by 2002:a50:e705:: with SMTP id a5mr73800863edn.270.1558340553273; Mon, 20 May 2019 01:22:33 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:32 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 09/33] fbcon: Remove fbcon_has_exited Date: Mon, 20 May 2019 10:21:52 +0200 Message-Id: <20190520082216.26273-10-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lwFpKjbpcVfpxavAIzY2FLdOXjuwdFWEEdQZCv4IdjM=; b=QsXk17pAjlKycoPZTOSaN4LlLR4asGEE0iqfcFpeJDjgVLyUgtaqMucm8pPF4Hh7y3 0P1ZDpsUiTukc91Jg9NYU0gTd9GISmiuhXHZUVXRAPCDq/c5hkdGY/fzuLrel8ZqClgJ DhGW8hIctQhq4oFsNDmF08WccwkWXo5yuibzM= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Prarit Bhargava , Kees Cook , Bartlomiej Zolnierkiewicz , Daniel Vetter , Intel Graphics Development , LKML , Yisheng Xie , Hans de Goede , Daniel Vetter , Konstantin Khorenko Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This is unused code since commit 6104c37094e729f3d4ce65797002112735d49cd1 Author: Daniel Vetter Date: Tue Aug 1 17:32:07 2017 +0200 fbcon: Make fbcon a built-time depency for fbdev when fbcon was made a compile-time static dependency of fbdev. We can't exit fbcon anymore without exiting fbdev first, which only works if all fbdev drivers have unloaded already. Hence this is all dead code. v2: I missed that fbcon_exit is also called from con_deinit stuff, and there fbcon_has_exited prevents double-cleanup. But we can fix that by properly resetting con2fb_map[] to all -1, which is used everywhere else to indicate "no fb_info allocate to this console". With that change the double-cleanup (which resulted in a module refcount underflow, among other things) is prevented. Aside: con2fb_map is a signed char, so don't register more than 128 fb_info or hilarity will ensue. Signed-off-by: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: Hans de Goede Cc: "Noralf Trønnes" Cc: Yisheng Xie Cc: Konstantin Khorenko Cc: Prarit Bhargava Cc: Kees Cook --- drivers/video/fbdev/core/fbcon.c | 33 +------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 2b2082615ca1..a1be589b692f 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -112,7 +112,6 @@ static int softback_lines; static int first_fb_vc; static int last_fb_vc = MAX_NR_CONSOLES - 1; static int fbcon_is_default = 1; -static int fbcon_has_exited; static int primary_device = -1; static int fbcon_has_console_bind; @@ -1050,7 +1049,6 @@ static const char *fbcon_startup(void) info->var.bits_per_pixel); fbcon_add_cursor_timer(info); - fbcon_has_exited = 0; return display_desc; } @@ -3336,14 +3334,6 @@ static int fbcon_event_notify(struct notifier_block *self, struct fb_blit_caps *caps; int idx, ret = 0; - /* - * ignore all events except driver registration and deregistration - * if fbcon is not active - */ - if (fbcon_has_exited && !(action == FB_EVENT_FB_REGISTERED || - action == FB_EVENT_FB_UNREGISTERED)) - goto done; - switch(action) { case FB_EVENT_SUSPEND: fbcon_suspended(info); @@ -3396,7 +3386,6 @@ static int fbcon_event_notify(struct notifier_block *self, fbcon_remap_all(idx); break; } -done: return ret; } @@ -3443,9 +3432,6 @@ static ssize_t store_rotate(struct device *device, int rotate, idx; char **last = NULL; - if (fbcon_has_exited) - return count; - console_lock(); idx = con2fb_map[fg_console]; @@ -3468,9 +3454,6 @@ static ssize_t store_rotate_all(struct device *device, int rotate, idx; char **last = NULL; - if (fbcon_has_exited) - return count; - console_lock(); idx = con2fb_map[fg_console]; @@ -3491,9 +3474,6 @@ static ssize_t show_rotate(struct device *device, struct fb_info *info; int rotate = 0, idx; - if (fbcon_has_exited) - return 0; - console_lock(); idx = con2fb_map[fg_console]; @@ -3514,9 +3494,6 @@ static ssize_t show_cursor_blink(struct device *device, struct fbcon_ops *ops; int idx, blink = -1; - if (fbcon_has_exited) - return 0; - console_lock(); idx = con2fb_map[fg_console]; @@ -3543,9 +3520,6 @@ static ssize_t store_cursor_blink(struct device *device, int blink, idx; char **last = NULL; - if (fbcon_has_exited) - return count; - console_lock(); idx = con2fb_map[fg_console]; @@ -3668,9 +3642,6 @@ static void fbcon_exit(void) struct fb_info *info; int i, j, mapped; - if (fbcon_has_exited) - return; - #ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER if (deferred_takeover) { dummycon_unregister_output_notifier(&fbcon_output_nb); @@ -3695,7 +3666,7 @@ static void fbcon_exit(void) for (j = first_fb_vc; j <= last_fb_vc; j++) { if (con2fb_map[j] == i) { mapped = 1; - break; + con2fb_map[j] = -1; } } @@ -3718,8 +3689,6 @@ static void fbcon_exit(void) info->queue.func = NULL; } } - - fbcon_has_exited = 1; } void __init fb_console_init(void) From patchwork Mon May 20 08:21:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950399 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B59C1912 for ; Mon, 20 May 2019 08:23:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A66C928641 for ; Mon, 20 May 2019 08:23:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A6FE2874B; Mon, 20 May 2019 08:23:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EB41C28641 for ; Mon, 20 May 2019 08:23:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5933F8929C; Mon, 20 May 2019 08:22:40 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3433E89268 for ; Mon, 20 May 2019 08:22:37 +0000 (UTC) Received: by mail-ed1-x543.google.com with SMTP id f37so22466529edb.13 for ; Mon, 20 May 2019 01:22:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l0tIhN6YywxcaWi2QH0yYGfpMycfWUEO/RS9r5SAA9E=; b=GgZEmixvFM2QQkljBC0tbtsvY09M2k7CmrRSn24JI+iTxLs7XSwGi0M7dbEhrV5A12 IomJxIajSH3nXsC39Fc8M0sSmzSotJBOb/2JxQVXsdOYWNJhgi6g9bM6GqVQUJw/fTpx NUJNgRio8wJg0KOhZSk44vYLSkfRO1hSavMUSrcJo4FfWyIAIxxTwgTBhzspZS9LEcK1 B9V80Uj/r56tlcDAGY5Ayxv+0T/EzPFFJ8wDmCggiCVj4+H7VL2lKT0NQ9DNgBx0XP9r mdpgniapqqO8NL0rGp0DTCZiy1zuMWOQ4LnAvRXlUJ3wu3lmPrKc0v5UZQmPNqZiMfj2 XDRg== X-Gm-Message-State: APjAAAU69beJmrgDXdqfCNcwN0UIOr7hLe0+nfgHEkHFmNcVrpqgVTKd NO64V+UXZGEifvynyJDoxuu7a6Z7ezs= X-Google-Smtp-Source: APXvYqyjBA7PktU+J9tWW8mtYlNlPAkzMVk0guYtE003G2qGc0oE2kDGJAaVWmK69a2pyHuXZSNPvA== X-Received: by 2002:a17:906:d053:: with SMTP id bo19mr32339032ejb.86.1558340554401; Mon, 20 May 2019 01:22:34 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:33 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 10/33] fbcon: call fbcon_fb_(un)registered directly Date: Mon, 20 May 2019 10:21:53 +0200 Message-Id: <20190520082216.26273-11-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=l0tIhN6YywxcaWi2QH0yYGfpMycfWUEO/RS9r5SAA9E=; b=akTeaLvBQ6wsq1iSx7uVMLfY4jeOwDxuxje6jNqnJq8nwKvXx2+BxVJnG7NALR5v9x xSRyR8+rVvptXBeUuUt41AoQ8UQveKZ6PNqC8P3dEvq5vRqOIIriOpQfAG9s7cEpouM+ G+j8lUIMNOMJMcLAw4VzWDGlVZcroZFqxJB40= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fbdev@vger.kernel.org, Bartlomiej Zolnierkiewicz , Daniel Vetter , Intel Graphics Development , LKML , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Yisheng Xie , Hans de Goede , Mikulas Patocka , Thomas Zimmermann , Greg Kroah-Hartman , Daniel Vetter , Peter Rosin Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP With commit 6104c37094e729f3d4ce65797002112735d49cd1 Author: Daniel Vetter Date: Tue Aug 1 17:32:07 2017 +0200 fbcon: Make fbcon a built-time depency for fbdev we have a static dependency between fbcon and fbdev, and we can replace the indirection through the notifier chain with a function call. Signed-off-by: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: Hans de Goede Cc: Greg Kroah-Hartman Cc: "Noralf Trønnes" Cc: Yisheng Xie Cc: Peter Rosin Cc: "Michał Mirosław" Cc: Thomas Zimmermann Cc: Mikulas Patocka Cc: linux-fbdev@vger.kernel.org --- drivers/video/fbdev/core/fbcon.c | 14 +++----------- drivers/video/fbdev/core/fbmem.c | 9 ++------- include/linux/fb.h | 4 ---- include/linux/fbcon.h | 4 ++++ 4 files changed, 9 insertions(+), 22 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index a1be589b692f..95af6bd783e8 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3115,14 +3115,14 @@ static int fbcon_fb_unbind(int idx) } /* called with console_lock held */ -static int fbcon_fb_unregistered(struct fb_info *info) +void fbcon_fb_unregistered(struct fb_info *info) { int i, idx; WARN_CONSOLE_UNLOCKED(); if (deferred_takeover) - return 0; + return; idx = info->node; for (i = first_fb_vc; i <= last_fb_vc; i++) { @@ -3151,8 +3151,6 @@ static int fbcon_fb_unregistered(struct fb_info *info) if (!num_registered_fb) do_unregister_con_driver(&fb_con); - - return 0; } /* called with console_lock held */ @@ -3211,7 +3209,7 @@ 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 fbcon_fb_registered(struct fb_info *info) { int ret = 0, i, idx; @@ -3355,12 +3353,6 @@ static int fbcon_event_notify(struct notifier_block *self, idx = info->node; ret = fbcon_fb_unbind(idx); break; - case FB_EVENT_FB_REGISTERED: - ret = fbcon_fb_registered(info); - break; - case FB_EVENT_FB_UNREGISTERED: - ret = fbcon_fb_unregistered(info); - break; case FB_EVENT_SET_CONSOLE_MAP: /* called with console lock held */ con2fb = event->data; diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index fc3d34a8ea5b..ae2db31eeba7 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1660,7 +1660,6 @@ MODULE_PARM_DESC(lockless_register_fb, static int do_register_framebuffer(struct fb_info *fb_info) { int i, ret; - struct fb_event event; struct fb_videomode mode; if (fb_check_foreignness(fb_info)) @@ -1723,7 +1722,6 @@ static int do_register_framebuffer(struct fb_info *fb_info) fb_add_videomode(&mode, &fb_info->modelist); registered_fb[i] = fb_info; - event.info = fb_info; if (!lockless_register_fb) console_lock(); else @@ -1732,9 +1730,8 @@ static int do_register_framebuffer(struct fb_info *fb_info) ret = -ENODEV; goto unlock_console; } - ret = 0; - fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event); + ret = fbcon_fb_registered(fb_info); unlock_fb_info(fb_info); unlock_console: if (!lockless_register_fb) @@ -1771,7 +1768,6 @@ static int __unlink_framebuffer(struct fb_info *fb_info); static int do_unregister_framebuffer(struct fb_info *fb_info) { - struct fb_event event; int ret; ret = unbind_console(fb_info); @@ -1789,9 +1785,8 @@ static int do_unregister_framebuffer(struct fb_info *fb_info) registered_fb[fb_info->node] = NULL; num_registered_fb--; fb_cleanup_device(fb_info); - event.info = fb_info; console_lock(); - fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event); + fbcon_fb_unregistered(fb_info); console_unlock(); /* this may free fb info */ diff --git a/include/linux/fb.h b/include/linux/fb.h index f52ef0ad6781..701abaf79c87 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -136,10 +136,6 @@ struct fb_cursor_user { #define FB_EVENT_RESUME 0x03 /* An entry from the modelist was removed */ #define FB_EVENT_MODE_DELETE 0x04 -/* A driver registered itself */ -#define FB_EVENT_FB_REGISTERED 0x05 -/* A driver unregistered itself */ -#define FB_EVENT_FB_UNREGISTERED 0x06 /* CONSOLE-SPECIFIC: get console to framebuffer mapping */ #define FB_EVENT_GET_CONSOLE_MAP 0x07 /* CONSOLE-SPECIFIC: set console to framebuffer mapping */ diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h index f68a7db14165..94a71e9e1257 100644 --- a/include/linux/fbcon.h +++ b/include/linux/fbcon.h @@ -4,9 +4,13 @@ #ifdef CONFIG_FRAMEBUFFER_CONSOLE void __init fb_console_init(void); void __exit fb_console_exit(void); +int fbcon_fb_registered(struct fb_info *info); +void fbcon_fb_unregistered(struct fb_info *info); #else static inline void fb_console_init(void) {} static inline void fb_console_exit(void) {} +static inline int fbcon_fb_registered(struct fb_info *info) { return 0; } +static inline void fbcon_fb_unregistered(struct fb_info *info) {} #endif #endif /* _LINUX_FBCON_H */ From patchwork Mon May 20 08:21:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950403 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5438676 for ; Mon, 20 May 2019 08:23:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 468F81FF13 for ; Mon, 20 May 2019 08:23:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A87D28740; Mon, 20 May 2019 08:23:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DAAEE2873B for ; Mon, 20 May 2019 08:23:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A790E892A7; Mon, 20 May 2019 08:22:42 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id 21D9C89263 for ; Mon, 20 May 2019 08:22:37 +0000 (UTC) Received: by mail-ed1-x542.google.com with SMTP id l25so22498380eda.9 for ; Mon, 20 May 2019 01:22:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pxqcSYFwHsuvd2Lv/d2TG+VXwZfFZyMIWYgQCzFB2T8=; b=Kj8XhXr0yRhkA8xdYYb8thCfdvhw18wSrlgxGmC5ewfi2tEGQFB2fCNjcuBXRqgAJ0 uAKKqHWqcG3KK0NH/UbFtpKJTJEmRYUq/LGrP0rA+lE2641FarVw6nTFer76yiPxbsp7 aEdNihGnZiYTDEIak7ngOTcrQTaBmf7J/exdl4GVBOg+uta7ufgiTMCV7S+8h9Z0UC4z UcgYvu/DsWZF85xMAedBNbLsSPvPRkhV8FdVKi5FV5O0/0Sy94Uk5Z8JCH8kfxiSirgq bFzhHn8x/N8p0Kc/chSksVMHAnMLRpnDaIT17M/wqc+Kv4FzrAhRe806d3lAU+AuY73b cvmg== X-Gm-Message-State: APjAAAXY2mKe/G7MM5NVAIFV4yQ3JI40AKvXOLVl9wZY2+eIFTnlT3MD 19SQvatt6IoQ+4GE0SDi6cSycCIIBVI= X-Google-Smtp-Source: APXvYqzH5vi4xjbpIabhzI98CxlrdX5ZWZAJwSpnPRN8dmpzTWzU7l5z6Z1WUkTqbCcTD46EZXl8Dg== X-Received: by 2002:aa7:d381:: with SMTP id x1mr74213607edq.251.1558340555273; Mon, 20 May 2019 01:22:35 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:34 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 11/33] fbdev/sh_mobile: remove sh_mobile_lcdc_display_notify Date: Mon, 20 May 2019 10:21:54 +0200 Message-Id: <20190520082216.26273-12-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pxqcSYFwHsuvd2Lv/d2TG+VXwZfFZyMIWYgQCzFB2T8=; b=CJE6x2vwqV3LQYmFhtuIPutKZptFzaKYr7k4mX1elPEsoncWPJ/GrDVp2MNooxU1YN xEtL2BegbC/MvQovtXXLHG7jiZdSGkI14MrhieJPhjfjk9EjLkKP/TEOYw1C9UGcG5BG tRpJgocZKYyHG15LmfgCt/u9VTVIi6lSN8Qys= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Intel Graphics Development , LKML Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP It's dead code, and removing it avoids me having to understand what it's doing with lock_fb_info. Signed-off-by: Daniel Vetter Cc: Daniel Vetter Reviewed-by: Geert Uytterhoeven --- drivers/video/fbdev/sh_mobile_lcdcfb.c | 63 -------------------------- drivers/video/fbdev/sh_mobile_lcdcfb.h | 5 -- 2 files changed, 68 deletions(-) diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c index dc46be38c970..c5924f5e98c6 100644 --- a/drivers/video/fbdev/sh_mobile_lcdcfb.c +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c @@ -556,67 +556,6 @@ sh_mobile_lcdc_must_reconfigure(struct sh_mobile_lcdc_chan *ch, static int sh_mobile_lcdc_check_var(struct fb_var_screeninfo *var, struct fb_info *info); -static int sh_mobile_lcdc_display_notify(struct sh_mobile_lcdc_chan *ch, - enum sh_mobile_lcdc_entity_event event, - const struct fb_videomode *mode, - const struct fb_monspecs *monspec) -{ - struct fb_info *info = ch->info; - struct fb_var_screeninfo var; - int ret = 0; - - switch (event) { - case SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT: - /* HDMI plug in */ - console_lock(); - if (lock_fb_info(info)) { - - - ch->display.width = monspec->max_x * 10; - ch->display.height = monspec->max_y * 10; - - if (!sh_mobile_lcdc_must_reconfigure(ch, mode) && - info->state == FBINFO_STATE_RUNNING) { - /* First activation with the default monitor. - * Just turn on, if we run a resume here, the - * logo disappears. - */ - info->var.width = ch->display.width; - info->var.height = ch->display.height; - sh_mobile_lcdc_display_on(ch); - } else { - /* New monitor or have to wake up */ - fb_set_suspend(info, 0); - } - - - unlock_fb_info(info); - } - console_unlock(); - break; - - case SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT: - /* HDMI disconnect */ - console_lock(); - if (lock_fb_info(info)) { - fb_set_suspend(info, 1); - unlock_fb_info(info); - } - console_unlock(); - break; - - case SH_MOBILE_LCDC_EVENT_DISPLAY_MODE: - /* Validate a proposed new mode */ - fb_videomode_to_var(&var, mode); - var.bits_per_pixel = info->var.bits_per_pixel; - var.grayscale = info->var.grayscale; - ret = sh_mobile_lcdc_check_var(&var, info); - break; - } - - return ret; -} - /* ----------------------------------------------------------------------------- * Format helpers */ @@ -2540,8 +2479,6 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch) unsigned int max_size; unsigned int i; - ch->notify = sh_mobile_lcdc_display_notify; - /* Validate the format. */ format = sh_mobile_format_info(cfg->fourcc); if (format == NULL) { diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.h b/drivers/video/fbdev/sh_mobile_lcdcfb.h index b8e47a8bd8ab..589400372098 100644 --- a/drivers/video/fbdev/sh_mobile_lcdcfb.h +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.h @@ -87,11 +87,6 @@ struct sh_mobile_lcdc_chan { unsigned long base_addr_c; unsigned int line_size; - int (*notify)(struct sh_mobile_lcdc_chan *ch, - enum sh_mobile_lcdc_entity_event event, - const struct fb_videomode *mode, - const struct fb_monspecs *monspec); - /* Backlight */ struct backlight_device *bl; unsigned int bl_brightness; From patchwork Mon May 20 08:21:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950401 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7770176 for ; Mon, 20 May 2019 08:23:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6ABA02873D for ; Mon, 20 May 2019 08:23:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5ED83286B2; Mon, 20 May 2019 08:23:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 141DC2873B for ; Mon, 20 May 2019 08:23:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3806589296; Mon, 20 May 2019 08:22:40 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id 32EAD8926F for ; Mon, 20 May 2019 08:22:38 +0000 (UTC) Received: by mail-ed1-x544.google.com with SMTP id w33so22504715edb.10 for ; Mon, 20 May 2019 01:22:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MAPnhxqw8kme2eR+AuVFsaR4pvfjpQV+5x2Qx7ASEQ8=; b=UKpthGg3yM5MGk9h8V9Rluy4EvD6c8upuRul3Nth+iKlZubZjKqEbm8B0D3fMizfq3 bFqt3haTl2LKx/EA+12OT8MI0eUgNL0PsrcG+9H4fJKAcu3GRpoHFR4rjR3LAVoBzJj/ 8ZQjzRQEVvW4xRZdfQzWU3AAO4sixb54IH6cHPbDu3WYuFvJCt4d8VUMUqD6873Wg8ZT 4hYfIqZF6ScFuI++5cOQHkwHkn0NjcrwkyyOuNO11ByzSfVTPbc0dvFVcf5Bp2ATfiLs 5V0PSn2vVRMf8VBWyR+6HLElqoL3iST4TATv7hKzyHkKnKKzg5ocYykPpbKxUXb3orjS ouhA== X-Gm-Message-State: APjAAAWf+cgS3RRMGjV1GxRaDP2gF1EGdVWBj8YObH0R+TUCU1oNr3GH xyXQl6wyQEvJEvHTirWoZaNCSK17u90= X-Google-Smtp-Source: APXvYqy2pt8n+x8BPHCCQ5cJnXhvOlYkpsAiqSlVjIHsEB/DVOI4Hf/8671bBp3VO5BjCkiPfLabNQ== X-Received: by 2002:a50:8bbb:: with SMTP id m56mr74709421edm.230.1558340556427; Mon, 20 May 2019 01:22:36 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:35 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 12/33] fbdev/omap: sysfs files can't disappear before the device is gone Date: Mon, 20 May 2019 10:21:55 +0200 Message-Id: <20190520082216.26273-13-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MAPnhxqw8kme2eR+AuVFsaR4pvfjpQV+5x2Qx7ASEQ8=; b=Vh1HQx0v1toKnOC/o4+NxIRAS4qdnL7xFxVmzs7PzaHJK00/mA1zLjPnQywnF9FaNS g2x4y7tGHyJ74sK8N9rCyeIwdUNSDAKgMreZ1nU6PCXGu0t2LLf0qy9PThDq7PyJshfS IkgW0obXAHORtuKJpLYNO1qhGGk1+JvHYHD2Q= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Intel Graphics Development , LKML Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Which means lock_fb_info can never fail. Remove the error handling. Signed-off-by: Daniel Vetter Cc: Daniel Vetter --- .../video/fbdev/omap2/omapfb/omapfb-sysfs.c | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c b/drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c index 8087a009c54f..bd0d20283372 100644 --- a/drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c +++ b/drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c @@ -60,8 +60,7 @@ static ssize_t store_rotate_type(struct device *dev, if (rot_type != OMAP_DSS_ROT_DMA && rot_type != OMAP_DSS_ROT_VRFB) return -EINVAL; - if (!lock_fb_info(fbi)) - return -ENODEV; + lock_fb_info(fbi); r = 0; if (rot_type == ofbi->rotation_type) @@ -112,8 +111,7 @@ static ssize_t store_mirror(struct device *dev, if (r) return r; - if (!lock_fb_info(fbi)) - return -ENODEV; + lock_fb_info(fbi); ofbi->mirror = mirror; @@ -149,8 +147,7 @@ static ssize_t show_overlays(struct device *dev, ssize_t l = 0; int t; - if (!lock_fb_info(fbi)) - return -ENODEV; + lock_fb_info(fbi); omapfb_lock(fbdev); for (t = 0; t < ofbi->num_overlays; t++) { @@ -208,8 +205,7 @@ static ssize_t store_overlays(struct device *dev, struct device_attribute *attr, if (buf[len - 1] == '\n') len = len - 1; - if (!lock_fb_info(fbi)) - return -ENODEV; + lock_fb_info(fbi); omapfb_lock(fbdev); if (len > 0) { @@ -340,8 +336,7 @@ static ssize_t show_overlays_rotate(struct device *dev, ssize_t l = 0; int t; - if (!lock_fb_info(fbi)) - return -ENODEV; + lock_fb_info(fbi); for (t = 0; t < ofbi->num_overlays; t++) { l += snprintf(buf + l, PAGE_SIZE - l, "%s%d", @@ -369,8 +364,7 @@ static ssize_t store_overlays_rotate(struct device *dev, if (buf[len - 1] == '\n') len = len - 1; - if (!lock_fb_info(fbi)) - return -ENODEV; + lock_fb_info(fbi); if (len > 0) { char *p = (char *)buf; @@ -453,8 +447,7 @@ static ssize_t store_size(struct device *dev, struct device_attribute *attr, size = PAGE_ALIGN(size); - if (!lock_fb_info(fbi)) - return -ENODEV; + lock_fb_info(fbi); if (display && display->driver->sync) display->driver->sync(display); From patchwork Mon May 20 08:21:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950405 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E7F6776 for ; Mon, 20 May 2019 08:23:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB6672869D for ; Mon, 20 May 2019 08:23:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9C1928740; Mon, 20 May 2019 08:23:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A29C22869D for ; Mon, 20 May 2019 08:23:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8448C892A1; Mon, 20 May 2019 08:22:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by gabe.freedesktop.org (Postfix) with ESMTPS id 593808928D for ; Mon, 20 May 2019 08:22:39 +0000 (UTC) Received: by mail-ed1-x541.google.com with SMTP id n17so22608181edb.0 for ; Mon, 20 May 2019 01:22:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9Yo/Zer+8+iZGO3QV40bLkqCAAdgnz/HLbmfJGGYr+Q=; b=n1YEfaAybDJMrTLp9CfH2oecV3q8o6QhyXtup8SRHvgAXOen8+cqD/x2GGz1rdS99Q YTURxTyBOccVcjT/mHp6ccI5zk6Q9GYsa43DmYKOdCnBfYuH8k8dmYP8lntiDazxZyQD obwa/aMzIFyiJovvCBV8roG4lrHvYh1mjrpPCzbKCqHd6w4RcNEPfwfhCYrWuZ3oE5Mf RwDd2fhEsyMA0jVOqTF+rVtgVI/YUWQbD1Q3DYQwNpmCKs+T9hdiiP6k15zXR9gNP7o2 QQAIZkBbeyknkd6+qVyuIYH6FOZTakjX5Q00ANimfL3GfFVfubaocY3WODWa62GPW3XB GExw== X-Gm-Message-State: APjAAAXW20PcmrwybzSbLram7FLycD1PYkABkwMR3q8Z39bDZT1qWVnv 9FbyeHvLdLHD1xeO6TVmnz/K3bcs5wk= X-Google-Smtp-Source: APXvYqzSNedje/GrhvJfy+yDfT67EfzYCBA9dSKXp3EwKybc9/rxqIqDEBVyCwEsyZ9DjbZ6qFx3XQ== X-Received: by 2002:a17:906:66c9:: with SMTP id k9mr9493808ejp.21.1558340557540; Mon, 20 May 2019 01:22:37 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:36 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 13/33] fbdev: sysfs files can't disappear before the device is gone Date: Mon, 20 May 2019 10:21:56 +0200 Message-Id: <20190520082216.26273-14-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9Yo/Zer+8+iZGO3QV40bLkqCAAdgnz/HLbmfJGGYr+Q=; b=LVMcjUHiu9elaHcvju6oijD096OkeD1rCO8uoQPNTGt0fOEVW6lb2YqOePOduwuC0R SnyyUwKDlhWGsP/P/rOme7Yyry2xo+zUigmnV26HCAqtqU23iZdbgd4nAQI2lcc6rkIS EhuEwvu9OKdJNj15SzU/r8nEGq/huZCyYiE5g= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Intel Graphics Development , LKML , Bartlomiej Zolnierkiewicz Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Which means lock_fb_info can never fail. Remove the error handling. Signed-off-by: Daniel Vetter Cc: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Rob Clark --- drivers/video/fbdev/core/fbsysfs.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c index 44cca39f2b51..5f329278e55f 100644 --- a/drivers/video/fbdev/core/fbsysfs.c +++ b/drivers/video/fbdev/core/fbsysfs.c @@ -179,10 +179,7 @@ static ssize_t store_modes(struct device *device, return -EINVAL; console_lock(); - if (!lock_fb_info(fb_info)) { - console_unlock(); - return -ENODEV; - } + lock_fb_info(fb_info); list_splice(&fb_info->modelist, &old_list); fb_videomode_to_modelist((const struct fb_videomode *)buf, i, @@ -409,10 +406,7 @@ static ssize_t store_fbstate(struct device *device, state = simple_strtoul(buf, &last, 0); console_lock(); - if (!lock_fb_info(fb_info)) { - console_unlock(); - return -ENODEV; - } + lock_fb_info(fb_info); fb_set_suspend(fb_info, (int)state); From patchwork Mon May 20 08:21:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950441 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DD59C912 for ; Mon, 20 May 2019 08:23:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D047F2873D for ; Mon, 20 May 2019 08:23:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C498228740; Mon, 20 May 2019 08:23:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8F35828641 for ; Mon, 20 May 2019 08:23:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 162A1892A9; Mon, 20 May 2019 08:22:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id B55E38929F for ; Mon, 20 May 2019 08:22:41 +0000 (UTC) Received: by mail-ed1-x544.google.com with SMTP id e24so22524907edq.6 for ; Mon, 20 May 2019 01:22:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qFqlt6mo9F4Pd9G7O8MT8qo6u/5jZNMJ/2yl3qsAQiY=; b=OTBFvPEwfFbtJ+SmotfsMhHQAhZo/qhFv51jLK+Mcu//lR6+KHjLjIXZp6jLYB7KSw bJMFYwdelE21zpvWiI7t5wfXMaK4zzjTOtaX/Ydy8lp67gLjf8xLXFGQbrbd9feqeyzC wC7sbaeY9rWrb7g9SQoUL8y1E8p2EIz4ZwI/ux/zwCz2h6rW87r0VpiO3PamMyJj7hIN xIiLuyliU8ZJsf8UO5CJYSqpDVLbV5gUVCa2Ag3/c9Xx9kWTU52eKC3Rv+ei8R8VD6Nf bQ9c2jAVIJ+Aacba1VRrxMI8FJQRuPtZqpMrqNLW/bgIZObn4jFpM/pYa3bVxY31auer VggQ== X-Gm-Message-State: APjAAAVwLt2Z5fFqNvPFrETnDteWDlTZzA4nfqE24TuP/AjIYba+gXLn +usfBGg0DasTkWWpn6/XcLLz3M1tDZ8= X-Google-Smtp-Source: APXvYqzMmvmbNckNLQCV3bNeFbcu8iFFcSc/sM1SOnUv0GtRrF3LCHc2XNNQ3XBMx6YgDvVqoDnpoA== X-Received: by 2002:a17:906:a34e:: with SMTP id bz14mr37528317ejb.82.1558340558649; Mon, 20 May 2019 01:22:38 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:38 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 14/33] staging/olpc: lock_fb_info can't fail Date: Mon, 20 May 2019 10:21:57 +0200 Message-Id: <20190520082216.26273-15-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qFqlt6mo9F4Pd9G7O8MT8qo6u/5jZNMJ/2yl3qsAQiY=; b=RTZ93kzVk9zGtnHtCaoZcwrmjSjG2Mp581U8LZiMJO9kPtk70WxR1ULXsE+s8Ev7ul bUysO8XL+pRY2yc7jmOEeZJBz6sHilS5rSOo0Hi+uHKPgTCJJhnmZu57MFXxVDkkyBXZ HRh/z9TwO6V3f8214ma3SZ0+PxgdfNq4IR6oc= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Drake , Jens Frederich , Daniel Vetter , Intel Graphics Development , LKML Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Simply because olpc never unregisters the damn thing. It also registers the framebuffer directly by poking around in fbdev core internals, so it's all around rather broken. Signed-off-by: Daniel Vetter Cc: Jens Frederich Cc: Daniel Drake Cc: Jon Nettleton --- drivers/staging/olpc_dcon/olpc_dcon.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c index 6b714f740ac3..a254238be181 100644 --- a/drivers/staging/olpc_dcon/olpc_dcon.c +++ b/drivers/staging/olpc_dcon/olpc_dcon.c @@ -250,11 +250,7 @@ static bool dcon_blank_fb(struct dcon_priv *dcon, bool blank) int err; console_lock(); - if (!lock_fb_info(dcon->fbinfo)) { - console_unlock(); - dev_err(&dcon->client->dev, "unable to lock framebuffer\n"); - return false; - } + lock_fb_info(dcon->fbinfo); dcon->ignore_fb_events = true; err = fb_blank(dcon->fbinfo, From patchwork Mon May 20 08:21:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950423 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 58BC776 for ; Mon, 20 May 2019 08:23:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49F4528609 for ; Mon, 20 May 2019 08:23:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 486E128748; Mon, 20 May 2019 08:23:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F3638286AE for ; Mon, 20 May 2019 08:23:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F1B98892A6; Mon, 20 May 2019 08:22:44 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2765E892A0 for ; Mon, 20 May 2019 08:22:42 +0000 (UTC) Received: by mail-ed1-x542.google.com with SMTP id n17so22608399edb.0 for ; Mon, 20 May 2019 01:22:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=brzEwqzIIXnydSs/RGKR5pFbo4J3hD4vcbto6AdqxGk=; b=sF37PnFf9zw7MJsypcYqvwzEezDjztiE8+8vmGTYRwgpVQEfd3aNZIeK8hxV4i5+jG GnAVdBAsrMtbVhIJ5efPMVCmh8OTT9iUDGtEtle0nNbmJtNJGcGY//qSGUxs6qRnODhL 9ZrLXjK2XxJP4Wurqz2kozqwrNxRq9gjmCJEexDfluA6Wo/d4pQslaRhWASLUm2tdgPb E6o9dRAGlb038CFksS4ZObhGUJ7vR7sYaMK0zrHYhID23qXjywOGczD4Ty12lUhNk9ZO Tg2c3GHNXQwy2sMHC0d+Dq3jkrLD2wXO2TVKt2tRcMp+n2TcUrOSZmlL1aa9I5XCVXwI dYkw== X-Gm-Message-State: APjAAAWw+iP1qp0dVgfJT7BVp2PqiZb2yvTRaYZW4+5/tV8/ZrxupA27 kiuRKXPPyPivPLz0+Br8MENflFYLs04= X-Google-Smtp-Source: APXvYqwcYQ/FNu9mKgR5y78+1RNm9YWWN/rbv1Dyk1fxTiJfn1IMT8JiRGTvl3E3oG9ZgSkImRa3bQ== X-Received: by 2002:a17:906:4911:: with SMTP id b17mr50845503ejq.3.1558340560091; Mon, 20 May 2019 01:22:40 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:39 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 15/33] fbdev/atyfb: lock_fb_info can't fail Date: Mon, 20 May 2019 10:21:58 +0200 Message-Id: <20190520082216.26273-16-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=brzEwqzIIXnydSs/RGKR5pFbo4J3hD4vcbto6AdqxGk=; b=k225G4BySl1X7q+UlZP4Nituk6duwxPLxugM6XbySvaJv68rXCwZLb3vHIHnpUiVtt RMs142ozoZpwli8WRmc7BaQJrVmTQEAYyzOd8QwAVlCuFVjST21Uh742TKY/EU7jI4tn FvVS9T4MOsKO5Bio5SHMWrXZSZUxfL3BAeT14= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartlomiej Zolnierkiewicz , Daniel Vetter , Intel Graphics Development , LKML , "David S. Miller" , Mikulas Patocka , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP It's properly protected by reboot_lock. Signed-off-by: Daniel Vetter Cc: Mikulas Patocka Cc: "David S. Miller" Cc: "Ville Syrjälä" Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter --- drivers/video/fbdev/aty/atyfb_base.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c index b6fe103df145..eebb62d82a23 100644 --- a/drivers/video/fbdev/aty/atyfb_base.c +++ b/drivers/video/fbdev/aty/atyfb_base.c @@ -3916,8 +3916,7 @@ static int atyfb_reboot_notify(struct notifier_block *nb, if (!reboot_info) goto out; - if (!lock_fb_info(reboot_info)) - goto out; + lock_fb_info(reboot_info); par = reboot_info->par; From patchwork Mon May 20 08:21:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950409 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1105C912 for ; Mon, 20 May 2019 08:23:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED8A32874A for ; Mon, 20 May 2019 08:23:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1C5D2873D; Mon, 20 May 2019 08:23:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 20FE6286AC for ; Mon, 20 May 2019 08:23:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E47DC892A4; Mon, 20 May 2019 08:22:44 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by gabe.freedesktop.org (Postfix) with ESMTPS id 25F1489268 for ; Mon, 20 May 2019 08:22:43 +0000 (UTC) Received: by mail-ed1-x541.google.com with SMTP id m4so22531016edd.8 for ; Mon, 20 May 2019 01:22:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eM35EBMx+LqeeuwxYimZRbsx1yQ6Wi7o1I3eNH/ML70=; b=kzDFHtFTjLuON/jC8Pg0V3y0WjC3FL2KmuwaY3V9KG7pyqNdg4jYXHEAoO1MHQ3XNI 5kra+B3Hw94ybx0f1XzRKYx4/hiXyAgWqvwKVjEnF+5w9oIcTg03lQVCwnSrALpw/Hda v+PT2ze2AHwqbDCQvQMUtiI/DtteKDEztCrNmfubeDqEX4d7TyPF0Tu7wuq5ZI7+7H6C rOogNqnWCdRFMqIq4hsrKyiHlJAA4mpjaToXcpI5fuotlAgsQ45ef7vxTF7xmFa/limM R041iNHthBgTugiZS/ECaSIggOCGjXSc00cyWMHLTklyrKrn1bPjKB1wSo6W0c1vQpCA AVmQ== X-Gm-Message-State: APjAAAWxvaQiqkXEZV4BwEsb2vNTeXYJULIhy2WxL/MrRVsDz2/sIKA5 LKRRg16SmaSq6YRgnWerCtULTCwsoK0= X-Google-Smtp-Source: APXvYqzwxqr5riknzKLKn3+LJQycV1xHBYyDBHu6NKNup3To1CmBLLwIazOhp9s/VmgG+UQqgYb6ww== X-Received: by 2002:a17:906:2ad5:: with SMTP id m21mr19708324eje.55.1558340561296; Mon, 20 May 2019 01:22:41 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:40 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 16/33] fbdev: lock_fb_info cannot fail Date: Mon, 20 May 2019 10:21:59 +0200 Message-Id: <20190520082216.26273-17-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eM35EBMx+LqeeuwxYimZRbsx1yQ6Wi7o1I3eNH/ML70=; b=TrKawzUNypCoohtGwlMufk2BVzGw5z44FIudIvWF1khrdzBTe5O/VSS/NUwt0qtdLK NuElr8o2M8sRvFprt6j0hB8KF2AT2v9SKW5Za9P9xqlhMRofRF+A5OdeapjH6FnH4O2U kPpzA5J6kyB+1e0eW5+uIT5Bv9onoDI2q2eNE= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fbdev@vger.kernel.org, Sergey Senozhatsky , Bartlomiej Zolnierkiewicz , Daniel Vetter , Intel Graphics Development , "Gustavo A. R. Silva" , LKML , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Yisheng Xie , Hans de Goede , Mikulas Patocka , Daniel Vetter , Peter Rosin Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Ever since commit c47747fde931c02455683bd00ea43eaa62f35b0e Author: Linus Torvalds Date: Wed May 11 14:58:34 2011 -0700 fbmem: make read/write/ioctl use the frame buffer at open time fbdev has gained proper refcounting for the fbinfo attached to any open files, which means that the backing driver (stored in fb_info->fbops) cannot untimely disappear anymore. The only thing that can happen is that the entire device just outright disappears and gets unregistered, but file_fb_info does check for that. Except that it's racy - it only checks once at the start of a file_ops, there's no guarantee that the underlying fbdev won't untimely disappear. Aside: A proper way to fix that race is probably to replicate the srcu trickery we've rolled out in drm. But given that this race has existed since forever it's probably not one we need to fix right away. do_unregister_framebuffer also nowhere clears fb_info->fbops, hence the check in lock_fb_info can't possible catch a disappearing fbdev later on. Long story short: Ever since the above commit the fb_info->fbops checks have essentially become dead code. Remove this all. Aside from the file_ops callbacks, and stuff called from there there's only register/unregister code left. If that goes wrong a driver managed to register/unregister a device instance twice or in the wrong order. That's just a driver bug. v2: - fb_mmap had an open-coded version of the fbinfo->fops check, because it doesn't need the fbinfo->lock. Delete that too. - Use the wrapper function in fb_open/release now, since no difference anymore. Signed-off-by: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: Hans de Goede Cc: Yisheng Xie Cc: Sergey Senozhatsky Cc: "Noralf Trønnes" Cc: Peter Rosin Cc: "Michał Mirosław" Cc: Mikulas Patocka Cc: "Gustavo A. R. Silva" Cc: linux-fbdev@vger.kernel.org --- drivers/video/fbdev/core/fbcmap.c | 6 +-- drivers/video/fbdev/core/fbcon.c | 3 +- drivers/video/fbdev/core/fbmem.c | 73 +++++++------------------------ include/linux/fb.h | 5 ++- 4 files changed, 23 insertions(+), 64 deletions(-) diff --git a/drivers/video/fbdev/core/fbcmap.c b/drivers/video/fbdev/core/fbcmap.c index 68a113594808..aac710b2f95f 100644 --- a/drivers/video/fbdev/core/fbcmap.c +++ b/drivers/video/fbdev/core/fbcmap.c @@ -283,11 +283,7 @@ int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info) goto out; } umap.start = cmap->start; - if (!lock_fb_info(info)) { - rc = -ENODEV; - goto out; - } - + lock_fb_info(info); rc = fb_set_cmap(&umap, info); unlock_fb_info(info); out: diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 95af6bd783e8..35443add7f7e 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -2360,8 +2360,7 @@ static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info, } - if (!lock_fb_info(info)) - return; + lock_fb_info(info); event.info = info; event.data = ␣ fb_notifier_call_chain(FB_EVENT_CONBLANK, &event); diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index ae2db31eeba7..1987aba4f5a2 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -80,17 +80,6 @@ static void put_fb_info(struct fb_info *fb_info) fb_info->fbops->fb_destroy(fb_info); } -int lock_fb_info(struct fb_info *info) -{ - mutex_lock(&info->lock); - if (!info->fbops) { - mutex_unlock(&info->lock); - return 0; - } - return 1; -} -EXPORT_SYMBOL(lock_fb_info); - /* * Helpers */ @@ -1121,8 +1110,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, switch (cmd) { case FBIOGET_VSCREENINFO: - if (!lock_fb_info(info)) - return -ENODEV; + lock_fb_info(info); var = info->var; unlock_fb_info(info); @@ -1132,10 +1120,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, if (copy_from_user(&var, argp, sizeof(var))) return -EFAULT; console_lock(); - if (!lock_fb_info(info)) { - console_unlock(); - return -ENODEV; - } + lock_fb_info(info); info->flags |= FBINFO_MISC_USEREVENT; ret = fb_set_var(info, &var); info->flags &= ~FBINFO_MISC_USEREVENT; @@ -1145,8 +1130,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, ret = -EFAULT; break; case FBIOGET_FSCREENINFO: - if (!lock_fb_info(info)) - return -ENODEV; + lock_fb_info(info); fix = info->fix; if (info->flags & FBINFO_HIDE_SMEM_START) fix.smem_start = 0; @@ -1162,8 +1146,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, case FBIOGETCMAP: if (copy_from_user(&cmap, argp, sizeof(cmap))) return -EFAULT; - if (!lock_fb_info(info)) - return -ENODEV; + lock_fb_info(info); cmap_from = info->cmap; unlock_fb_info(info); ret = fb_cmap_to_user(&cmap_from, &cmap); @@ -1172,10 +1155,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, if (copy_from_user(&var, argp, sizeof(var))) return -EFAULT; console_lock(); - if (!lock_fb_info(info)) { - console_unlock(); - return -ENODEV; - } + lock_fb_info(info); ret = fb_pan_display(info, &var); unlock_fb_info(info); console_unlock(); @@ -1192,8 +1172,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, return -EINVAL; con2fb.framebuffer = -1; event.data = &con2fb; - if (!lock_fb_info(info)) - return -ENODEV; + lock_fb_info(info); event.info = info; fb_notifier_call_chain(FB_EVENT_GET_CONSOLE_MAP, &event); unlock_fb_info(info); @@ -1214,10 +1193,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, } event.data = &con2fb; console_lock(); - if (!lock_fb_info(info)) { - console_unlock(); - return -ENODEV; - } + lock_fb_info(info); event.info = info; ret = fb_notifier_call_chain(FB_EVENT_SET_CONSOLE_MAP, &event); unlock_fb_info(info); @@ -1225,10 +1201,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, break; case FBIOBLANK: console_lock(); - if (!lock_fb_info(info)) { - console_unlock(); - return -ENODEV; - } + lock_fb_info(info); info->flags |= FBINFO_MISC_USEREVENT; ret = fb_blank(info, arg); info->flags &= ~FBINFO_MISC_USEREVENT; @@ -1236,8 +1209,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, console_unlock(); break; default: - if (!lock_fb_info(info)) - return -ENODEV; + lock_fb_info(info); fb = info->fbops; if (fb->fb_ioctl) ret = fb->fb_ioctl(info, cmd, arg); @@ -1357,8 +1329,7 @@ static int fb_get_fscreeninfo(struct fb_info *info, unsigned int cmd, { struct fb_fix_screeninfo fix; - if (!lock_fb_info(info)) - return -ENODEV; + lock_fb_info(info); fix = info->fix; if (info->flags & FBINFO_HIDE_SMEM_START) fix.smem_start = 0; @@ -1418,8 +1389,6 @@ fb_mmap(struct file *file, struct vm_area_struct * vma) if (!info) return -ENODEV; fb = info->fbops; - if (!fb) - return -ENODEV; mutex_lock(&info->mm_lock); if (fb->fb_mmap) { int res; @@ -1483,7 +1452,7 @@ __releases(&info->lock) if (IS_ERR(info)) return PTR_ERR(info); - mutex_lock(&info->lock); + lock_fb_info(info); if (!try_module_get(info->fbops->owner)) { res = -ENODEV; goto out; @@ -1499,7 +1468,7 @@ __releases(&info->lock) fb_deferred_io_open(info, inode, file); #endif out: - mutex_unlock(&info->lock); + unlock_fb_info(info); if (res) put_fb_info(info); return res; @@ -1512,11 +1481,11 @@ __releases(&info->lock) { struct fb_info * const info = file->private_data; - mutex_lock(&info->lock); + lock_fb_info(info); if (info->fbops->fb_release) info->fbops->fb_release(info,1); module_put(info->fbops->owner); - mutex_unlock(&info->lock); + unlock_fb_info(info); put_fb_info(info); return 0; } @@ -1726,14 +1695,10 @@ static int do_register_framebuffer(struct fb_info *fb_info) console_lock(); else atomic_inc(&ignore_console_lock_warning); - if (!lock_fb_info(fb_info)) { - ret = -ENODEV; - goto unlock_console; - } - + lock_fb_info(fb_info); ret = fbcon_fb_registered(fb_info); unlock_fb_info(fb_info); -unlock_console: + if (!lockless_register_fb) console_unlock(); else @@ -1751,11 +1716,7 @@ static int unbind_console(struct fb_info *fb_info) return -EINVAL; console_lock(); - if (!lock_fb_info(fb_info)) { - console_unlock(); - return -ENODEV; - } - + lock_fb_info(fb_info); event.info = fb_info; ret = fb_notifier_call_chain(FB_EVENT_FB_UNBIND, &event); unlock_fb_info(fb_info); diff --git a/include/linux/fb.h b/include/linux/fb.h index 701abaf79c87..fd60207c0685 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -656,7 +656,10 @@ extern struct class *fb_class; for (i = 0; i < FB_MAX; i++) \ if (!registered_fb[i]) {} else -extern int lock_fb_info(struct fb_info *info); +static inline void lock_fb_info(struct fb_info *info) +{ + mutex_lock(&info->lock); +} static inline void unlock_fb_info(struct fb_info *info) { From patchwork Mon May 20 08:22:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950427 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4720E1395 for ; Mon, 20 May 2019 08:23:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3953928748 for ; Mon, 20 May 2019 08:23:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C8A52874B; Mon, 20 May 2019 08:23:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AB00728641 for ; Mon, 20 May 2019 08:23:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B8FF892D3; Mon, 20 May 2019 08:22:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3759F89268 for ; Mon, 20 May 2019 08:22:44 +0000 (UTC) Received: by mail-ed1-x544.google.com with SMTP id p27so22586056eda.1 for ; Mon, 20 May 2019 01:22:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4HMcA3TizyI3bWUSVLBg8JyaO8Kn3WkToKLrAKg7Usk=; b=WQpnUEEl/PirSA/KK93imm12OsW+07UnBUQeiFpC3ejB6MHcfpZcNQknQnFjc6DOkw N34jCY0yzrYxgs8FDzOXGkXYih6DKfNh7py/jqMC4GClTuxgsYH6Oe88e9obiME41QvT /bRPGUqSmq8icHsaufYdxziJmDbHdP+kPmZnklqQAIfq4S/CWFl1J5MWeaYBuTSovRIk D0i6b1XPBsMzekqA3kXkcsAYgB4tXcNdjFuYV2JgKPUUjsrFtwUpWZBiRW/r2ZyVcY0X DpAE3NacO73JPbiOVfUQVspYxNpqS7FttkqfyQlI9yNMutIc6CQ6ZMJXTlMLTJM0n/QZ 2HNg== X-Gm-Message-State: APjAAAU2vTaE7msdY67XW5DEWhfqhs7PO1uXvkNn2TBfOpbqwM63jAOD VHP4mBS/6BhJxxG6dDOmk9YOZjNar0Q= X-Google-Smtp-Source: APXvYqztBstF/tIB3bAMhgRXMwDXlyAWS/2voV6GhfjJj0iuZ1QgSz/H5oFI1a+XUwblbYV8Hld5kA== X-Received: by 2002:aa7:c0d3:: with SMTP id j19mr42944311edp.179.1558340562531; Mon, 20 May 2019 01:22:42 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:41 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 17/33] fbcon: call fbcon_fb_bind directly Date: Mon, 20 May 2019 10:22:00 +0200 Message-Id: <20190520082216.26273-18-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4HMcA3TizyI3bWUSVLBg8JyaO8Kn3WkToKLrAKg7Usk=; b=THvANnfiO+VPHwaLX6hiMosNMlh77yzzpABl0zUCBAwFGZFkWtfXpItjMshjBvd+9Y TSR+YSLxco2R1iX54BhQpW8L/9/jKRtw1BnFFMU+5Pm6DbeGs2/0r/8c/l6wzTLB4Irh S8mtbFCJOx2hi2/3V4qV8WjoGmvO93yPtZj3o= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fbdev@vger.kernel.org, Sergey Senozhatsky , Kees Cook , Bartlomiej Zolnierkiewicz , Daniel Vetter , Intel Graphics Development , LKML , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Yisheng Xie , Hans de Goede , Mikulas Patocka , Thomas Zimmermann , Daniel Vetter , Peter Rosin , Konstantin Khorenko Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Also remove the error return value. That's all errors for either driver bugs (trying to unbind something that isn't bound), or errors of the new driver that will take over. There's nothing the outgoing driver can do about this anyway, so switch over to void. Signed-off-by: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: Hans de Goede Cc: Sergey Senozhatsky Cc: Peter Rosin Cc: Kees Cook Cc: Konstantin Khorenko Cc: Yisheng Xie Cc: "Michał Mirosław" Cc: Mikulas Patocka Cc: Thomas Zimmermann Cc: linux-fbdev@vger.kernel.org --- drivers/video/fbdev/core/fbcon.c | 24 +++++++----------------- drivers/video/fbdev/core/fbmem.c | 7 ++----- include/linux/fb.h | 2 -- include/linux/fbcon.h | 2 ++ 4 files changed, 11 insertions(+), 24 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 35443add7f7e..a8d12914b559 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3042,7 +3042,7 @@ static int fbcon_mode_deleted(struct fb_info *info, } #ifdef CONFIG_VT_HW_CONSOLE_BINDING -static int fbcon_unbind(void) +static void fbcon_unbind(void) { int ret; @@ -3051,25 +3051,21 @@ static int fbcon_unbind(void) if (!ret) fbcon_has_console_bind = 0; - - return ret; } #else -static inline int fbcon_unbind(void) -{ - return -EINVAL; -} +static inline void fbcon_unbind(void) {} #endif /* CONFIG_VT_HW_CONSOLE_BINDING */ /* called with console_lock held */ -static int fbcon_fb_unbind(int idx) +void fbcon_fb_unbind(struct fb_info *info) { int i, new_idx = -1, ret = 0; + int idx = info->node; WARN_CONSOLE_UNLOCKED(); if (!fbcon_has_console_bind) - return 0; + return; for (i = first_fb_vc; i <= last_fb_vc; i++) { if (con2fb_map[i] != idx && @@ -3102,15 +3098,13 @@ static int fbcon_fb_unbind(int idx) idx, 0); if (ret) { con2fb_map[i] = idx; - return ret; + return; } } } } - ret = fbcon_unbind(); + fbcon_unbind(); } - - return ret; } /* called with console_lock held */ @@ -3348,10 +3342,6 @@ static int fbcon_event_notify(struct notifier_block *self, mode = event->data; ret = fbcon_mode_deleted(info, mode); break; - case FB_EVENT_FB_UNBIND: - idx = info->node; - ret = fbcon_fb_unbind(idx); - break; case FB_EVENT_SET_CONSOLE_MAP: /* called with console lock held */ con2fb = event->data; diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 1987aba4f5a2..156523cc48bf 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1708,8 +1708,6 @@ static int do_register_framebuffer(struct fb_info *fb_info) static int unbind_console(struct fb_info *fb_info) { - struct fb_event event; - int ret; int i = fb_info->node; if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info) @@ -1717,12 +1715,11 @@ static int unbind_console(struct fb_info *fb_info) console_lock(); lock_fb_info(fb_info); - event.info = fb_info; - ret = fb_notifier_call_chain(FB_EVENT_FB_UNBIND, &event); + fbcon_fb_unbind(fb_info); unlock_fb_info(fb_info); console_unlock(); - return ret; + return 0; } static int __unlink_framebuffer(struct fb_info *fb_info); diff --git a/include/linux/fb.h b/include/linux/fb.h index fd60207c0685..38fae1678939 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -151,8 +151,6 @@ struct fb_cursor_user { #define FB_EVENT_CONBLANK 0x0C /* Get drawing requirements */ #define FB_EVENT_GET_REQ 0x0D -/* Unbind from the console if possible */ -#define FB_EVENT_FB_UNBIND 0x0E /* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */ #define FB_EVENT_REMAP_ALL_CONSOLE 0x0F /* A hardware display blank early change occurred */ diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h index 94a71e9e1257..38d44fdb6d14 100644 --- a/include/linux/fbcon.h +++ b/include/linux/fbcon.h @@ -6,11 +6,13 @@ void __init fb_console_init(void); void __exit fb_console_exit(void); int fbcon_fb_registered(struct fb_info *info); void fbcon_fb_unregistered(struct fb_info *info); +void fbcon_fb_unbind(struct fb_info *info); #else static inline void fb_console_init(void) {} static inline void fb_console_exit(void) {} static inline int fbcon_fb_registered(struct fb_info *info) { return 0; } static inline void fbcon_fb_unregistered(struct fb_info *info) {} +static inline void fbcon_fb_unbind(struct fb_info *info) {} #endif #endif /* _LINUX_FBCON_H */ From patchwork Mon May 20 08:22:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950435 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 65716912 for ; Mon, 20 May 2019 08:23:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4CC4E2874E for ; Mon, 20 May 2019 08:23:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4072828751; Mon, 20 May 2019 08:23:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C8AD928740 for ; Mon, 20 May 2019 08:23:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9629C892D8; Mon, 20 May 2019 08:22:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id C5A87892AD for ; Mon, 20 May 2019 08:22:45 +0000 (UTC) Received: by mail-ed1-x543.google.com with SMTP id a8so22559881edx.3 for ; Mon, 20 May 2019 01:22:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NJ126eKIev+vpaWGS6bKA79Fjam4T/ElEf+qZAMI/7g=; b=TG6N2A9nuIPABMn3VVXyXzIHfe9JBl2EIGnBi5LX/rxswcMyD3n/UijSPX7XUIwiUO EgZK2V4UTZvm/HEimLjyh8nn2qnwH0HkVEXiXuTnTudmVAystlbE96mm6CafjsWK8HwM vOYAK6gHYiSPuimSDGPzqJd1sFUcMqiPb605QBBM0+rxR/sYjxcsnqYeNvOCoboytk27 7WuKp+oFQuloMXApVgltNh7cM6biKEptFQP+smwyLM4854aZTRM8x6UjCEAib/RTtUi/ GWfiwTOs0380pNXvJVGtbSh0HaCSQQ+f6wvX40w/QkCsY9r7QBVfyP/AB07xu5OyTKJO Whcg== X-Gm-Message-State: APjAAAVkT0a6ylSa5qVkipP0O3omikePbL9iJDpY1ftOok1E4nUNjFbd aV3z+0ijoLYTRE1kJdKPJGs2EiW1U3c= X-Google-Smtp-Source: APXvYqzG7z92/iPE6K3oJFDIArvmbDp+doQdc8RO4mK8zIir7D2yQ4RhKUJP6uJba1FYDFRz0e4V+g== X-Received: by 2002:a50:c315:: with SMTP id a21mr73070255edb.158.1558340563703; Mon, 20 May 2019 01:22:43 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:43 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 18/33] fbdev: make unregister/unlink functions not fail Date: Mon, 20 May 2019 10:22:01 +0200 Message-Id: <20190520082216.26273-19-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NJ126eKIev+vpaWGS6bKA79Fjam4T/ElEf+qZAMI/7g=; b=YNbYvBWoGLxyzkX8oTfFpKGibuza0Yz/toJpp9ekQfP/wv3PaOEE6aMegl/J5lexOO LHcrYv0GsfJnVY87UMPRZjn7jWNBQmfdAqdG0LSq9Pd5PDEJbUTQffLS1KNy32O1qew+ DoQbDiwlrU4Z6C+o6OcAe9QB93Auc2ub6xJp8= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fbdev@vger.kernel.org, Bartlomiej Zolnierkiewicz , Daniel Vetter , Intel Graphics Development , LKML , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Hans de Goede , Mikulas Patocka , Daniel Vetter , Peter Rosin Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Except for driver bugs (which we'll catch with a WARN_ON) this is only to report failures of the new driver taking over the console. There's nothing the outgoing driver can do about that, and no one ever bothered to actually look at these return values. So remove them all. Signed-off-by: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: "Michał Mirosław" Cc: Peter Rosin Cc: Hans de Goede Cc: Mikulas Patocka Cc: linux-fbdev@vger.kernel.org --- drivers/video/fbdev/core/fbmem.c | 73 ++++++++++---------------------- include/linux/fb.h | 4 +- 2 files changed, 25 insertions(+), 52 deletions(-) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 156523cc48bf..032506576aa0 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1590,13 +1590,13 @@ static bool fb_do_apertures_overlap(struct apertures_struct *gena, return false; } -static int do_unregister_framebuffer(struct fb_info *fb_info); +static void do_unregister_framebuffer(struct fb_info *fb_info); #define VGA_FB_PHYS 0xA0000 -static int do_remove_conflicting_framebuffers(struct apertures_struct *a, - const char *name, bool primary) +static void do_remove_conflicting_framebuffers(struct apertures_struct *a, + const char *name, bool primary) { - int i, ret; + int i; /* check all firmware fbs and kick off if the base addr overlaps */ for_each_registered_fb(i) { @@ -1612,13 +1612,9 @@ static int do_remove_conflicting_framebuffers(struct apertures_struct *a, printk(KERN_INFO "fb%d: switching to %s from %s\n", i, name, registered_fb[i]->fix.id); - ret = do_unregister_framebuffer(registered_fb[i]); - if (ret) - return ret; + do_unregister_framebuffer(registered_fb[i]); } } - - return 0; } static bool lockless_register_fb; @@ -1634,11 +1630,9 @@ static int do_register_framebuffer(struct fb_info *fb_info) if (fb_check_foreignness(fb_info)) return -ENOSYS; - ret = do_remove_conflicting_framebuffers(fb_info->apertures, - fb_info->fix.id, - fb_is_primary_device(fb_info)); - if (ret) - return ret; + do_remove_conflicting_framebuffers(fb_info->apertures, + fb_info->fix.id, + fb_is_primary_device(fb_info)); if (num_registered_fb == FB_MAX) return -ENXIO; @@ -1706,32 +1700,25 @@ static int do_register_framebuffer(struct fb_info *fb_info) return ret; } -static int unbind_console(struct fb_info *fb_info) +static void unbind_console(struct fb_info *fb_info) { int i = fb_info->node; - if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info) - return -EINVAL; + if (WARN_ON(i < 0 || i >= FB_MAX || registered_fb[i] != fb_info)) + return; console_lock(); lock_fb_info(fb_info); fbcon_fb_unbind(fb_info); unlock_fb_info(fb_info); console_unlock(); - - return 0; } -static int __unlink_framebuffer(struct fb_info *fb_info); +static void __unlink_framebuffer(struct fb_info *fb_info); -static int do_unregister_framebuffer(struct fb_info *fb_info) +static void do_unregister_framebuffer(struct fb_info *fb_info) { - int ret; - - ret = unbind_console(fb_info); - - if (ret) - return -EINVAL; + unbind_console(fb_info); pm_vt_switch_unregister(fb_info->dev); @@ -1749,36 +1736,27 @@ static int do_unregister_framebuffer(struct fb_info *fb_info) /* this may free fb info */ put_fb_info(fb_info); - return 0; } -static int __unlink_framebuffer(struct fb_info *fb_info) +static void __unlink_framebuffer(struct fb_info *fb_info) { int i; i = fb_info->node; - if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info) - return -EINVAL; + if (WARN_ON(i < 0 || i >= FB_MAX || registered_fb[i] != fb_info)) + return; if (fb_info->dev) { device_destroy(fb_class, MKDEV(FB_MAJOR, i)); fb_info->dev = NULL; } - - return 0; } -int unlink_framebuffer(struct fb_info *fb_info) +void unlink_framebuffer(struct fb_info *fb_info) { - int ret; - - ret = __unlink_framebuffer(fb_info); - if (ret) - return ret; + __unlink_framebuffer(fb_info); unbind_console(fb_info); - - return 0; } EXPORT_SYMBOL(unlink_framebuffer); @@ -1795,7 +1773,6 @@ EXPORT_SYMBOL(unlink_framebuffer); int remove_conflicting_framebuffers(struct apertures_struct *a, const char *name, bool primary) { - int ret; bool do_free = false; if (!a) { @@ -1809,13 +1786,13 @@ int remove_conflicting_framebuffers(struct apertures_struct *a, } mutex_lock(®istration_lock); - ret = do_remove_conflicting_framebuffers(a, name, primary); + do_remove_conflicting_framebuffers(a, name, primary); mutex_unlock(®istration_lock); if (do_free) kfree(a); - return ret; + return 0; } EXPORT_SYMBOL(remove_conflicting_framebuffers); @@ -1891,16 +1868,12 @@ EXPORT_SYMBOL(register_framebuffer); * that the driver implements fb_open() and fb_release() to * check that no processes are using the device. */ -int +void unregister_framebuffer(struct fb_info *fb_info) { - int ret; - mutex_lock(®istration_lock); - ret = do_unregister_framebuffer(fb_info); + do_unregister_framebuffer(fb_info); mutex_unlock(®istration_lock); - - return ret; } EXPORT_SYMBOL(unregister_framebuffer); diff --git a/include/linux/fb.h b/include/linux/fb.h index 38fae1678939..44021e55b15c 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -627,8 +627,8 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf, /* drivers/video/fbmem.c */ extern int register_framebuffer(struct fb_info *fb_info); -extern int unregister_framebuffer(struct fb_info *fb_info); -extern int unlink_framebuffer(struct fb_info *fb_info); +extern void unregister_framebuffer(struct fb_info *fb_info); +extern void unlink_framebuffer(struct fb_info *fb_info); extern int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int res_id, const char *name); extern int remove_conflicting_framebuffers(struct apertures_struct *a, From patchwork Mon May 20 08:22:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950431 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9C92F76 for ; Mon, 20 May 2019 08:23:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E13E284A3 for ; Mon, 20 May 2019 08:23:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8254A286B2; Mon, 20 May 2019 08:23:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 13B12284A3 for ; Mon, 20 May 2019 08:23:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E330189263; Mon, 20 May 2019 08:22:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9675B89263 for ; Mon, 20 May 2019 08:22:46 +0000 (UTC) Received: by mail-ed1-x542.google.com with SMTP id w11so22520843edl.5 for ; Mon, 20 May 2019 01:22:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gJfGxf8U6KTF1RX+ypC9LJaMGcJl9tQj1nmEL+C/k0Y=; b=hpyJUc+rTuwW2ydDAxcrdW9zRT3NNoBP1vR0LoFSC9j2vAmkLdfYipbORLmkCJxusa rGp7nyPKBX2mMAO2vq2lYQnUFy9M4X+4Xg4icmOxG0WZyRV8J+2xK9Xzr4GyeEbMn1WS JmU5vHUaDPZ7EyBSt7BBy3qCKQ4+7F8nMfIze9vJaJDrTJFwXxgLzHg/O4Q64Jdk8DoH 7KlUCiWsG26SQd8gofDbJWXjYUFEO9qeNKqfxA4O5wTORnXLSz7w23akpSFJRqY8gU9F /GM6Mu/UBTWwFGXx7Fjnp9KE/M8SqYEDVJdo2auNkMIftw2UlWPgd5HkSqQxmgVyVWvD PHLg== X-Gm-Message-State: APjAAAUinkZ4G6Ymdvc+GJkyLpH+mT7Fe01PeZTAmpnvOrWekAnw9Uxz IoOuzWqJUMwpjMli0al1AXGlt2BZWgk= X-Google-Smtp-Source: APXvYqyxJI3lRgguCg2t5GLDmn3fTghiWGf9baTfAAVB0gGJLRcg+SLwvUdHlV6M58vH86eFdcH0+w== X-Received: by 2002:a17:906:e9c7:: with SMTP id kb7mr21611372ejb.259.1558340564829; Mon, 20 May 2019 01:22:44 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:44 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 19/33] fbdev: unify unlink_framebufer paths Date: Mon, 20 May 2019 10:22:02 +0200 Message-Id: <20190520082216.26273-20-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gJfGxf8U6KTF1RX+ypC9LJaMGcJl9tQj1nmEL+C/k0Y=; b=ZfzZMaqwxU5SpCglU4wJiqW//46esqj7/dt+xRvoqOyhLTaWabjwWc1CjWicENmY8B HH6xiUbHib3IGW/4+kNXHy+U7xRl+HEAgG0ERBbZcyL4J9CooATaEyNH4ZRKgIJaASV0 dwpIzTuki0yVR0zlRC3U4sV+hjHGeBf3Vqy/U= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartlomiej Zolnierkiewicz , Daniel Vetter , Intel Graphics Development , LKML , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Hans de Goede , Mikulas Patocka , Daniel Vetter , Peter Rosin Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP For some reasons the pm_vt_switch_unregister call was missing from the direct unregister_framebuffer path. Fix this. v2: fbinfo->dev is used to decided whether unlink_framebuffer has been called already. I botched that in v1. Make this all clearer by inlining __unlink_framebuffer. Signed-off-by: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: "Michał Mirosław" Cc: Peter Rosin Cc: Hans de Goede Cc: Mikulas Patocka --- drivers/video/fbdev/core/fbmem.c | 47 ++++++++++++++------------------ 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 032506576aa0..f059b0b1a030 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1714,15 +1714,30 @@ static void unbind_console(struct fb_info *fb_info) console_unlock(); } -static void __unlink_framebuffer(struct fb_info *fb_info); - -static void do_unregister_framebuffer(struct fb_info *fb_info) +void unlink_framebuffer(struct fb_info *fb_info) { - unbind_console(fb_info); + int i; + + i = fb_info->node; + if (WARN_ON(i < 0 || i >= FB_MAX || registered_fb[i] != fb_info)) + return; + + if (!fb_info->dev) + return; + + device_destroy(fb_class, MKDEV(FB_MAJOR, i)); pm_vt_switch_unregister(fb_info->dev); - __unlink_framebuffer(fb_info); + unbind_console(fb_info); + + fb_info->dev = NULL; +} +EXPORT_SYMBOL(unlink_framebuffer); + +static void do_unregister_framebuffer(struct fb_info *fb_info) +{ + unlink_framebuffer(fb_info); if (fb_info->pixmap.addr && (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT)) kfree(fb_info->pixmap.addr); @@ -1738,28 +1753,6 @@ static void do_unregister_framebuffer(struct fb_info *fb_info) put_fb_info(fb_info); } -static void __unlink_framebuffer(struct fb_info *fb_info) -{ - int i; - - i = fb_info->node; - if (WARN_ON(i < 0 || i >= FB_MAX || registered_fb[i] != fb_info)) - return; - - if (fb_info->dev) { - device_destroy(fb_class, MKDEV(FB_MAJOR, i)); - fb_info->dev = NULL; - } -} - -void unlink_framebuffer(struct fb_info *fb_info) -{ - __unlink_framebuffer(fb_info); - - unbind_console(fb_info); -} -EXPORT_SYMBOL(unlink_framebuffer); - /** * remove_conflicting_framebuffers - remove firmware-configured framebuffers * @a: memory range, users of which are to be removed From patchwork Mon May 20 08:22:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950461 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5BC1E912 for ; Mon, 20 May 2019 08:23:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C70A2874B for ; Mon, 20 May 2019 08:23:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 403EF286B2; Mon, 20 May 2019 08:23:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4DBBF2874C for ; Mon, 20 May 2019 08:23:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ED739892B8; Mon, 20 May 2019 08:22:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id DC80C892B8 for ; Mon, 20 May 2019 08:22:49 +0000 (UTC) Received: by mail-ed1-x543.google.com with SMTP id a8so22560058edx.3 for ; Mon, 20 May 2019 01:22:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v/s+u+a3caCaHYMTdWy6ZkddtDAnAEvZ2jDDvaMGNYA=; b=PTMoGGtnlnB6tsx87yruchn56KbmCBeM2lKWWC625KckpPsjtYnKcRnEVBKDHJAN8s ckDRVBaeR9LHqrG2vU4KzzBMcSUkVVQYG4xWHxcOJgZ9u1yxRfkaNArmVTFE/JK5KZom OxQi5Asp6inDN+3b+7pSYRQDrx0pwwfUhov6Dd4ycJs3c0bq6yXFoZkiX09hHVK3bAs2 kHqF4Ei5fMARnm+ex2OcP1QFZmrBl4ks93sjJJI0Yzmh8v6UB3uSghpCJFyQPr4Dhvft c05k1j4B6ggqBtqGbCfRbi2dM40OCrstXl5cUHqx8EjXfcsmIGfbMTBTzWllhnMsJDyT AaBw== X-Gm-Message-State: APjAAAUNwefK9TdVtp0srq4myPQmrCNc4x1IYH3LJauzp0RirvdPq+VH pJPi+ySAsSXWmeWg/JCmn38CHGm80Qk= X-Google-Smtp-Source: APXvYqzLhoVVwMu2GYEtxzLVHTjujPVhcPA2aHmpjPD5I+daHWOweaULw644XMo3J/NOdhuKNOJdqg== X-Received: by 2002:a17:906:1315:: with SMTP id w21mr21608204ejb.193.1558340565855; Mon, 20 May 2019 01:22:45 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:45 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 20/33] fbdev/sh_mob: Remove fb notifier callback Date: Mon, 20 May 2019 10:22:03 +0200 Message-Id: <20190520082216.26273-21-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v/s+u+a3caCaHYMTdWy6ZkddtDAnAEvZ2jDDvaMGNYA=; b=VzX3I0qS4GrLLWfSpSSNrP7CAMGwoZGJKhcwchf7QZ7BvcXbuZZKJ5uSOyvS446dj4 ZGaqCy84FOjRhoTTDad15AK3Q/HXp5EJIspUgGPRghZxCpoy0WCZ3D8cLngSRNv6Owtc WT7wxmgNirNNpJjN7KUjYDc04Q/lFSzz5jtMo= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Geert Uytterhoeven , Bartlomiej Zolnierkiewicz , Daniel Vetter , Intel Graphics Development , LKML , Wolfram Sang , Daniel Vetter , Markus Elfring Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This seems to be entirely defunct: - The FB_EVEN_SUSPEND/RESUME events are only sent out by fb_set_suspend. Which is supposed to be called by drivers in their suspend/resume hooks, and not itself call into drivers. Luckily sh_mob doesn't call fb_set_suspend, so this seems to do nothing useful. - The notify hook calls sh_mobile_fb_reconfig() which in turn can call into the fb notifier. Or attempt too, since that would deadlock. So looks like leftover hacks from when this was originally introduced in commit 6011bdeaa6089d49c02de69f05980da7bad314ab Author: Guennadi Liakhovetski Date: Wed Jul 21 10:13:21 2010 +0000 fbdev: sh-mobile: HDMI support for SH-Mobile SoCs So let's just remove it. Signed-off-by: Daniel Vetter Cc: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Markus Elfring Cc: Geert Uytterhoeven Cc: Wolfram Sang Reviewed-by: Geert Uytterhoeven Tested-by: Geert Uytterhoeven --- drivers/video/fbdev/sh_mobile_lcdcfb.c | 38 -------------------------- 1 file changed, 38 deletions(-) diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c index c5924f5e98c6..0d7a044852d7 100644 --- a/drivers/video/fbdev/sh_mobile_lcdcfb.c +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c @@ -213,7 +213,6 @@ struct sh_mobile_lcdc_priv { struct sh_mobile_lcdc_chan ch[2]; struct sh_mobile_lcdc_overlay overlays[4]; - struct notifier_block notifier; int started; int forced_fourcc; /* 2 channel LCDC must share fourcc setting */ }; @@ -2258,37 +2257,6 @@ static const struct dev_pm_ops sh_mobile_lcdc_dev_pm_ops = { * Framebuffer notifier */ -/* locking: called with info->lock held */ -static int sh_mobile_lcdc_notify(struct notifier_block *nb, - unsigned long action, void *data) -{ - struct fb_event *event = data; - struct fb_info *info = event->info; - struct sh_mobile_lcdc_chan *ch = info->par; - - if (&ch->lcdc->notifier != nb) - return NOTIFY_DONE; - - dev_dbg(info->dev, "%s(): action = %lu, data = %p\n", - __func__, action, event->data); - - switch(action) { - case FB_EVENT_SUSPEND: - sh_mobile_lcdc_display_off(ch); - sh_mobile_lcdc_stop(ch->lcdc); - break; - case FB_EVENT_RESUME: - mutex_lock(&ch->open_lock); - sh_mobile_fb_reconfig(info); - mutex_unlock(&ch->open_lock); - - sh_mobile_lcdc_display_on(ch); - sh_mobile_lcdc_start(ch->lcdc); - } - - return NOTIFY_OK; -} - /* ----------------------------------------------------------------------------- * Probe/remove and driver init/exit */ @@ -2316,8 +2284,6 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev) struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev); unsigned int i; - fb_unregister_client(&priv->notifier); - for (i = 0; i < ARRAY_SIZE(priv->overlays); i++) sh_mobile_lcdc_overlay_fb_unregister(&priv->overlays[i]); for (i = 0; i < ARRAY_SIZE(priv->ch); i++) @@ -2707,10 +2673,6 @@ static int sh_mobile_lcdc_probe(struct platform_device *pdev) goto err1; } - /* Failure ignored */ - priv->notifier.notifier_call = sh_mobile_lcdc_notify; - fb_register_client(&priv->notifier); - return 0; err1: sh_mobile_lcdc_remove(pdev); From patchwork Mon May 20 08:22:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950439 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B84C476 for ; Mon, 20 May 2019 08:23:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6434286AC for ; Mon, 20 May 2019 08:23:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99BC728748; Mon, 20 May 2019 08:23:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0EEAA286AC for ; Mon, 20 May 2019 08:23:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3F6F9892B9; Mon, 20 May 2019 08:22:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5B6AB892BD for ; Mon, 20 May 2019 08:22:50 +0000 (UTC) Received: by mail-ed1-x543.google.com with SMTP id w33so22505511edb.10 for ; Mon, 20 May 2019 01:22:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xHfqkSV74jmIRSkBNAdVICfQlDsa5PIgoLr5Sx0NTyI=; b=s6UqU0K/8u70JFuJOdWxEslDyzJlGxdE/Rjv5MYkzQ0ApLeDQTsrymijyZR3VcnBqZ 1qnuTkPw0bZZLLMci3SwB95+3AcvbeKUkeBLEeaNCb3Nsrb/oDhhQyh4bqzMRTuiWIrV HsCkgklVpCFXjIDP/fl9WHg1LiLDWovncBqOPD/zkB07FG3Ug8Kmu7IE2rumZNs5HFJk rIlXxyu5x7fab1MLlvBVNOg/rV6bWz+nA0MDt18SIgyiSWPw1FccGd7jMDJPMR1NtDfB YgUp5wdSos3y8/ToPBcVyIML5xQyqWnzDbGpCdZEi9xkPkCFP7Etx/SQjuYrMXeWC9LB 3Lhw== X-Gm-Message-State: APjAAAWM4VvXMocIlWwfuvbQfdUbWwhsv/i0FuupcPtswOS8jjlVzSHP 1PD26f9IFiHz1QhcSQD8Q1JJtOJdJKk= X-Google-Smtp-Source: APXvYqyC4hgRFqMJjkLnrlCAxP5rwYBOqkxrAyo7Wm9sEbgxexRmYhyqXMj7Bluqo1bGD4K990cx6A== X-Received: by 2002:a17:906:958:: with SMTP id j24mr48334946ejd.160.1558340567057; Mon, 20 May 2019 01:22:47 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:46 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 21/33] fbdev: directly call fbcon_suspended/resumed Date: Mon, 20 May 2019 10:22:04 +0200 Message-Id: <20190520082216.26273-22-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xHfqkSV74jmIRSkBNAdVICfQlDsa5PIgoLr5Sx0NTyI=; b=jTQ7n8zNXJkvtFvmjdnfvm+jTh+NJ3kuVNVQZLIh37weY1S4NSxehEZWjhQFxjVOuz SyqveHXtNf8X0+enQ+5vT2dIfEBzdl6QnpzwvOMKi++BqG4ybd68ehLeh+5O14CZHo46 oKwRz7mJpW1jWDJB5souIVZzSVJbeUwejz63k= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Prarit Bhargava , linux-fbdev@vger.kernel.org, Kees Cook , Bartlomiej Zolnierkiewicz , Daniel Vetter , Intel Graphics Development , LKML , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Yisheng Xie , Hans de Goede , Mikulas Patocka , Greg Kroah-Hartman , Daniel Vetter , Peter Rosin , Konstantin Khorenko Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP With the sh_mobile notifier removed we can just directly call the fbcon code here. v2: Remove now unused local variable. Signed-off-by: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: Hans de Goede Cc: Greg Kroah-Hartman Cc: Prarit Bhargava Cc: Kees Cook Cc: Konstantin Khorenko Cc: Yisheng Xie Cc: "Michał Mirosław" Cc: Peter Rosin Cc: Mikulas Patocka Cc: linux-fbdev@vger.kernel.org --- drivers/video/fbdev/core/fbcon.c | 10 ++-------- drivers/video/fbdev/core/fbmem.c | 7 ++----- include/linux/fb.h | 8 -------- include/linux/fbcon.h | 4 ++++ 4 files changed, 8 insertions(+), 21 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index a8d12914b559..b056d1190788 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -2915,7 +2915,7 @@ static int fbcon_set_origin(struct vc_data *vc) return 0; } -static void fbcon_suspended(struct fb_info *info) +void fbcon_suspended(struct fb_info *info) { struct vc_data *vc = NULL; struct fbcon_ops *ops = info->fbcon_par; @@ -2928,7 +2928,7 @@ static void fbcon_suspended(struct fb_info *info) fbcon_cursor(vc, CM_ERASE); } -static void fbcon_resumed(struct fb_info *info) +void fbcon_resumed(struct fb_info *info) { struct vc_data *vc; struct fbcon_ops *ops = info->fbcon_par; @@ -3326,12 +3326,6 @@ static int fbcon_event_notify(struct notifier_block *self, int idx, ret = 0; switch(action) { - case FB_EVENT_SUSPEND: - fbcon_suspended(info); - break; - case FB_EVENT_RESUME: - fbcon_resumed(info); - break; case FB_EVENT_MODE_CHANGE: fbcon_modechanged(info); break; diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index f059b0b1a030..7c55846ee5fc 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1881,17 +1881,14 @@ EXPORT_SYMBOL(unregister_framebuffer); */ void fb_set_suspend(struct fb_info *info, int state) { - struct fb_event event; - WARN_CONSOLE_UNLOCKED(); - event.info = info; if (state) { - fb_notifier_call_chain(FB_EVENT_SUSPEND, &event); + fbcon_suspended(info); info->state = FBINFO_STATE_SUSPENDED; } else { info->state = FBINFO_STATE_RUNNING; - fb_notifier_call_chain(FB_EVENT_RESUME, &event); + fbcon_resumed(info); } } EXPORT_SYMBOL(fb_set_suspend); diff --git a/include/linux/fb.h b/include/linux/fb.h index 44021e55b15c..a78bbd372cfd 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -126,14 +126,6 @@ struct fb_cursor_user { /* The resolution of the passed in fb_info about to change */ #define FB_EVENT_MODE_CHANGE 0x01 -/* The display on this fb_info is being suspended, no access to the - * framebuffer is allowed any more after that call returns - */ -#define FB_EVENT_SUSPEND 0x02 -/* The display on this fb_info was resumed, you can restore the display - * if you own it - */ -#define FB_EVENT_RESUME 0x03 /* An entry from the modelist was removed */ #define FB_EVENT_MODE_DELETE 0x04 /* CONSOLE-SPECIFIC: get console to framebuffer mapping */ diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h index 38d44fdb6d14..61a22e6c0c64 100644 --- a/include/linux/fbcon.h +++ b/include/linux/fbcon.h @@ -7,12 +7,16 @@ void __exit fb_console_exit(void); int fbcon_fb_registered(struct fb_info *info); void fbcon_fb_unregistered(struct fb_info *info); void fbcon_fb_unbind(struct fb_info *info); +void fbcon_suspended(struct fb_info *info); +void fbcon_resumed(struct fb_info *info); #else static inline void fb_console_init(void) {} static inline void fb_console_exit(void) {} static inline int fbcon_fb_registered(struct fb_info *info) { return 0; } static inline void fbcon_fb_unregistered(struct fb_info *info) {} static inline void fbcon_fb_unbind(struct fb_info *info) {} +static inline void fbcon_suspended(void) {} +static inline void fbcon_resumed(void) {} #endif #endif /* _LINUX_FBCON_H */ From patchwork Mon May 20 08:22:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950459 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 75E4E76 for ; Mon, 20 May 2019 08:23:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6738B1FF13 for ; Mon, 20 May 2019 08:23:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A98D28751; Mon, 20 May 2019 08:23:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C701E1FF13 for ; Mon, 20 May 2019 08:23:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 64E8D892EE; Mon, 20 May 2019 08:22:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by gabe.freedesktop.org (Postfix) with ESMTPS id D5E59892AD for ; Mon, 20 May 2019 08:22:50 +0000 (UTC) Received: by mail-ed1-x541.google.com with SMTP id g57so22487581edc.12 for ; Mon, 20 May 2019 01:22:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=46rb8LQC3296aGA0BKIPlWxEp4JH7V5bKGmYErB7ogA=; b=CsLRw1lMtd4/CyqN+HYkQk9n9rKuoGHOr8v78CVi1ap71cD22OOOSaYbWoKCfEEScS BbEE2HHk34RjvKXOOTWq4nOYjCZ19b7Pc0RE6YliDx3vzDTBafXNW0ybpfx5zp7X0BxZ YmaHrb2IVr+Hm1nagtElCsPT+jgfRqZCO/CXXW8bRo+YSh4KDC2h8/Vw398DMObWSgpQ 3tluA8nDBiTGUG6D50GIjzHzy5ETqhjrk1yh6XxAPA5GRJNUMvyOEFXMab5DsmFlTX96 hK+It9Kq2ywGKPwKPTWvpykVHfDP0YYEKJ7LlN8HG6HyfW3mU2p0OI/t67uW98Zh+ebG Zptg== X-Gm-Message-State: APjAAAUM+ZzAls9yx/lPWwLGASpC/Ul+D/Q/GAHUyXVqESmdQgivnMiD At7pXjhTHm/Eod2TERui4NlIyiUDKGQ= X-Google-Smtp-Source: APXvYqxe8JQb1vG4n92tJvBzVYsVrA9YLF6sbaSgAOb3ex1g2gi9wW4z/JKNFS1lxfYi3FLXbOETIw== X-Received: by 2002:a50:f48d:: with SMTP id s13mr74684951edm.151.1558340568269; Mon, 20 May 2019 01:22:48 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:47 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 22/33] fbcon: Call fbcon_mode_deleted/new_modelist directly Date: Mon, 20 May 2019 10:22:05 +0200 Message-Id: <20190520082216.26273-23-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=46rb8LQC3296aGA0BKIPlWxEp4JH7V5bKGmYErB7ogA=; b=FnX2K9dpIisbX3/dAUV4YiyTKu6RbzGkasua5caiuhC1z4UmIuUrLxi6D8TwrJlld9 /qejJ9qFAJwBn72dBihX4M507Kxk1xm7gAE2PrcalO58ZqjfFfz6E1LAFGROu3dllu2Y EiUiSeeRPlggkP60pQ+cife1YYUdvLdRGepLk= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fbdev@vger.kernel.org, Sergey Senozhatsky , Kees Cook , Bartlomiej Zolnierkiewicz , Daniel Vetter , Intel Graphics Development , LKML , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Yisheng Xie , Hans de Goede , Mikulas Patocka , Daniel Vetter , Peter Rosin Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP I'm not entirely clear on what new_modelist actually does, it seems exclusively for a sysfs interface. Which in the end does amount to a normal fb_set_par to check the mode, but then takes a different path in both fbmem.c and fbcon.c. I have no idea why these 2 paths are different, but then I also don't really want to find out. So just do the simple conversion to a direct function call. Signed-off-by: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: Hans de Goede Cc: Mikulas Patocka Cc: Sergey Senozhatsky Cc: Kees Cook Cc: Peter Rosin Cc: Yisheng Xie Cc: "Michał Mirosław" Cc: linux-fbdev@vger.kernel.org --- drivers/video/fbdev/core/fbcon.c | 14 +++----------- drivers/video/fbdev/core/fbmem.c | 22 +++++++--------------- include/linux/fb.h | 5 ----- include/linux/fbcon.h | 6 ++++++ 4 files changed, 16 insertions(+), 31 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index b056d1190788..5635acb4b11c 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3015,8 +3015,8 @@ static void fbcon_set_all_vcs(struct fb_info *info) fbcon_modechanged(info); } -static int fbcon_mode_deleted(struct fb_info *info, - struct fb_videomode *mode) +int fbcon_mode_deleted(struct fb_info *info, + struct fb_videomode *mode) { struct fb_info *fb_info; struct fbcon_display *p; @@ -3258,7 +3258,7 @@ static void fbcon_fb_blanked(struct fb_info *info, int blank) ops->blank_state = blank; } -static void fbcon_new_modelist(struct fb_info *info) +void fbcon_new_modelist(struct fb_info *info) { int i; struct vc_data *vc; @@ -3320,7 +3320,6 @@ static int fbcon_event_notify(struct notifier_block *self, { struct fb_event *event = data; struct fb_info *info = event->info; - struct fb_videomode *mode; struct fb_con2fbmap *con2fb; struct fb_blit_caps *caps; int idx, ret = 0; @@ -3332,10 +3331,6 @@ static int fbcon_event_notify(struct notifier_block *self, case FB_EVENT_MODE_CHANGE_ALL: fbcon_set_all_vcs(info); break; - case FB_EVENT_MODE_DELETE: - mode = event->data; - ret = fbcon_mode_deleted(info, mode); - break; case FB_EVENT_SET_CONSOLE_MAP: /* called with console lock held */ con2fb = event->data; @@ -3349,9 +3344,6 @@ static int fbcon_event_notify(struct notifier_block *self, case FB_EVENT_BLANK: fbcon_fb_blanked(info, *(int *)event->data); break; - case FB_EVENT_NEW_MODELIST: - fbcon_new_modelist(info); - break; case FB_EVENT_GET_REQ: caps = event->data; fbcon_get_requirement(info, caps); diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 7c55846ee5fc..96d280228746 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -966,16 +966,11 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) /* make sure we don't delete the videomode of current var */ ret = fb_mode_is_equal(&mode1, &mode2); - if (!ret) { - struct fb_event event; - - event.info = info; - event.data = &mode1; - ret = fb_notifier_call_chain(FB_EVENT_MODE_DELETE, &event); - } + if (!ret) + fbcon_mode_deleted(info, &mode1); if (!ret) - fb_delete_videomode(&mode1, &info->modelist); + fb_delete_videomode(&mode1, &info->modelist); ret = (ret) ? -EINVAL : 0; @@ -1956,7 +1951,6 @@ subsys_initcall(fbmem_init); int fb_new_modelist(struct fb_info *info) { - struct fb_event event; struct fb_var_screeninfo var = info->var; struct list_head *pos, *n; struct fb_modelist *modelist; @@ -1976,14 +1970,12 @@ int fb_new_modelist(struct fb_info *info) } } - err = 1; + if (list_empty(&info->modelist)) + return 1; - if (!list_empty(&info->modelist)) { - event.info = info; - err = fb_notifier_call_chain(FB_EVENT_NEW_MODELIST, &event); - } + fbcon_new_modelist(info); - return err; + return 0; } MODULE_LICENSE("GPL"); diff --git a/include/linux/fb.h b/include/linux/fb.h index a78bbd372cfd..e6595a381792 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -126,8 +126,6 @@ struct fb_cursor_user { /* The resolution of the passed in fb_info about to change */ #define FB_EVENT_MODE_CHANGE 0x01 -/* An entry from the modelist was removed */ -#define FB_EVENT_MODE_DELETE 0x04 /* CONSOLE-SPECIFIC: get console to framebuffer mapping */ #define FB_EVENT_GET_CONSOLE_MAP 0x07 /* CONSOLE-SPECIFIC: set console to framebuffer mapping */ @@ -135,9 +133,6 @@ struct fb_cursor_user { /* A hardware display blank change occurred */ #define FB_EVENT_BLANK 0x09 /* Private modelist is to be replaced */ -#define FB_EVENT_NEW_MODELIST 0x0A -/* The resolution of the passed in fb_info about to change and - all vc's should be changed */ #define FB_EVENT_MODE_CHANGE_ALL 0x0B /* A software display blank change occurred */ #define FB_EVENT_CONBLANK 0x0C diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h index 61a22e6c0c64..42b06848b459 100644 --- a/include/linux/fbcon.h +++ b/include/linux/fbcon.h @@ -9,6 +9,9 @@ void fbcon_fb_unregistered(struct fb_info *info); void fbcon_fb_unbind(struct fb_info *info); void fbcon_suspended(struct fb_info *info); void fbcon_resumed(struct fb_info *info); +int fbcon_mode_deleted(struct fb_info *info, + struct fb_videomode *mode); +void fbcon_new_modelist(struct fb_info *info); #else static inline void fb_console_init(void) {} static inline void fb_console_exit(void) {} @@ -17,6 +20,9 @@ static inline void fbcon_fb_unregistered(struct fb_info *info) {} static inline void fbcon_fb_unbind(struct fb_info *info) {} static inline void fbcon_suspended(void) {} static inline void fbcon_resumed(void) {} +int fbcon_mode_deleted(struct fb_info *info, + struct fb_videomode *mode) { return 0; } +void fbcon_new_modelist(struct fb_info *info) {} #endif #endif /* _LINUX_FBCON_H */ From patchwork Mon May 20 08:22:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950449 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BAE1176 for ; Mon, 20 May 2019 08:23:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA878286AE for ; Mon, 20 May 2019 08:23:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E9432874B; Mon, 20 May 2019 08:23:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2D7DE286AC for ; Mon, 20 May 2019 08:23:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2AB15892D6; Mon, 20 May 2019 08:22:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by gabe.freedesktop.org (Postfix) with ESMTPS id 83A7A892CF for ; Mon, 20 May 2019 08:22:51 +0000 (UTC) Received: by mail-ed1-x541.google.com with SMTP id j12so22535840eds.7 for ; Mon, 20 May 2019 01:22:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x0uiCAq3Li2jmdjeGJIkAlmGEMtkmYpl25F5Y5tcPEI=; b=K52qiEskEOEAU06GJAphjTUirzA7iwLULDzq8GvBfvaVtrrh/6590SZib7mn1LfCcV BCrc0Ib7MfqcGBn5Dj64hZvh2cfBJlNkb4PthxByhHQri7iMNnvvs8NAJ8R5jVUvQYZ+ 7SPLyq63Y0ebpMogHYI0RNbIcCVwI053fg8BsI+MParBsPgEGpq0Q6MLmqqAHPHrYGfH OGlJCaaqy+bTbeGV+vMd7ggCQaZOv80efhqyInDceG218CR9oVuCXHQzyOHw4lSOIvrS 6nKCKdL7JJJXcSmBiveJAiXhqU568hyPETi5CLtsCfcu8alc1c+wAAaoN+prx+qajBpN PMQw== X-Gm-Message-State: APjAAAXFnMi3JdMoYmGwhXvYrtgRaesGKlqvVxfcr91FyK+s6An9JaFH NCaf4CeoTejKoh+0tUD8xM8kmBtrhwU= X-Google-Smtp-Source: APXvYqwI+OpydatmXSdYfJ99bNAPZnD9oXbel3F0KmXboiBBb6YqzsGXX+aKXgaec/2AvFVYsEA6JQ== X-Received: by 2002:a50:9025:: with SMTP id b34mr73941343eda.145.1558340569542; Mon, 20 May 2019 01:22:49 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:49 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 23/33] fbdev: Call fbcon_get_requirement directly Date: Mon, 20 May 2019 10:22:06 +0200 Message-Id: <20190520082216.26273-24-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=x0uiCAq3Li2jmdjeGJIkAlmGEMtkmYpl25F5Y5tcPEI=; b=djo0cym2t1KuMxhaRwhFWYnGaZTJCP+pizxY/JnHkioQBN4SWmlvh67DPMZwR1fGG8 L7MlysiCtzI4sWtb106pG6Mt+D56BHU3PlJgId5A3yiI3aSu34OYNlMYt5xnJLu3ujxr LcWmlt+5ld45Stq2rnP6pizhYdJNfJZnaPjlI= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Prarit Bhargava , linux-fbdev@vger.kernel.org, Kees Cook , Bartlomiej Zolnierkiewicz , Daniel Vetter , Intel Graphics Development , LKML , "Steven Rostedt \(VMware\)" , =?utf-8?b?TWljaGHFgiBN?= =?utf-8?b?aXJvc8WCYXc=?= , Yisheng Xie , Hans de Goede , Mikulas Patocka , Daniel Vetter , Peter Rosin Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Pretty simple case really. v2: Forgot to remove a break; Signed-off-by: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: Hans de Goede Cc: "Steven Rostedt (VMware)" Cc: Prarit Bhargava Cc: Kees Cook Cc: Yisheng Xie Cc: "Michał Mirosław" Cc: Peter Rosin Cc: Mikulas Patocka Cc: linux-fbdev@vger.kernel.org --- drivers/video/fbdev/core/fbcon.c | 9 ++------- drivers/video/fbdev/core/fbmem.c | 5 +---- include/linux/fb.h | 2 -- include/linux/fbcon.h | 4 ++++ 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 5635acb4b11c..58b876718d81 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3279,8 +3279,8 @@ void fbcon_new_modelist(struct fb_info *info) } } -static void fbcon_get_requirement(struct fb_info *info, - struct fb_blit_caps *caps) +void fbcon_get_requirement(struct fb_info *info, + struct fb_blit_caps *caps) { struct vc_data *vc; struct fbcon_display *p; @@ -3321,7 +3321,6 @@ static int fbcon_event_notify(struct notifier_block *self, struct fb_event *event = data; struct fb_info *info = event->info; struct fb_con2fbmap *con2fb; - struct fb_blit_caps *caps; int idx, ret = 0; switch(action) { @@ -3344,10 +3343,6 @@ static int fbcon_event_notify(struct notifier_block *self, case FB_EVENT_BLANK: fbcon_fb_blanked(info, *(int *)event->data); break; - case FB_EVENT_GET_REQ: - caps = event->data; - fbcon_get_requirement(info, caps); - break; case FB_EVENT_REMAP_ALL_CONSOLE: idx = info->node; fbcon_remap_all(idx); diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 96d280228746..d428d08c358a 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -932,16 +932,13 @@ EXPORT_SYMBOL(fb_pan_display); static int fb_check_caps(struct fb_info *info, struct fb_var_screeninfo *var, u32 activate) { - struct fb_event event; struct fb_blit_caps caps, fbcaps; int err = 0; memset(&caps, 0, sizeof(caps)); memset(&fbcaps, 0, sizeof(fbcaps)); caps.flags = (activate & FB_ACTIVATE_ALL) ? 1 : 0; - event.info = info; - event.data = ∩︀ - fb_notifier_call_chain(FB_EVENT_GET_REQ, &event); + fbcon_get_requirement(info, &caps); info->fbops->fb_get_caps(info, &fbcaps, var); if (((fbcaps.x ^ caps.x) & caps.x) || diff --git a/include/linux/fb.h b/include/linux/fb.h index e6595a381792..e76185244593 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -136,8 +136,6 @@ struct fb_cursor_user { #define FB_EVENT_MODE_CHANGE_ALL 0x0B /* A software display blank change occurred */ #define FB_EVENT_CONBLANK 0x0C -/* Get drawing requirements */ -#define FB_EVENT_GET_REQ 0x0D /* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */ #define FB_EVENT_REMAP_ALL_CONSOLE 0x0F /* A hardware display blank early change occurred */ diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h index 42b06848b459..7f0a530a913c 100644 --- a/include/linux/fbcon.h +++ b/include/linux/fbcon.h @@ -12,6 +12,8 @@ void fbcon_resumed(struct fb_info *info); int fbcon_mode_deleted(struct fb_info *info, struct fb_videomode *mode); void fbcon_new_modelist(struct fb_info *info); +void fbcon_get_requirement(struct fb_info *info, + struct fb_blit_caps *caps); #else static inline void fb_console_init(void) {} static inline void fb_console_exit(void) {} @@ -23,6 +25,8 @@ static inline void fbcon_resumed(void) {} int fbcon_mode_deleted(struct fb_info *info, struct fb_videomode *mode) { return 0; } void fbcon_new_modelist(struct fb_info *info) {} +void fbcon_get_requirement(struct fb_info *info, + struct fb_blit_caps *caps) {} #endif #endif /* _LINUX_FBCON_H */ From patchwork Mon May 20 08:22:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950447 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 28584912 for ; Mon, 20 May 2019 08:23:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A9EA2873B for ; Mon, 20 May 2019 08:23:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D89F2874A; Mon, 20 May 2019 08:23:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 752D22873B for ; Mon, 20 May 2019 08:23:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6960A892C6; Mon, 20 May 2019 08:22:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id 90090892D7 for ; Mon, 20 May 2019 08:22:52 +0000 (UTC) Received: by mail-ed1-x543.google.com with SMTP id j12so22535931eds.7 for ; Mon, 20 May 2019 01:22:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wwgnmEYo2AsN2seVNWQ6w+9PIizDlMfg8yS3XiJMdOk=; b=d00pL2ZoInvvn3PAUvnl99uoK44bfZLOUb2n0J/fXokMuJtCau4rQzS72Oo2Fd8twP AtimNUaIK/L4GUGq6QjjoCj+QQrK4dJkY501/tu3rgdHVo2aoUOAo7Q38mHXaecv+zYB xTJDBikHpdvvgpf0c2zuT0Wzj2g1HfzOBhhx3MukputxhX8Tfv3APSQLLRYFv5hc0o// /jkIWVBtGrTle6rM/T4gg0B9UsrjfcBkqAd5ZjK4lILaD5PGda1D1rP0Og0X83DYWLQL uTqbc6OHAz0nuA/m3XC8acQuBeKmPlYM3gX1YOPeZBUC6xso2SLk/Fc0clq2VP9krg6b JPag== X-Gm-Message-State: APjAAAUDobqQDzKeIe/muKWxDcaDTSnJycDB4m4gsq6E8YnQ7FuUchoM ltH7KdzRqVOTbVxsM0K9CoL+Uoud1+4= X-Google-Smtp-Source: APXvYqwceNL/LrOuvhdD1jUDdGInDeKdG5i9IVGNSecmbPjM9xRsI2Rc0RFnW2wU5dzx+HqfwLDVKw== X-Received: by 2002:a50:970a:: with SMTP id c10mr74054624edb.2.1558340570749; Mon, 20 May 2019 01:22:50 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:50 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 24/33] Revert "backlight/fbcon: Add FB_EVENT_CONBLANK" Date: Mon, 20 May 2019 10:22:07 +0200 Message-Id: <20190520082216.26273-25-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wwgnmEYo2AsN2seVNWQ6w+9PIizDlMfg8yS3XiJMdOk=; b=VbSQAghJf9HGDlQKsfxLWsNnfzStGXkNX/j4p10S+ADRCmX5ava6aXstIoGq/kMwT/ V5DmK2pw7hfLF1iQGa6rk4HMAXO51zxcMtqHAwNPms7BgcinLOR2sprrHMax1xl5KP03 /LXXKYtpR4kPUJWk2v7opeAYU3tzrFk3DosG8= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Intel Graphics Development , LKML , Yisheng Xie , Hans de Goede , Richard Purdie , linux-fbdev@vger.kernel.org, Jingoo Han , Daniel Vetter , Lee Jones Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This reverts commit 994efacdf9a087b52f71e620b58dfa526b0cf928. The justification is that if hw blanking fails (i.e. fbops->fb_blank) fails, then we still want to shut down the backlight. Which is exactly _not_ what fb_blank() does and so rather inconsistent if we end up with different behaviour between fbcon and direct fbdev usage. Given that the entire notifier maze is getting in the way anyway I figured it's simplest to revert this not well justified commit. Cc: Richard Purdie Signed-off-by: Daniel Vetter Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: Hans de Goede Cc: Yisheng Xie Cc: linux-fbdev@vger.kernel.org --- drivers/video/backlight/backlight.c | 2 +- drivers/video/fbdev/core/fbcon.c | 9 --------- include/linux/fb.h | 4 +--- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index deb824bef6e2..c55590ec0057 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -46,7 +46,7 @@ static int fb_notifier_callback(struct notifier_block *self, int fb_blank = 0; /* If we aren't interested in this event, skip it immediately ... */ - if (event != FB_EVENT_BLANK && event != FB_EVENT_CONBLANK) + if (event != FB_EVENT_BLANK) return 0; bd = container_of(self, struct backlight_device, fb_notif); diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 58b876718d81..1549056a848e 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -2346,8 +2346,6 @@ static int fbcon_switch(struct vc_data *vc) static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info, int blank) { - struct fb_event event; - if (blank) { unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; @@ -2358,13 +2356,6 @@ static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info, fbcon_clear(vc, 0, 0, vc->vc_rows, vc->vc_cols); vc->vc_video_erase_char = oldc; } - - - lock_fb_info(info); - event.info = info; - event.data = ␣ - fb_notifier_call_chain(FB_EVENT_CONBLANK, &event); - unlock_fb_info(info); } static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) diff --git a/include/linux/fb.h b/include/linux/fb.h index e76185244593..4b9b882f8f52 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -130,12 +130,10 @@ struct fb_cursor_user { #define FB_EVENT_GET_CONSOLE_MAP 0x07 /* CONSOLE-SPECIFIC: set console to framebuffer mapping */ #define FB_EVENT_SET_CONSOLE_MAP 0x08 -/* A hardware display blank change occurred */ +/* A display blank is requested */ #define FB_EVENT_BLANK 0x09 /* Private modelist is to be replaced */ #define FB_EVENT_MODE_CHANGE_ALL 0x0B -/* A software display blank change occurred */ -#define FB_EVENT_CONBLANK 0x0C /* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */ #define FB_EVENT_REMAP_ALL_CONSOLE 0x0F /* A hardware display blank early change occurred */ From patchwork Mon May 20 08:22:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950455 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8F78B1395 for ; Mon, 20 May 2019 08:23:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FE3228641 for ; Mon, 20 May 2019 08:23:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A38C2873B; Mon, 20 May 2019 08:23:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E381E2862A for ; Mon, 20 May 2019 08:23:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5878E892DC; Mon, 20 May 2019 08:22:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by gabe.freedesktop.org (Postfix) with ESMTPS id 70822892C0 for ; Mon, 20 May 2019 08:22:53 +0000 (UTC) Received: by mail-ed1-x541.google.com with SMTP id b8so22489733edm.11 for ; Mon, 20 May 2019 01:22:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AZL7dK3QHcNbZLKWjImh8nse/rAEY9uop0vjWdMdQzA=; b=b1/KCBgbFcm67iszhBL6EAtT0nhAiLrjTDuWAA0Qzi9yhrw5cxs48t282ywGg3z2Vu N3XkLm/xQ768EQPBMi0M1bU92JxnbARkS0hn+Xi1etnnk6KoETU9yBYeRg4UzJoMVnjj OlTKIOBL++vLSupWzoTVrlRK1NgVsqRWBReB89uuiHNWGSROEYBcBRXjuGYgay6fq14z 5jTC612rI1dnRd9LIboDw0gWgm6F3yyZw07Gk2GO20LYD85gzowgnRiXdi/u/Q6QGayY AOzTIVze1xKOlw6EFz0NTzSQCxwKDiz2wcJlNbrxT7oYaEntx2YVKNEnhVTc0MmBsXZe r4cQ== X-Gm-Message-State: APjAAAVNAgiayLsd3QECuaps3n4OUqUxVXL0hzRE/f+ZPDJyw3edTwBG b/phU0et4coGJX/Nw9wNUtxtFCopqoQ= X-Google-Smtp-Source: APXvYqxRm2Ckj9q3hFReAnFGuCBRLSDRkWc0S6Nan4YCQS01wu484++cIwoI5wP8Fcp4ASbyyRkA6A== X-Received: by 2002:a50:87ab:: with SMTP id a40mr71795115eda.188.1558340571784; Mon, 20 May 2019 01:22:51 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:51 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 25/33] fbcon: directly call fbcon_fb_blanked Date: Mon, 20 May 2019 10:22:08 +0200 Message-Id: <20190520082216.26273-26-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AZL7dK3QHcNbZLKWjImh8nse/rAEY9uop0vjWdMdQzA=; b=NoAk5YbfgOrrNimMCYl/NP8C5JEoJkCWTI2pjUKdZmoYP0rjrm+mnHejEkHJawdEKF nuRBvHhZQbrtrxfKuEnAoSyV2BjjA6n2qfhn5YAdpw9yDjZL4fk1ZOVkAQ1g+ho2bJYi QrGJ1Pxj4z1zxnXE8b2klkEFzo/InU0gaGEVc= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartlomiej Zolnierkiewicz , Daniel Vetter , Intel Graphics Development , LKML , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Yisheng Xie , Hans de Goede , Mikulas Patocka , Daniel Vetter , Peter Rosin Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP We cant remove FB_EVENT_BLANK because that's still used by the backlight and lcd code, but that's kinda fine: No recursion between fbdev core code and fbcon code possible for that case. Signed-off-by: Daniel Vetter Cc: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Hans de Goede Cc: Yisheng Xie Cc: "Michał Mirosław" Cc: Peter Rosin Cc: Mikulas Patocka --- drivers/video/fbdev/core/fbcon.c | 5 +---- drivers/video/fbdev/core/fbmem.c | 1 + include/linux/fbcon.h | 2 ++ 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 1549056a848e..f85d794a3bee 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3227,7 +3227,7 @@ int fbcon_fb_registered(struct fb_info *info) return ret; } -static void fbcon_fb_blanked(struct fb_info *info, int blank) +void fbcon_fb_blanked(struct fb_info *info, int blank) { struct fbcon_ops *ops = info->fbcon_par; struct vc_data *vc; @@ -3331,9 +3331,6 @@ static int fbcon_event_notify(struct notifier_block *self, con2fb = event->data; con2fb->framebuffer = con2fb_map[con2fb->console - 1]; break; - case FB_EVENT_BLANK: - fbcon_fb_blanked(info, *(int *)event->data); - break; case FB_EVENT_REMAP_ALL_CONSOLE: idx = info->node; fbcon_remap_all(idx); diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index d428d08c358a..9932130bf728 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1068,6 +1068,7 @@ fb_blank(struct fb_info *info, int blank) event.data = ␣ early_ret = fb_notifier_call_chain(FB_EARLY_EVENT_BLANK, &event); + fbcon_fb_blanked(info, blank); if (info->fbops->fb_blank) ret = info->fbops->fb_blank(blank, info); diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h index 7f0a530a913c..90e196c835dd 100644 --- a/include/linux/fbcon.h +++ b/include/linux/fbcon.h @@ -14,6 +14,7 @@ int fbcon_mode_deleted(struct fb_info *info, void fbcon_new_modelist(struct fb_info *info); void fbcon_get_requirement(struct fb_info *info, struct fb_blit_caps *caps); +void fbcon_fb_blanked(struct fb_info *info, int blank); #else static inline void fb_console_init(void) {} static inline void fb_console_exit(void) {} @@ -27,6 +28,7 @@ int fbcon_mode_deleted(struct fb_info *info, void fbcon_new_modelist(struct fb_info *info) {} void fbcon_get_requirement(struct fb_info *info, struct fb_blit_caps *caps) {} +void fbcon_fb_blanked(struct fb_info *info, int blank) {} #endif #endif /* _LINUX_FBCON_H */ From patchwork Mon May 20 08:22:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950475 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C0BEA912 for ; Mon, 20 May 2019 08:24:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2378284A3 for ; Mon, 20 May 2019 08:24:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A688F286AE; Mon, 20 May 2019 08:24:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4274A2873B for ; Mon, 20 May 2019 08:24:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1713C892BB; Mon, 20 May 2019 08:22:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7D14A892CA for ; Mon, 20 May 2019 08:22:55 +0000 (UTC) Received: by mail-ed1-x543.google.com with SMTP id b8so22489816edm.11 for ; Mon, 20 May 2019 01:22:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CumxJ2NtVSEP5RNMzgMskkfGKnWkqYH9OWapQsg3Ykk=; b=JqHenjfZTgXON+9ZawEb2R3BoCuI5C0DC+x/NtYxre5DarA2WFXbtJLUoEGfBtmOVt FwrHLZgGa8l/X+6or73ZwFwwp4yGGD9QHsCZprVjbf3KcviwflG4RGZaiV5ZT2PFLUKz pNhYJ7ImTPiVSyIoISP4YW7gBa+v24FPLIcIQGDzFzlQQUAcah8v1gi/vQSBm6fLQFNQ Tvbld0EpnyiLkKAmlkGLneIBEfIla9xiaumuw/r8nRhsuz/wTI5aprpIyUkfJR6gGf8T RqtsALEj5qt6JuYcnYijd6UIK69vc6YAE5EWQjGqVo7psc3ehitXNAtBhJoCVXmVgr8I cxDw== X-Gm-Message-State: APjAAAXALSR9mSZg5zU5RgxX7A3wa57ubmr1tklFfTEayhzJ70MAhfa5 kur04dGPf03V3enu+KlqyswkPaSpFbs= X-Google-Smtp-Source: APXvYqzKocCCpdIn3BgvIXkZbMH0Ck4pkHA663Xdj8pJGjwyoQ9kIknubmApc8RiuGcyohuJzMWALQ== X-Received: by 2002:a17:906:af57:: with SMTP id ly23mr26150862ejb.98.1558340572842; Mon, 20 May 2019 01:22:52 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:52 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 26/33] fbmem: pull fbcon_fb_blanked out of fb_blank Date: Mon, 20 May 2019 10:22:09 +0200 Message-Id: <20190520082216.26273-27-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CumxJ2NtVSEP5RNMzgMskkfGKnWkqYH9OWapQsg3Ykk=; b=BiYU87eY751NVue2WirSevA+JtWzXlDUBKxpdvOCuE9SFAZutDfx84Zsh7QinEw1+x /YP4ChXJX2Hz4luhn5VXlZYJ8A5mSJGredVJzSCu87xqgKtLxkmTzP1VmxfyzsBTNq8N ff45HA03UxQVhL9TWuRtiTxSXr2xq30e/D90Q= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartlomiej Zolnierkiewicz , Daniel Vetter , Intel Graphics Development , LKML , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Hans de Goede , Mikulas Patocka , Daniel Vetter , Peter Rosin Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP There's a callchain of: fbcon_fb_blaned -> do_(un)blank_screen -> consw->con_blank -> fbcon_blank -> fb_blank Things don't go horribly wrong because the BKL console_lock safes the day, but that's about it. And the seeming recursion is broken in 2 ways: - Starting from the fbdev ioctl we set FBINFO_MISC_USEREVENT, which tells the fbcon_blank code to not call fb_blank. This was required to not deadlock when recursing on the fb_notifier_chain mutex. - Starting from the con_blank hook we're getting saved by the console_blanked checks in do_blank/unblank_screen. Or at least that's my theory. Anyway, recursion isn't awesome, so let's stop it. Breaking the recursion avoids the need to be in the FBINFO_MISC_USEREVENT critical section, so lets move it out of that too. The astute reader will notice that fb_blank seems to require lock_fb_info(), which the fbcon code seems to ignore. I have no idea how to fix that problem, so let's keep ignoring it. v2: I forgot the sysfs blanking code. Signed-off-by: Daniel Vetter Cc: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: "Michał Mirosław" Cc: Peter Rosin Cc: Hans de Goede Cc: Mikulas Patocka Cc: Rob Clark --- drivers/video/fbdev/core/fbmem.c | 4 +++- drivers/video/fbdev/core/fbsysfs.c | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 9932130bf728..7f95c7e80155 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1068,7 +1068,6 @@ fb_blank(struct fb_info *info, int blank) event.data = ␣ early_ret = fb_notifier_call_chain(FB_EARLY_EVENT_BLANK, &event); - fbcon_fb_blanked(info, blank); if (info->fbops->fb_blank) ret = info->fbops->fb_blank(blank, info); @@ -1198,6 +1197,9 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, info->flags |= FBINFO_MISC_USEREVENT; ret = fb_blank(info, arg); info->flags &= ~FBINFO_MISC_USEREVENT; + + /* might again call into fb_blank */ + fbcon_fb_blanked(info, arg); unlock_fb_info(info); console_unlock(); break; diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c index 5f329278e55f..252d4f52d2a5 100644 --- a/drivers/video/fbdev/core/fbsysfs.c +++ b/drivers/video/fbdev/core/fbsysfs.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -305,12 +306,15 @@ static ssize_t store_blank(struct device *device, { struct fb_info *fb_info = dev_get_drvdata(device); char *last = NULL; - int err; + int err, arg; + arg = simple_strtoul(buf, &last, 0); console_lock(); fb_info->flags |= FBINFO_MISC_USEREVENT; - err = fb_blank(fb_info, simple_strtoul(buf, &last, 0)); + err = fb_blank(fb_info, arg); fb_info->flags &= ~FBINFO_MISC_USEREVENT; + /* might again call into fb_blank */ + fbcon_fb_blanked(fb_info, arg); console_unlock(); if (err < 0) return err; From patchwork Mon May 20 08:22:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950481 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3AA20912 for ; Mon, 20 May 2019 08:24:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DD0828740 for ; Mon, 20 May 2019 08:24:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 225DE2874E; Mon, 20 May 2019 08:24:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C695028609 for ; Mon, 20 May 2019 08:24:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D313E892E7; Mon, 20 May 2019 08:23:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3B77A892D7 for ; Mon, 20 May 2019 08:22:56 +0000 (UTC) Received: by mail-ed1-x544.google.com with SMTP id w33so22505989edb.10 for ; Mon, 20 May 2019 01:22:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DjcLsPlsjE209Q795HkarLAUj4qVY5QZ6l/8BCYUlrU=; b=N/Lo2k9xnJMkg+P2GRFmj0Ku+1+raMN0FaEU0JLImE9C/Z8ivO3Ap7UdwS4++gN8eL Ccd4AeHKrCfjOypTXhRPtPVWdG2waXaGwsS1yWK8sYmFr4inumBQON3uRwG5RIOO/uyn BffYz+mkiNAx81+amIEk5ecMuc21TMUqKhQWHVIafYycloHT81lllpPYtRTGHZenROpH VQ/K2p6ywVQmkNnZe7mtp+hmBg+SgipQdgy6yBoPaYZCOhomUM8ypZyEmYNx//JGZU6d cccaiSZ61Mb9d5wmlpSBFZzOc1fpCw7AB4kEUfKSuQFSlem/XliXITx7Gwm90xMNL7NM VTbw== X-Gm-Message-State: APjAAAVZNVR0dCPX7l/hfle1Icgaq/F11SWVgBqocPLjyAFrNNKDQT6I RHJOyIGtv+YlV79ABvPvWIvOurxeot0= X-Google-Smtp-Source: APXvYqz6gMGaKw7InNRAYh/FfyGrrZIJCiKRyHBCsxnsADOp8agSMiMyM3ffksqbZU0sp3KMCISA6Q== X-Received: by 2002:a50:a485:: with SMTP id w5mr28701154edb.78.1558340573984; Mon, 20 May 2019 01:22:53 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:53 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 27/33] fbdev: remove FBINFO_MISC_USEREVENT around fb_blank Date: Mon, 20 May 2019 10:22:10 +0200 Message-Id: <20190520082216.26273-28-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DjcLsPlsjE209Q795HkarLAUj4qVY5QZ6l/8BCYUlrU=; b=F8LgFcDyNEbgtqr09gmvby+A70IlXFhvdKJQGuQU76/bnBUMWD33WhmzV8anIfkPi0 mD3mM5zUjNuB3gBIUmxNtzHTrHn1ZPQphxPlYuP0ARRH9XNaNMlrnJClFCLSGQcOWL0g Q7q+eBvuuOnPjNkfowVtPdLB0l/WbtympM+P0= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartlomiej Zolnierkiewicz , Daniel Vetter , Intel Graphics Development , LKML , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Yisheng Xie , Hans de Goede , Mikulas Patocka , Daniel Vetter , Peter Rosin Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP With the recursion broken in the previous patch we can drop the FBINFO_MISC_USEREVENT flag around calls to fb_blank - recursion prevention was it's only job. Signed-off-by: Daniel Vetter Cc: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Hans de Goede Cc: Yisheng Xie Cc: "Michał Mirosław" Cc: Peter Rosin Cc: Mikulas Patocka Cc: Rob Clark --- drivers/video/fbdev/core/fbcon.c | 5 ++--- drivers/video/fbdev/core/fbmem.c | 3 --- drivers/video/fbdev/core/fbsysfs.c | 2 -- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index f85d794a3bee..c1a7476e980f 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -2382,9 +2382,8 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW); ops->cursor_flash = (!blank); - if (!(info->flags & FBINFO_MISC_USEREVENT)) - if (fb_blank(info, blank)) - fbcon_generic_blank(vc, info, blank); + if (fb_blank(info, blank)) + fbcon_generic_blank(vc, info, blank); } if (!blank) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 7f95c7e80155..65a075ccac4a 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1194,10 +1194,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, case FBIOBLANK: console_lock(); lock_fb_info(info); - info->flags |= FBINFO_MISC_USEREVENT; ret = fb_blank(info, arg); - info->flags &= ~FBINFO_MISC_USEREVENT; - /* might again call into fb_blank */ fbcon_fb_blanked(info, arg); unlock_fb_info(info); diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c index 252d4f52d2a5..882b471d619e 100644 --- a/drivers/video/fbdev/core/fbsysfs.c +++ b/drivers/video/fbdev/core/fbsysfs.c @@ -310,9 +310,7 @@ static ssize_t store_blank(struct device *device, arg = simple_strtoul(buf, &last, 0); console_lock(); - fb_info->flags |= FBINFO_MISC_USEREVENT; err = fb_blank(fb_info, arg); - fb_info->flags &= ~FBINFO_MISC_USEREVENT; /* might again call into fb_blank */ fbcon_fb_blanked(fb_info, arg); console_unlock(); From patchwork Mon May 20 08:22:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950497 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 28226912 for ; Mon, 20 May 2019 08:24:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A49E2874C for ; Mon, 20 May 2019 08:24:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EB602874A; Mon, 20 May 2019 08:24:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 939B32873B for ; Mon, 20 May 2019 08:24:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 359A8892EA; Mon, 20 May 2019 08:23:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id 10005892CA for ; Mon, 20 May 2019 08:22:57 +0000 (UTC) Received: by mail-ed1-x543.google.com with SMTP id l25so22499851eda.9 for ; Mon, 20 May 2019 01:22:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Z0bTEF5xAXjjtD3WRRyxu8w7iJRGktyXqotRP83G5Cc=; b=lzl+OElsHAehVmW7/TMjFTdYkGvGcIuN1QMJYwSJJJ+OZrRfjlJs5uNuPgkhif/gw1 mpgyFoZYuouQkVxCNxboiI0wBLb7ZXZnIKvkhyG14NvvzgyuNVATsSNrXk7WxitwnTqp 5fvKSMvzCxv7xxeiXBHMi70Qq/tf7RJYRzfLbBv258puHYnCkYwxew7w9iBCsTrzhom4 v0FjRkmfEx2leBZuCxqZ1jXgXxC2sa94oX9JAGc5UgedYa1jRKYdNiRyBDbCf8nNUmm6 B4ONaQTNBpAV1EY1zxax7rs6COaJ3UYaNlMrOznHfD+tWV++H4UYUVSdEXH6rPVMveRb JBxQ== X-Gm-Message-State: APjAAAWyDg6tCEKTJrLOM5o5LxY8WkotohpYgDzyTq+zVCYiC34o3TYw KKEvC+09khZjQDzQ0FPXEDwbu+HAIZ8= X-Google-Smtp-Source: APXvYqwEhuODT9HvDQ/LcQ4deagLmc07/7ACbdQuA0BgS1q7uFDeseO/NLUr+JD2J1kIL7LXR+cxxQ== X-Received: by 2002:a50:9968:: with SMTP id l37mr73321916edb.143.1558340574981; Mon, 20 May 2019 01:22:54 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:54 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 28/33] fb: Flatten control flow in fb_set_var Date: Mon, 20 May 2019 10:22:11 +0200 Message-Id: <20190520082216.26273-29-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Z0bTEF5xAXjjtD3WRRyxu8w7iJRGktyXqotRP83G5Cc=; b=Gk4MRvpMNEfVB2X+OOebAKyfX0in1mHPZ9BrDj1zyh/mFdNb3mH1zO+hzmyNRueWJc zOKL/wYTkD0sOt0RrnOsIjSqOko9qdc2CHrUAdkQDff6InAn7T6/6J+QU3xxnBe08sBi /qwOOjF1PAXAgBps2YI8r1Vp0kMRKg/17qap0= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartlomiej Zolnierkiewicz , Daniel Vetter , Intel Graphics Development , LKML , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Hans de Goede , Mikulas Patocka , Daniel Vetter , Peter Rosin Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Instead of wiring almost everything down to the very last line using goto soup (but not consistently, where would the fun be otherwise) drop out early when checks fail. This allows us to flatten the huge indent levels to just 1. Aside: If a driver doesn't set ->fb_check_var, then FB_ACTIVATE_NOW does nothing. This bug exists ever since this code was extracted as a common helper in 2002, hence I decided against fixing it. Everyone just better have a fb_check_var to make sure things work correctly. Signed-off-by: Daniel Vetter Cc: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: "Michał Mirosław" Cc: Peter Rosin Cc: Hans de Goede Cc: Mikulas Patocka --- drivers/video/fbdev/core/fbmem.c | 126 +++++++++++++++---------------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 65a075ccac4a..cbd58ba8a59d 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -954,6 +954,9 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) { int flags = info->flags; int ret = 0; + u32 activate; + struct fb_var_screeninfo old_var; + struct fb_videomode mode; if (var->activate & FB_ACTIVATE_INV_MODE) { struct fb_videomode mode1, mode2; @@ -970,87 +973,84 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) fb_delete_videomode(&mode1, &info->modelist); - ret = (ret) ? -EINVAL : 0; - goto done; + return ret ? -EINVAL : 0; } - if ((var->activate & FB_ACTIVATE_FORCE) || - memcmp(&info->var, var, sizeof(struct fb_var_screeninfo))) { - u32 activate = var->activate; + if (!(var->activate & FB_ACTIVATE_FORCE) && + !memcmp(&info->var, var, sizeof(struct fb_var_screeninfo))) + return 0; - /* When using FOURCC mode, make sure the red, green, blue and - * transp fields are set to 0. - */ - if ((info->fix.capabilities & FB_CAP_FOURCC) && - var->grayscale > 1) { - if (var->red.offset || var->green.offset || - var->blue.offset || var->transp.offset || - var->red.length || var->green.length || - var->blue.length || var->transp.length || - var->red.msb_right || var->green.msb_right || - var->blue.msb_right || var->transp.msb_right) - return -EINVAL; - } + activate = var->activate; - if (!info->fbops->fb_check_var) { - *var = info->var; - goto done; - } + /* When using FOURCC mode, make sure the red, green, blue and + * transp fields are set to 0. + */ + if ((info->fix.capabilities & FB_CAP_FOURCC) && + var->grayscale > 1) { + if (var->red.offset || var->green.offset || + var->blue.offset || var->transp.offset || + var->red.length || var->green.length || + var->blue.length || var->transp.length || + var->red.msb_right || var->green.msb_right || + var->blue.msb_right || var->transp.msb_right) + return -EINVAL; + } + + if (!info->fbops->fb_check_var) { + *var = info->var; + return 0; + } - ret = info->fbops->fb_check_var(var, info); + ret = info->fbops->fb_check_var(var, info); - if (ret) - goto done; + if (ret) + return ret; - if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) { - struct fb_var_screeninfo old_var; - struct fb_videomode mode; + if ((var->activate & FB_ACTIVATE_MASK) != FB_ACTIVATE_NOW) + return 0; - if (info->fbops->fb_get_caps) { - ret = fb_check_caps(info, var, activate); + if (info->fbops->fb_get_caps) { + ret = fb_check_caps(info, var, activate); - if (ret) - goto done; - } + if (ret) + return ret; + } - old_var = info->var; - info->var = *var; + old_var = info->var; + info->var = *var; - if (info->fbops->fb_set_par) { - ret = info->fbops->fb_set_par(info); + if (info->fbops->fb_set_par) { + ret = info->fbops->fb_set_par(info); - if (ret) { - info->var = old_var; - printk(KERN_WARNING "detected " - "fb_set_par error, " - "error code: %d\n", ret); - goto done; - } - } + if (ret) { + info->var = old_var; + printk(KERN_WARNING "detected " + "fb_set_par error, " + "error code: %d\n", ret); + return ret; + } + } - fb_pan_display(info, &info->var); - fb_set_cmap(&info->cmap, info); - fb_var_to_videomode(&mode, &info->var); + fb_pan_display(info, &info->var); + fb_set_cmap(&info->cmap, info); + fb_var_to_videomode(&mode, &info->var); - if (info->modelist.prev && info->modelist.next && - !list_empty(&info->modelist)) - ret = fb_add_videomode(&mode, &info->modelist); + if (info->modelist.prev && info->modelist.next && + !list_empty(&info->modelist)) + ret = fb_add_videomode(&mode, &info->modelist); - if (!ret && (flags & FBINFO_MISC_USEREVENT)) { - struct fb_event event; - int evnt = (activate & FB_ACTIVATE_ALL) ? - FB_EVENT_MODE_CHANGE_ALL : - FB_EVENT_MODE_CHANGE; + if (!ret && (flags & FBINFO_MISC_USEREVENT)) { + struct fb_event event; + int evnt = (activate & FB_ACTIVATE_ALL) ? + FB_EVENT_MODE_CHANGE_ALL : + FB_EVENT_MODE_CHANGE; - info->flags &= ~FBINFO_MISC_USEREVENT; - event.info = info; - event.data = &mode; - fb_notifier_call_chain(evnt, &event); - } - } + info->flags &= ~FBINFO_MISC_USEREVENT; + event.info = info; + event.data = &mode; + fb_notifier_call_chain(evnt, &event); } - done: return ret; } EXPORT_SYMBOL(fb_set_var); From patchwork Mon May 20 08:22:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950479 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AEC9B76 for ; Mon, 20 May 2019 08:24:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F8C520134 for ; Mon, 20 May 2019 08:24:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92E2C2873D; Mon, 20 May 2019 08:24:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0E43520134 for ; Mon, 20 May 2019 08:24:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 41004892F0; Mon, 20 May 2019 08:23:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id D8173892F2 for ; Mon, 20 May 2019 08:22:57 +0000 (UTC) Received: by mail-ed1-x543.google.com with SMTP id p27so22586996eda.1 for ; Mon, 20 May 2019 01:22:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q6P++AEHOfkI5D/k3xa/uIHx1Va0IWogL9C+chYy+0M=; b=r/d15iIgEQQ2Oh2OQcix3ZNAKySeIBYOKpGcWYNoUy6Fwtk9Oze5sdS4vF7N0O1aqD vwY5TH2Io73VcgdFrUDP0ZpUnf+M4zfS6rKjqRZ3VripAkdbq9hhFtyQBBvDzw44TmIU kMPOyyUM34IE4hxc2SlXBrWLrtnFZWumff0l3SYoOw0+lpNKjBo1o0ghbAAoYfqlDtsS uFZyFjes2er4SSVZv+UiLZIvFIPIsW5ZKNtuoe5XsQg+EgvJaWKXg8FjFi2IprDSrq0b x/VjuJOzScsAmU7z3rJ66hlBj41ZKn5qpjJJOFoJgOCEyhdcFlauTENlqE1vE4zuRCBx b7Pw== X-Gm-Message-State: APjAAAVsLycohST/1YDXtvWFzm4b+0jUsyIF262oAPsTvjV8HOcndOVT i28M72vVardcaat/4Vs1jGsyRW0uTOM= X-Google-Smtp-Source: APXvYqxLFYQEccqbEEoz4CZU1c0rosU1RFmwQ6qoAwQYvN4E5ULWhShEPi+9ab13r9OQgEDxJDJ+rg== X-Received: by 2002:a50:f4fb:: with SMTP id v56mr75508876edm.13.1558340576097; Mon, 20 May 2019 01:22:56 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:55 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 29/33] fbcon: replace FB_EVENT_MODE_CHANGE/_ALL with direct calls Date: Mon, 20 May 2019 10:22:12 +0200 Message-Id: <20190520082216.26273-30-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q6P++AEHOfkI5D/k3xa/uIHx1Va0IWogL9C+chYy+0M=; b=PK3f3Vx3oGduWZ98IJle+zkC490p6u9MUtW5NT7k59m0xD/RLGW62SSq1cXa4+HyvR 9s09i/sm7ZsfA8jQVdfHcNfDOUl4YNOuEmOEq4mHqED0v9IXc7M5rAOs7v0fhV3EF6Vs TG+33NSX7tt76hfxV8/MJG4YgU6ZMRh+hCFa8= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Intel Graphics Development , LKML , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Yisheng Xie , Hans de Goede , Mikulas Patocka , linux-fbdev@vger.kernel.org, Jingoo Han , Daniel Vetter , Lee Jones , Peter Rosin Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Create a new wrapper function for this, feels like there's some refactoring room here between the two modes. Signed-off-by: Daniel Vetter Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: Hans de Goede Cc: Yisheng Xie Cc: "Michał Mirosław" Cc: Peter Rosin Cc: Mikulas Patocka Cc: linux-fbdev@vger.kernel.org --- drivers/video/backlight/lcd.c | 2 -- drivers/video/fbdev/core/fbcon.c | 15 +++++++++------ drivers/video/fbdev/core/fbmem.c | 13 ++----------- drivers/video/fbdev/sh_mobile_lcdcfb.c | 11 +---------- include/linux/fb.h | 4 ---- include/linux/fbcon.h | 2 ++ 6 files changed, 14 insertions(+), 33 deletions(-) diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c index 4b40c6a4d441..16298041b141 100644 --- a/drivers/video/backlight/lcd.c +++ b/drivers/video/backlight/lcd.c @@ -32,8 +32,6 @@ static int fb_notifier_callback(struct notifier_block *self, /* If we aren't interested in this event, skip it immediately ... */ switch (event) { case FB_EVENT_BLANK: - case FB_EVENT_MODE_CHANGE: - case FB_EVENT_MODE_CHANGE_ALL: case FB_EARLY_EVENT_BLANK: case FB_R_EARLY_EVENT_BLANK: break; diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index c1a7476e980f..8cc62d340387 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3005,6 +3005,15 @@ static void fbcon_set_all_vcs(struct fb_info *info) fbcon_modechanged(info); } + +void fbcon_update_vcs(struct fb_info *info, bool all) +{ + if (all) + fbcon_set_all_vcs(info); + else + fbcon_modechanged(info); +} + int fbcon_mode_deleted(struct fb_info *info, struct fb_videomode *mode) { @@ -3314,12 +3323,6 @@ static int fbcon_event_notify(struct notifier_block *self, int idx, ret = 0; switch(action) { - case FB_EVENT_MODE_CHANGE: - fbcon_modechanged(info); - break; - case FB_EVENT_MODE_CHANGE_ALL: - fbcon_set_all_vcs(info); - break; case FB_EVENT_SET_CONSOLE_MAP: /* called with console lock held */ con2fb = event->data; diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index cbd58ba8a59d..55b88163edc2 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1039,17 +1039,8 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) !list_empty(&info->modelist)) ret = fb_add_videomode(&mode, &info->modelist); - if (!ret && (flags & FBINFO_MISC_USEREVENT)) { - struct fb_event event; - int evnt = (activate & FB_ACTIVATE_ALL) ? - FB_EVENT_MODE_CHANGE_ALL : - FB_EVENT_MODE_CHANGE; - - info->flags &= ~FBINFO_MISC_USEREVENT; - event.info = info; - event.data = &mode; - fb_notifier_call_chain(evnt, &event); - } + if (!ret && (flags & FBINFO_MISC_USEREVENT)) + fbcon_update_vcs(info, activate & FB_ACTIVATE_ALL); return ret; } diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c index 0d7a044852d7..bb1a610d0363 100644 --- a/drivers/video/fbdev/sh_mobile_lcdcfb.c +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c @@ -1776,8 +1776,6 @@ static void sh_mobile_fb_reconfig(struct fb_info *info) struct sh_mobile_lcdc_chan *ch = info->par; struct fb_var_screeninfo var; struct fb_videomode mode; - struct fb_event event; - int evnt = FB_EVENT_MODE_CHANGE_ALL; if (ch->use_count > 1 || (ch->use_count == 1 && !info->fbcon_par)) /* More framebuffer users are active */ @@ -1799,14 +1797,7 @@ static void sh_mobile_fb_reconfig(struct fb_info *info) /* Couldn't reconfigure, hopefully, can continue as before */ return; - /* - * fb_set_var() calls the notifier change internally, only if - * FBINFO_MISC_USEREVENT flag is set. Since we do not want to fake a - * user event, we have to call the chain ourselves. - */ - event.info = info; - event.data = &ch->display.mode; - fb_notifier_call_chain(evnt, &event); + fbcon_update_vcs(info, true); } /* diff --git a/include/linux/fb.h b/include/linux/fb.h index 4b9b882f8f52..54d6bee09121 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -124,16 +124,12 @@ struct fb_cursor_user { * Register/unregister for framebuffer events */ -/* The resolution of the passed in fb_info about to change */ -#define FB_EVENT_MODE_CHANGE 0x01 /* CONSOLE-SPECIFIC: get console to framebuffer mapping */ #define FB_EVENT_GET_CONSOLE_MAP 0x07 /* CONSOLE-SPECIFIC: set console to framebuffer mapping */ #define FB_EVENT_SET_CONSOLE_MAP 0x08 /* A display blank is requested */ #define FB_EVENT_BLANK 0x09 -/* Private modelist is to be replaced */ -#define FB_EVENT_MODE_CHANGE_ALL 0x0B /* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */ #define FB_EVENT_REMAP_ALL_CONSOLE 0x0F /* A hardware display blank early change occurred */ diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h index 90e196c835dd..daaa97b0c9e6 100644 --- a/include/linux/fbcon.h +++ b/include/linux/fbcon.h @@ -15,6 +15,7 @@ void fbcon_new_modelist(struct fb_info *info); void fbcon_get_requirement(struct fb_info *info, struct fb_blit_caps *caps); void fbcon_fb_blanked(struct fb_info *info, int blank); +void fbcon_update_vcs(struct fb_info *info, bool all); #else static inline void fb_console_init(void) {} static inline void fb_console_exit(void) {} @@ -29,6 +30,7 @@ void fbcon_new_modelist(struct fb_info *info) {} void fbcon_get_requirement(struct fb_info *info, struct fb_blit_caps *caps) {} void fbcon_fb_blanked(struct fb_info *info, int blank) {} +void fbcon_update_vcs(struct fb_info *info, bool all) {} #endif #endif /* _LINUX_FBCON_H */ From patchwork Mon May 20 08:22:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950499 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AE84C76 for ; Mon, 20 May 2019 08:24:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DEE2284A3 for ; Mon, 20 May 2019 08:24:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 909562874B; Mon, 20 May 2019 08:24:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2017028740 for ; Mon, 20 May 2019 08:24:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D00E389321; Mon, 20 May 2019 08:23:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4D8E2892CC for ; Mon, 20 May 2019 08:23:00 +0000 (UTC) Received: by mail-ed1-x543.google.com with SMTP id n17so22609593edb.0 for ; Mon, 20 May 2019 01:23:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gP9JWtZYIDChqhoaVz3EsPvoQXah1TnF7aRj3vegt3E=; b=SsYKxj3mX6V++9pC/6x+icqjIwQFiw4XOf1zkdaxIi+cUD8umt9BAFhXqKa9qi8/53 lOIT0rRPqK9WniJSpPn2c4D96eqO+5nn2TrfQhmLzWmWXXlTtYyyULWCigQe1/0L/wJ5 JWYYAUYfvPHrIUTbV15pmRxMvCh22sCLoeUcHE9jANdT9+fv4ZXjVbp1eQwe19uewYVG TPFRN2a56wNwaGfdxu5o54HcisorTXb27EBvBgNE2DNY6D2PeI+wqFgXFHK5eA+EIPY0 vWmz0lRwWRPcD17FaGCuDjYyQmLxXVb+F9bAdFY6cPTR+DqpPXR3aJYYV+4uu+8AkHOp Q8uA== X-Gm-Message-State: APjAAAUZdDCswF1kcbWVLeE2ITBXvsuGzHH7Jge0fnrHEKZNjYgyRRgu T2+P9bHqAr9ctWjJTN/bfq2u2qcdQRw= X-Google-Smtp-Source: APXvYqzSe/uoCy8plrFShz+D+0lTuXDe8CAAGZgk03dqPaYS7lZWXOEAi0arPyI9QcUZ0NHbZhWtTQ== X-Received: by 2002:a17:906:8311:: with SMTP id j17mr32001014ejx.227.1558340577317; Mon, 20 May 2019 01:22:57 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:56 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 30/33] vgaswitcheroo: call fbcon_remap_all directly Date: Mon, 20 May 2019 10:22:13 +0200 Message-Id: <20190520082216.26273-31-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gP9JWtZYIDChqhoaVz3EsPvoQXah1TnF7aRj3vegt3E=; b=BUP+ZVHpSa6cm0eQ2i5P1I8TI4De/3rS6Ui4iYSGE+J5pYNyl3gfHlOQEBrM87Khlv cmiALWLfTnw2dtMq3P7g/q1F6wThHrEk8buZl4oanGqblRMMZmgwQMeAsYNtDMNs4cwx qW8Cp2AQc8vCtMxYwY4yv2TiXOCexYNIQBfi4= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hans de Goede , Bartlomiej Zolnierkiewicz , David Airlie , Daniel Vetter , Intel Graphics Development , LKML , linux-fbdev@vger.kernel.org, Yisheng Xie , Maxime Ripard , Daniel Vetter , Sean Paul Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP While at it, clean up the interface a bit and push the console locking into fbcon.c. Signed-off-by: Daniel Vetter Cc: Lukas Wunner Cc: David Airlie Cc: Daniel Vetter Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Sean Paul Cc: Bartlomiej Zolnierkiewicz Cc: Hans de Goede Cc: Yisheng Xie Cc: linux-fbdev@vger.kernel.org Acked-by: Lukas Wunner --- drivers/gpu/vga/vga_switcheroo.c | 11 +++-------- drivers/video/fbdev/core/fbcon.c | 13 +++++-------- include/linux/fb.h | 2 -- include/linux/fbcon.h | 2 ++ 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c index a132c37d7334..65d7541c413a 100644 --- a/drivers/gpu/vga/vga_switcheroo.c +++ b/drivers/gpu/vga/vga_switcheroo.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -736,14 +737,8 @@ static int vga_switchto_stage2(struct vga_switcheroo_client *new_client) if (!active->driver_power_control) set_audio_state(active->id, VGA_SWITCHEROO_OFF); - if (new_client->fb_info) { - struct fb_event event; - - console_lock(); - event.info = new_client->fb_info; - fb_notifier_call_chain(FB_EVENT_REMAP_ALL_CONSOLE, &event); - console_unlock(); - } + if (new_client->fb_info) + fbcon_remap_all(new_client->fb_info); mutex_lock(&vgasr_priv.mux_hw_lock); ret = vgasr_priv.handler->switchto(new_client->id); diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 8cc62d340387..fd604ffb3c05 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3146,16 +3146,16 @@ void fbcon_fb_unregistered(struct fb_info *info) } /* called with console_lock held */ -static void fbcon_remap_all(int idx) +void fbcon_remap_all(struct fb_info *info) { - int i; - - WARN_CONSOLE_UNLOCKED(); + int i, idx = info->node; + console_lock(); if (deferred_takeover) { for (i = first_fb_vc; i <= last_fb_vc; i++) con2fb_map_boot[i] = idx; fbcon_map_override(); + console_unlock(); return; } @@ -3168,6 +3168,7 @@ static void fbcon_remap_all(int idx) first_fb_vc + 1, last_fb_vc + 1); info_idx = idx; } + console_unlock(); } #ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY @@ -3333,10 +3334,6 @@ static int fbcon_event_notify(struct notifier_block *self, con2fb = event->data; con2fb->framebuffer = con2fb_map[con2fb->console - 1]; break; - case FB_EVENT_REMAP_ALL_CONSOLE: - idx = info->node; - fbcon_remap_all(idx); - break; } return ret; } diff --git a/include/linux/fb.h b/include/linux/fb.h index 54d6bee09121..acd8daa23002 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -130,8 +130,6 @@ struct fb_cursor_user { #define FB_EVENT_SET_CONSOLE_MAP 0x08 /* A display blank is requested */ #define FB_EVENT_BLANK 0x09 -/* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */ -#define FB_EVENT_REMAP_ALL_CONSOLE 0x0F /* A hardware display blank early change occurred */ #define FB_EARLY_EVENT_BLANK 0x10 /* A hardware display blank revert early change occurred */ diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h index daaa97b0c9e6..3f854e803746 100644 --- a/include/linux/fbcon.h +++ b/include/linux/fbcon.h @@ -16,6 +16,7 @@ void fbcon_get_requirement(struct fb_info *info, struct fb_blit_caps *caps); void fbcon_fb_blanked(struct fb_info *info, int blank); void fbcon_update_vcs(struct fb_info *info, bool all); +void fbcon_remap_all(struct fb_info *info); #else static inline void fb_console_init(void) {} static inline void fb_console_exit(void) {} @@ -31,6 +32,7 @@ void fbcon_get_requirement(struct fb_info *info, struct fb_blit_caps *caps) {} void fbcon_fb_blanked(struct fb_info *info, int blank) {} void fbcon_update_vcs(struct fb_info *info, bool all) {} +void fbcon_remap_all(struct fb_info *info) {} #endif #endif /* _LINUX_FBCON_H */ From patchwork Mon May 20 08:22:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950495 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BEE74912 for ; Mon, 20 May 2019 08:24:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B045A2874A for ; Mon, 20 May 2019 08:24:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4AA228748; Mon, 20 May 2019 08:24:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 28BA82862A for ; Mon, 20 May 2019 08:24:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 21904892FF; Mon, 20 May 2019 08:23:06 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id C1BA6892E7 for ; Mon, 20 May 2019 08:23:02 +0000 (UTC) Received: by mail-ed1-x544.google.com with SMTP id p26so22582388edr.2 for ; Mon, 20 May 2019 01:23:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ptn+ekZzhb2EANVyrbPFjMvHGMqs35lbdt+VKTwDqHU=; b=M7ThCi/8RyCcbdF9DuhenarGFnDb37MT6Lp/T5PW8Erb3yQnlF0FPlKIsoGdIRd1Xg Qhkn9IzAz4nqzO7m9zqESutoEkZmujqhI4+p5EYxG0wQVVDNBfT3QDh+cbe+LVQzcALt 4IryyfkTyRv0hWThmczxbFJIf6gsYspo/MCQacdTUJ7/ZVBIjxhWPUZN/8CQTJ0XLAzw 1Lx6dceyQxMzB4TWMX0BXoWCtu4LGoKlRt8TvyGQoBK83EmIwvVCW05ik7aK39mvzFjC tnDVaAzNyK9eEizXc1AwXI2YdnCKsWXQEAwocJecX/5Nsua2ulyldBl13udFtINWEBta hz0w== X-Gm-Message-State: APjAAAWn7WapZYExm+OT8STBVs29Dag3lixgYw3kOs2YsHId3vZmhd7u 3ez7mGB5zwejgQ442EPRY4LraOpgr1g= X-Google-Smtp-Source: APXvYqy/d9Gji8lKFzbGJm5BP4wSEEkaVtLPzo0DeLjLhV0ZqszW1BghTiJqiFZNWq0aUSbu8mZtrg== X-Received: by 2002:a17:906:5586:: with SMTP id y6mr16134301ejp.120.1558340578591; Mon, 20 May 2019 01:22:58 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:57 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 31/33] fbcon: Call con2fb_map functions directly Date: Mon, 20 May 2019 10:22:14 +0200 Message-Id: <20190520082216.26273-32-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ptn+ekZzhb2EANVyrbPFjMvHGMqs35lbdt+VKTwDqHU=; b=ahxUG18a6ZrhED+Kaap9n2LcPyJx/AVZ4FHMt8VfvV2aG/SlIV8p+P2fUMBKVQPAt6 oAJO0NT5IA5U/6kfhdEA4Ck5KPKx4KORWio+KC4U0mdQgVB2ryemPWk3YkvY8IiIJHrp Rl/Cab3rac+aqYK0cBsjGoQjpzxyYqhAcGDtk= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartlomiej Zolnierkiewicz , Daniel Vetter , Intel Graphics Development , LKML , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Yisheng Xie , Hans de Goede , Mikulas Patocka , Daniel Vetter , Peter Rosin Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP These are actually fbcon ioctls which just happen to be exposed through /dev/fb*. They completely ignore which fb_info they're called on, and I think the userspace tool even hardcodes to /dev/fb0. Hence just forward the entire thing to fbcon.c wholesale. Note that this patch drops the fb_lock/unlock on the set side. Since the ioctl can operate on any fb (as passed in through con2fb.framebuffer) this is bogus. Also note that fbcon.c in general never calls fb_lock on anything, so this has been badly broken already. With this the last user of the fbcon notifier callback is gone, and we can garbage collect that too. Signed-off-by: Daniel Vetter Cc: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Hans de Goede Cc: Yisheng Xie Cc: "Michał Mirosław" Cc: Peter Rosin Cc: Mikulas Patocka --- drivers/video/fbdev/core/fbcon.c | 62 +++++++++++++++++++------------- drivers/video/fbdev/core/fbmem.c | 34 ++---------------- include/linux/fbcon.h | 4 +++ 3 files changed, 43 insertions(+), 57 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index fd604ffb3c05..b40b56702c61 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3315,29 +3315,47 @@ void fbcon_get_requirement(struct fb_info *info, } } -static int fbcon_event_notify(struct notifier_block *self, - unsigned long action, void *data) -{ - struct fb_event *event = data; - struct fb_info *info = event->info; - struct fb_con2fbmap *con2fb; - int idx, ret = 0; - - switch(action) { - case FB_EVENT_SET_CONSOLE_MAP: - /* called with console lock held */ - con2fb = event->data; - ret = set_con2fb_map(con2fb->console - 1, - con2fb->framebuffer, 1); - break; - case FB_EVENT_GET_CONSOLE_MAP: - con2fb = event->data; - con2fb->framebuffer = con2fb_map[con2fb->console - 1]; - break; +int fbcon_set_con2fb_map_ioctl(void __user *argp) +{ + struct fb_con2fbmap con2fb; + int ret; + + if (copy_from_user(&con2fb, argp, sizeof(con2fb))) + return -EFAULT; + if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES) + return -EINVAL; + if (con2fb.framebuffer >= FB_MAX) + return -EINVAL; + if (!registered_fb[con2fb.framebuffer]) + request_module("fb%d", con2fb.framebuffer); + if (!registered_fb[con2fb.framebuffer]) { + return -EINVAL; } + + console_lock(); + ret = set_con2fb_map(con2fb.console - 1, + con2fb.framebuffer, 1); + console_unlock(); + return ret; } +int fbcon_get_con2fb_map_ioctl(void __user *argp) +{ + struct fb_con2fbmap con2fb; + + if (copy_from_user(&con2fb, argp, sizeof(con2fb))) + return -EFAULT; + if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES) + return -EINVAL; + + console_lock(); + con2fb.framebuffer = con2fb_map[con2fb.console - 1]; + console_unlock(); + + return copy_to_user(argp, &con2fb, sizeof(con2fb)) ? -EFAULT : 0; +} + /* * The console `switch' structure for the frame buffer based console */ @@ -3369,10 +3387,6 @@ static const struct consw fb_con = { .con_debug_leave = fbcon_debug_leave, }; -static struct notifier_block fbcon_event_notifier = { - .notifier_call = fbcon_event_notify, -}; - static ssize_t store_rotate(struct device *device, struct device_attribute *attr, const char *buf, size_t count) @@ -3645,7 +3659,6 @@ void __init fb_console_init(void) int i; console_lock(); - fb_register_client(&fbcon_event_notifier); fbcon_device = device_create(fb_class, NULL, MKDEV(0, 0), NULL, "fbcon"); @@ -3681,7 +3694,6 @@ static void __exit fbcon_deinit_device(void) void __exit fb_console_exit(void) { console_lock(); - fb_unregister_client(&fbcon_event_notifier); fbcon_deinit_device(); device_destroy(fb_class, MKDEV(0, 0)); fbcon_exit(); diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 55b88163edc2..c5cf02e68e25 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1084,10 +1084,8 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, struct fb_ops *fb; struct fb_var_screeninfo var; struct fb_fix_screeninfo fix; - struct fb_con2fbmap con2fb; struct fb_cmap cmap_from; struct fb_cmap_user cmap; - struct fb_event event; void __user *argp = (void __user *)arg; long ret = 0; @@ -1149,38 +1147,10 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, ret = -EINVAL; break; case FBIOGET_CON2FBMAP: - if (copy_from_user(&con2fb, argp, sizeof(con2fb))) - return -EFAULT; - if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES) - return -EINVAL; - con2fb.framebuffer = -1; - event.data = &con2fb; - lock_fb_info(info); - event.info = info; - fb_notifier_call_chain(FB_EVENT_GET_CONSOLE_MAP, &event); - unlock_fb_info(info); - ret = copy_to_user(argp, &con2fb, sizeof(con2fb)) ? -EFAULT : 0; + ret = fbcon_get_con2fb_map_ioctl(argp); break; case FBIOPUT_CON2FBMAP: - if (copy_from_user(&con2fb, argp, sizeof(con2fb))) - return -EFAULT; - if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES) - return -EINVAL; - if (con2fb.framebuffer >= FB_MAX) - return -EINVAL; - if (!registered_fb[con2fb.framebuffer]) - request_module("fb%d", con2fb.framebuffer); - if (!registered_fb[con2fb.framebuffer]) { - ret = -EINVAL; - break; - } - event.data = &con2fb; - console_lock(); - lock_fb_info(info); - event.info = info; - ret = fb_notifier_call_chain(FB_EVENT_SET_CONSOLE_MAP, &event); - unlock_fb_info(info); - console_unlock(); + ret = fbcon_set_con2fb_map_ioctl(argp); break; case FBIOBLANK: console_lock(); diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h index 3f854e803746..8dfd1aa40483 100644 --- a/include/linux/fbcon.h +++ b/include/linux/fbcon.h @@ -17,6 +17,8 @@ void fbcon_get_requirement(struct fb_info *info, void fbcon_fb_blanked(struct fb_info *info, int blank); void fbcon_update_vcs(struct fb_info *info, bool all); void fbcon_remap_all(struct fb_info *info); +int fbcon_set_con2fb_map_ioctl(void __user *argp); +int fbcon_get_con2fb_map_ioctl(void __user *argp); #else static inline void fb_console_init(void) {} static inline void fb_console_exit(void) {} @@ -33,6 +35,8 @@ void fbcon_get_requirement(struct fb_info *info, void fbcon_fb_blanked(struct fb_info *info, int blank) {} void fbcon_update_vcs(struct fb_info *info, bool all) {} void fbcon_remap_all(struct fb_info *info) {} +int fbcon_set_con2fb_map_ioctl(void __user *argp) { return 0; } +int fbcon_get_con2fb_map_ioctl(void __user *argp) { return 0; } #endif #endif /* _LINUX_FBCON_H */ From patchwork Mon May 20 08:22:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950503 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0BB2C912 for ; Mon, 20 May 2019 08:24:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1CD42873B for ; Mon, 20 May 2019 08:24:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E5FC428740; Mon, 20 May 2019 08:24:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A3A3E20134 for ; Mon, 20 May 2019 08:24:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1103989306; Mon, 20 May 2019 08:23:10 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7B0ED892BD for ; Mon, 20 May 2019 08:23:03 +0000 (UTC) Received: by mail-ed1-x543.google.com with SMTP id p26so22582466edr.2 for ; Mon, 20 May 2019 01:23:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FCOGJKruV68PCMlFcu0Jcdh8P9H2/Ftv0Ji3KZWmbUo=; b=j/KxeQGkyV+G0SWYbZeMsGwbaS20u0aCMBJVBnrpFh4rT7wi5sXqoNHXlOP5NQTYYt AERlLeKYYVNX/olPZ55OBtECyjdKoF6u+SjfxmnuvCqL7nYe38X1tho8y63xwMYyvOVQ xRroIJ+dgksZg5ucgCDYSFkcKZOWiigKZPQ2aXs2sS6CvocrTdbtJjw6UXO5esEoMvua d5vK7uun8FBuw/+/MCV07eokdt9CRzGuqNq8o34Xw8oZ4PqUCizmYxO3U1ikJB5m25it /K4TyTRuHTDjqjnB/ihRxpVSdhwzaiAxao7r57JwSftCY+UkPbkK1ht0HqmcNcO2XD7W YEuA== X-Gm-Message-State: APjAAAUgrbXnTZ4/U8pp3aMVZnZXty4qICGodvmsU6ZJT57bjVojER1U yPRd+oirXUJ2mo+KTYkraOM0R79PzXo= X-Google-Smtp-Source: APXvYqz+JhrLTRZhNTc3DaIv8DkUxRltlxdyj4OAkPrhoscMsBVYEJlPpazmYVAIf3UpLblLmQV4AQ== X-Received: by 2002:a17:906:7d50:: with SMTP id l16mr57720102ejp.84.1558340579630; Mon, 20 May 2019 01:22:59 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:59 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 32/33] fbcon: Document what I learned about fbcon locking Date: Mon, 20 May 2019 10:22:15 +0200 Message-Id: <20190520082216.26273-33-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FCOGJKruV68PCMlFcu0Jcdh8P9H2/Ftv0Ji3KZWmbUo=; b=Rbh03cPzhJBRqu9N582ybR/hmSNxX1iWpRzgNhumzuQbtDBL/jZRwtE6ZiEMqds9e5 nCEi/0ReTps2K5chpBg2DyfeG8uZ0uMJ48T7NmIfs/PZqn8j6RZVAiv4FMoOYEF4THte f9YBRVbl9RZXkjWKtYSH8orRr9dQVQY+ptY/M= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartlomiej Zolnierkiewicz , Daniel Vetter , Intel Graphics Development , LKML , Yisheng Xie , Hans de Goede , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP It's not pretty. Signed-off-by: Daniel Vetter Cc: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Hans de Goede Cc: Yisheng Xie Reviewed-by: Maarten Lankhorst --- drivers/video/fbdev/core/fbcon.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index b40b56702c61..cbbcf7a795f2 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -87,6 +87,25 @@ # define DPRINTK(fmt, args...) #endif +/* + * FIXME: Locking + * + * - fbcon state itself is protected by the console_lock, and the code does a + * pretty good job at making sure that lock is held everywhere it's needed. + * + * - access to the registered_fb array is entirely unprotected. This should use + * proper object lifetime handling, i.e. get/put_fb_info. This also means + * switching from indices to proper pointers for fb_info everywhere. + * + * - fbcon doesn't bother with fb_lock/unlock at all. This is buggy, since it + * means concurrent access to the same fbdev from both fbcon and userspace + * will blow up. To fix this all fbcon calls from fbmem.c need to be moved out + * of fb_lock/unlock protected sections, since otherwise we'll recurse and + * deadlock eventually. Aside: Due to these deadlock issues the fbdev code in + * fbmem.c cannot use locking asserts, and there's lots of callers which get + * the rules wrong, e.g. fbsysfs.c entirely missed fb_lock/unlock calls too. + */ + enum { FBCON_LOGO_CANSHOW = -1, /* the logo can be shown */ FBCON_LOGO_DRAW = -2, /* draw the logo to a console */ From patchwork Mon May 20 08:22:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10950493 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2B21E76 for ; Mon, 20 May 2019 08:24:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D253286B2 for ; Mon, 20 May 2019 08:24:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 112982874A; Mon, 20 May 2019 08:24:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C8955286B2 for ; Mon, 20 May 2019 08:24:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8F901892CC; Mon, 20 May 2019 08:23:06 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by gabe.freedesktop.org (Postfix) with ESMTPS id EABAF892EA for ; Mon, 20 May 2019 08:23:02 +0000 (UTC) Received: by mail-ed1-x541.google.com with SMTP id p27so22587317eda.1 for ; Mon, 20 May 2019 01:23:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mUAcB3sU0dD3E/MUylEVVwC2GTKxo8rk41HcMoWy7Z0=; b=JtuIXKT4JC8aMR8QFLrj1dLzjWzUpswm9lbtgwn3C7W9PsCk/yt3wX7nQ3yHQll1WP WJFHSBdeEzSD70DY3fhHEIdNONOcZczDkTO13c2XRttqonxXFdwlgOppQxoUaiERtWFk txzLABg60oH5W1fajDjSlTpq+ePY/MgGIzV8AeNAZswdI1eF4jbm8jA5L+PwuFH9/qQ+ tpyJh1CxaO1cou2P4+SEpa+MDfFZaBaqWl1d7bd7Ga0PZUrFsILDY6tL3gNi3EXBaxtF QbzRv9b6fg83HCSvvxEqKZYxxhK4+652UhKV0c9Z1xfksnrUtFs8CwUSsFkrbbk7LJYG EiMw== X-Gm-Message-State: APjAAAXNeklXaxgJ08mIPJSMgWlqZGo3rmU/+thGWcY4arHAK/mfdMpB cFTylf5hjq8GCqSYwAOimApNSa+47Vc= X-Google-Smtp-Source: APXvYqwmDqP5epoI370U4Hdjtba1pl90gO7hr4GVxPoRMkSWHnkec3B3NKvvhM8UDRNXGWDhP6Dyrg== X-Received: by 2002:a17:906:640b:: with SMTP id d11mr9277783ejm.58.1558340580671; Mon, 20 May 2019 01:23:00 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:23:00 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 33/33] staging/olpc_dcon: Add drm conversion to TODO Date: Mon, 20 May 2019 10:22:16 +0200 Message-Id: <20190520082216.26273-34-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mUAcB3sU0dD3E/MUylEVVwC2GTKxo8rk41HcMoWy7Z0=; b=b8eSPbV0e6t58Jw8xSWXzI4Toz82FXOp3S4ZAblJvOrs+Gt0Ux6e3YwhDesaVOOpkg quvfmJTaiU4sOLD2LY4AM7vikeJ5E/6iGKfh9/1ZXhc3ogcMwk4kajLiDJsyzcQzVsde C/uOpN0XDilKwuLuB6fz8bZNEgU6tboLD/HoY= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Drake , Jens Frederich , Daniel Vetter , Intel Graphics Development , LKML , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP this driver is pretty horrible from a design pov, and needs a complete overhaul. Concrete thing that annoys me is that it looks at registered_fb, which is an internal thing to fbmem.c and fbcon.c. And ofc it gets the lifetime rules all wrong (it should at least use get/put_fb_info). Looking at the history, there's been an attempt at dropping this from staging in 2016, but that had to be reverted. Since then not real effort except the usual stream of trivial patches, and fbdev has been formally closed for any new hw support. Time to try again and drop this? Signed-off-by: Daniel Vetter Cc: Jens Frederich Cc: Daniel Drake Cc: Jon Nettleton --- drivers/staging/olpc_dcon/TODO | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/staging/olpc_dcon/TODO b/drivers/staging/olpc_dcon/TODO index 665a0b061719..fe09efbc7f77 100644 --- a/drivers/staging/olpc_dcon/TODO +++ b/drivers/staging/olpc_dcon/TODO @@ -1,4 +1,11 @@ TODO: + - complete rewrite: + 1. The underlying fbdev drivers need to be converted into drm kernel + modesetting drivers. + 2. The dcon low-power display mode can then be integrated using the + drm damage tracking and self-refresh helpers. + This bolted-on self-refresh support that digs around in fbdev + internals, but isn't properly integrated, is not the correct solution. - see if vx855 gpio API can be made similar enough to cs5535 so we can share more code - convert all uses of the old GPIO API from to the