From patchwork Tue May 28 09:02:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964199 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 0B94C76 for ; Tue, 28 May 2019 09:03:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F113328420 for ; Tue, 28 May 2019 09:03:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4F9F2624C; Tue, 28 May 2019 09:03: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E5462624C for ; Tue, 28 May 2019 09:03:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726831AbfE1JDO (ORCPT ); Tue, 28 May 2019 05:03:14 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:45724 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726506AbfE1JDN (ORCPT ); Tue, 28 May 2019 05:03:13 -0400 Received: by mail-ed1-f67.google.com with SMTP id g57so15790132edc.12 for ; Tue, 28 May 2019 02:03:12 -0700 (PDT) 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=lLUCrKXHKAt3A/bBQVqTCTeOCvNqnrpALUNOe9jfHr4=; b=bMQ2bjpJBQsrLyF5NtCNtdDCqdZu00kxLhGVHuMgu5Ecnfugp/vFvZTt9YPT8/0NBT jUEC2OIP1/tU6emJgemxpDua5SKNi51ovh5LtpPGk1dY31H2NH0+z5o2haeY9WRwVZEj Fd6Bp0VSshVT08iDz2tigAozeP4D6d32wcQR0= 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=lLUCrKXHKAt3A/bBQVqTCTeOCvNqnrpALUNOe9jfHr4=; b=CRgI7l+VynK9GGN7bJwYwiZ8A7MggUR0Mk0HcY6ExV57ILzeIsqmC/pFybKsVzme2c MWsGdG4F6v5zfoKGnng/stsQBaDV1cxJxrGpn5ld2BwbALckO7tmxZZjKrstpUHFkNat yPhM1EDOaCufnCwqGMnemHcX4GWwIk9iY7RG421N3EhzpWSy4s+ResLQpsg66ZExVJzL o30oMBO/6UB9ewc8E1JDuaZzZKn272yrSekA7z+TG+iYENrljZEAXQvxbW7PakNZRtzP 3RkZZ8CkD9gyOQuUeoWxIekt3kCDEbNXaY0gsL1UojdiDsObbZrftAbOpFilDFJWfsAk ve3Q== X-Gm-Message-State: APjAAAXenL7mUA2D1HK8WxmAEnfa5JjbvTDB4Cq+TcywQ3M5iukM1H/p wrQ21w+wu2ai9Ers5j3O+10IEg== X-Google-Smtp-Source: APXvYqzLN70+l87QPlEz8uE9d+Hi4atwthd0XgMpMbEkaPaxgOCAKWKU1k0iYUwvw4YO9wheHnEZxg== X-Received: by 2002:a50:b665:: with SMTP id c34mr127787580ede.148.1559034191897; Tue, 28 May 2019 02:03:11 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:11 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , Hans de Goede , Greg Kroah-Hartman , Kees Cook , Nicolas Pitre Subject: [PATCH 01/33] dummycon: Sprinkle locking checks Date: Tue, 28 May 2019 11:02:32 +0200 Message-Id: <20190528090304.9388-2-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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 Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst 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 ff886e99104b..2a0d0bda7faa 100644 --- a/drivers/video/console/dummycon.c +++ b/drivers/video/console/dummycon.c @@ -34,6 +34,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) @@ -42,11 +44,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 Tue May 28 09:02:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964407 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 7D22E15E6 for ; Tue, 28 May 2019 09:07:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BF5728757 for ; Tue, 28 May 2019 09:07:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F9812877E; Tue, 28 May 2019 09:07:01 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E492228776 for ; Tue, 28 May 2019 09:07:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726903AbfE1JHA (ORCPT ); Tue, 28 May 2019 05:07:00 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:43626 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726557AbfE1JDP (ORCPT ); Tue, 28 May 2019 05:03:15 -0400 Received: by mail-ed1-f66.google.com with SMTP id w33so27262408edb.10 for ; Tue, 28 May 2019 02:03:13 -0700 (PDT) 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=zV1k/wyKbSK4unVk9Zsa3jP6q9n4lvzRcxAhP6ZZB9c=; b=Jr4diFnn4D12FEqGpJQ+RuXfm8du2nWF1rRHD4W7cIEGcbaXABy4y7PYtm1RWYCGsM 4VUgAtZNFYUQNW5orIhfjotHfmaMRBcdXOU7lv9qvqyzRqJa5qThyVjqHAx5MH9qVK6q lTOmQV05XsP0H1DMu730MHM4S7AOOkuX/FVNA= 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=zV1k/wyKbSK4unVk9Zsa3jP6q9n4lvzRcxAhP6ZZB9c=; b=eTY+OU+ljc60bKdjdZgD5FYCGn2h4EGH60mjzS4LZOyi5BVay6XKv7GjxN/7dff8Rp 9VfgxQw0kuh7Dq2ZBI9v64G7sH2JcNKSB7Gra8lPCywmZDmczjvOgpDtLZtKQbxm0hrz g2HM3bF5juO9DvJzVAHaI5ZANcfjcwQxg0jQ4B8SpO1rl8/r0Odj6AjVLez7MnVl2McG 53jH+7GTqir2Q6RSX/0TtWu43S3a1ytbA9VR1tSGIk0CEY8o8kmYQJ8NXzxgLWhZNMdX SG9mYf6drOV0xOfph4fACvpRff2x3Gk2qECEcqzpW0mqT9UqsrZoDC0EIruAZFopWMpZ zNWw== X-Gm-Message-State: APjAAAU1ZpziEImHEWJjwZngF4sUTs39Ct8Fp6sj74QIk/IliRLQpifW xr+yPdohBq7WmAmstrNptw4ZRg== X-Google-Smtp-Source: APXvYqzAGcPvnepTOvwWRDQxzLcJ/M058MuV1V355eV9v96p3PIpDSwE+P8RHoMQgcX7eCRUeENRAg== X-Received: by 2002:a50:8a46:: with SMTP id i64mr126930218edi.177.1559034193385; Tue, 28 May 2019 02:03:13 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:12 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , =?utf-8?b?TWljaGE=?= =?utf-8?b?xYIgTWlyb3PFgmF3?= , Peter Rosin , Hans de Goede , Thomas Zimmermann , Manfred Schlaegl , Mikulas Patocka , Kees Cook Subject: [PATCH 02/33] fbdev: locking check for fb_set_suspend Date: Tue, 28 May 2019 11:02:33 +0200 Message-Id: <20190528090304.9388-3-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Just drive-by, nothing systematic yet. Signed-off-by: Daniel Vetter Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst 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 d1949c92be98..8ba674ffb3c9 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1985,6 +1985,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 Tue May 28 09:02:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964207 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 874D4112C for ; Tue, 28 May 2019 09:03:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76EEA2624C for ; Tue, 28 May 2019 09:03:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6AF82285C5; Tue, 28 May 2019 09:03:19 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCE622624C for ; Tue, 28 May 2019 09:03:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726879AbfE1JDR (ORCPT ); Tue, 28 May 2019 05:03:17 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:47014 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726506AbfE1JDQ (ORCPT ); Tue, 28 May 2019 05:03:16 -0400 Received: by mail-ed1-f68.google.com with SMTP id f37so30561008edb.13 for ; Tue, 28 May 2019 02:03:15 -0700 (PDT) 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=MkPaiys1FHkvX5Xasbg4uMlexzhS3Oo0c8bAmpggR9g=; b=chjJHMWFVuPfhW3A7wneTkspRz2zd+mGVI0vCAF6liTiOmsE5RMJw1G5cMrRnyNngC W2oQnkMN6UocrhEJ8dL6n810MNsuqxnBqMe8cuwYvDOWo8W60y/cNQRvGXu+RScDN24b yIAQaBhqHR1mwDhUGgUGALBnoax8FwNCAT8Ho= 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=MkPaiys1FHkvX5Xasbg4uMlexzhS3Oo0c8bAmpggR9g=; b=nuXOn8u5aYgnw0kCR2ThitUktZaFQ5QJ+u3YWw/5ykiiPcKT+OKyJbWjURSLTxfsVd kt8ruBzWmMJJpx6H6l1eCjeG/IzzTQuraxiUtR8fTkOI+u2IczB2Yxi7mx3Yd28mOWRY p7YerumOnW8T+AeOGMCuFV2uBa6dIuSchbcjd+Lj34JDhi21iWjIdgJ3foxPfcnGXdjD dhTZs4p3uHRT41uvHo8algQSjTZlGHCsobxRYgcBgV90YepGzcnJC5YVQoXzAjDagTZk UUL0vklfhVGUtGsyEAYEDM3vtuxIn3V2/x9vbA/0Zm7JSHdDpra8P9FUk/F+BmQVIS/v 8WgA== X-Gm-Message-State: APjAAAWMR+ctjoIWwmCzBMrVCQ8rmiNMx4RS73eIZNAuBwTEPQPFQqZ0 s8uFmdcr6l+Baz5v3MrHdXykqg== X-Google-Smtp-Source: APXvYqxNUG3PIbLtvNeH5i4uB4mGfl/Vclh7rWNvv07X8NGzMdCrtTYqdpxbhNGmaVceS0uzEWD3gQ== X-Received: by 2002:a50:b7bc:: with SMTP id h57mr111959297ede.77.1559034194600; Tue, 28 May 2019 02:03:14 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:13 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Greg Kroah-Hartman , Maarten Lankhorst , Nicolas Pitre , Adam Borowski , Martin Hostettler , Mikulas Patocka Subject: [PATCH 03/33] vt: might_sleep() annotation for do_blank_screen Date: Tue, 28 May 2019 11:02:34 +0200 Message-Id: <20190528090304.9388-4-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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 Reviewed-by: Sam Ravnborg Acked-by: Greg Kroah-Hartman Reviewed-by: Maarten Lankhorst 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 fdd12f8c3deb..bc9813b14c58 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -4159,6 +4159,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 Tue May 28 09:02:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964403 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 72A7B76 for ; Tue, 28 May 2019 09:07:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6268628757 for ; Tue, 28 May 2019 09:07:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56AE22877E; Tue, 28 May 2019 09:07: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D986F28776 for ; Tue, 28 May 2019 09:06:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726881AbfE1JDU (ORCPT ); Tue, 28 May 2019 05:03:20 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:37232 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726828AbfE1JDR (ORCPT ); Tue, 28 May 2019 05:03:17 -0400 Received: by mail-ed1-f66.google.com with SMTP id w37so30608266edw.4 for ; Tue, 28 May 2019 02:03:16 -0700 (PDT) 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=jUOvUFjOZWrbnCxjvkZoRiQyUO6GhlMn91QUcJ72DHI=; b=H29+SckyvkTxRaOEF5mwVU3EMqX7rXNRfN87/DSt5U3WQU+ZAs7hRquIOi9RzLh0cq y26ULKv9eBX2/q3UjrfIHryBmDKjabYCAdBQgCihP1AxUIlusJP0cLTTa5KKbirFHQgt k/qMMmYucmNuqrA3kjZVBk6TSXZFe1MV/uXew= 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=jUOvUFjOZWrbnCxjvkZoRiQyUO6GhlMn91QUcJ72DHI=; b=E2sRNKuCR+sECvVdEQqQhAeVj1j6JsHVrOUH1qigoA++DF/93zsC74Tonu/7kZZ75b 772D3pixzBQPbanTgw0IxHV/lcxXmmGpzlFQBob1GuQd15NKsYMZdct8fF0QEX/f7Oa7 +kBe/KQ8ZBg3sREBVQo9smx8Eo5XgH3cIjskukHzJ7OIqBgLVSzwqiuy9aQbdrd3yOiR 5yT4togoHarv4BTMB+O1AmFwmEYDUz48tfq3ua8hXSnV3qUr23/TXrVEyd/XpGH1FFQS xCW/C1uv0pPADUB149OFgMniF8Y9mvSkSQLl0vR93GyKp2/ZsqbY0gnXvZTSLfav68rn vcbw== X-Gm-Message-State: APjAAAWpIv/PhwdqmsmOJkcyE6AQ6SXeYO9aq9UPKeM0KE+1w14Xba6P oyXw2mk6ZgDgKculhnLfHILbSg== X-Google-Smtp-Source: APXvYqx+3Wae09oYe6uZ+dqJBAuIjniRv4ny3Kk16p1SvfsNRiZK6GI4951/ZXDCJWQJ1C95ZStI+A== X-Received: by 2002:aa7:dd03:: with SMTP id i3mr90704646edv.93.1559034195925; Tue, 28 May 2019 02:03:15 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:15 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Greg Kroah-Hartman , Maarten Lankhorst , Nicolas Pitre , Martin Hostettler , Adam Borowski , Mikulas Patocka Subject: [PATCH 04/33] vt: More locking checks Date: Tue, 28 May 2019 11:02:35 +0200 Message-Id: <20190528090304.9388-5-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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 Reviewed-by: Sam Ravnborg Acked-by: Greg Kroah-Hartman Reviewed-by: Maarten Lankhorst 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 bc9813b14c58..a8988a085138 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -3815,6 +3815,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; @@ -3826,6 +3828,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 Tue May 28 09:02:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964405 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 37596933 for ; Tue, 28 May 2019 09:07:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2805428757 for ; Tue, 28 May 2019 09:07:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1BD352879C; Tue, 28 May 2019 09:07:01 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB75E28757 for ; Tue, 28 May 2019 09:07:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725943AbfE1JDU (ORCPT ); Tue, 28 May 2019 05:03:20 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:37233 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726506AbfE1JDT (ORCPT ); Tue, 28 May 2019 05:03:19 -0400 Received: by mail-ed1-f65.google.com with SMTP id w37so30608367edw.4 for ; Tue, 28 May 2019 02:03:17 -0700 (PDT) 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=2XhY37QKiJG0yVeCBJVjNjQRjgX7g+zT5YuLsuJlT/0=; b=HUmM6fWW1Qkokcj/zd5Ot2If+OrST6LgqHbbva3UHFF9eJkoMa8t9wN30uRB3Hil7i Hc91q9/ULJ947zUpmJgPZwcZmOAeI2WYWWQPocRGWKVj2wKtRnHlrfxXz9WfvOVZabyR oBmw1pFE2OHFz+mZds0Vm6nwXAK2VxZ9stb/w= 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=2XhY37QKiJG0yVeCBJVjNjQRjgX7g+zT5YuLsuJlT/0=; b=mAz9FLxObQEv3lN8E4AC110fKI4kVjFALv6f1FnpnqTOzKnvjizcHjE2YZqRGR+kOE RJY7WO7biRcilg7VnkDqfKL3kxvn3rS5iHrkkgC5Gu1JXEadMZsMlDuxJq2DyXrSf/tn nLgy+h3qhTCW44flkaUfiunfkwOLKuyp7qZRJnZRFbHwC5amLdDVNj5S02KPsEV0uykW oaJ1mt0yx/OX5d/OJUjYpoI0yvF4cyNV6t4AaPhQx/yLbSFB6GOC8B9zuWqA5RX/sz9s k+N9BR7fv/3WxCbM/uWVdRCyXn1bBrIfqyQn1w82iuUvQ5lzwCbrfkG5lyt8JFVKDDBq prpg== X-Gm-Message-State: APjAAAVGBFlHGuBjyj/GwjI2LKv47XzlfRvYafQ0dvQS+diG3WdB1Rvb gEwq9ta/rTdIg9CdoO+alm/kBw== X-Google-Smtp-Source: APXvYqysJqma/Cwd8MeT0Rq/SJ2o0DZ5nqO5ai6mqVm0Hq+p9CdMzlw4b+pi8PAdwAc8N8a+yr7I9w== X-Received: by 2002:a50:991d:: with SMTP id k29mr126603128edb.29.1559034197127; Tue, 28 May 2019 02:03:17 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:16 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst Subject: [PATCH 05/33] fbdev/sa1100fb: Remove dead code Date: Tue, 28 May 2019 11:02:36 +0200 Message-Id: <20190528090304.9388-6-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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 Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst 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 Tue May 28 09:02:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964399 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 DDD80933 for ; Tue, 28 May 2019 09:06:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE43C28776 for ; Tue, 28 May 2019 09:06:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C295E2879C; Tue, 28 May 2019 09:06:47 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5987228776 for ; Tue, 28 May 2019 09:06:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726779AbfE1JGq (ORCPT ); Tue, 28 May 2019 05:06:46 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:41371 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726895AbfE1JDW (ORCPT ); Tue, 28 May 2019 05:03:22 -0400 Received: by mail-ed1-f67.google.com with SMTP id m4so30615600edd.8 for ; Tue, 28 May 2019 02:03:20 -0700 (PDT) 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=Wpi1xWPy33lj9mKcPzFNSCGKIPsIrM24U07obZg4Bbk=; b=HRwgYNCSeirp12RNt1fyc5OhQoszF2Uo7tDWacf52/s+HTFiZCUvyKuqcMcCFLqTo7 osyTlqilBk3yRLl/Vm39fichaec5uHYWxg/SR+yE+xqDXUsKId+uFHmCikQYi4P9iErW GcKPar6d/CdwBiFSNkAYtg+09d1NA/M8qXEg4= 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=Wpi1xWPy33lj9mKcPzFNSCGKIPsIrM24U07obZg4Bbk=; b=j25j9nOQvhGV0ZvWgi7IP4aAIWv7N2Dv3hS3IK9UrkuYRij222C/0IAZ2xZRQbY4kU wgM/GnjEjJM8psg/pdr2qZk0igWEzRFw6NyHGM1zlb0/ucb2hVPIvsk9qigGpoWjwnqt tuBd2GzJBIWhRjvxL4hSlVvmAXoQR+482PBkKPKojmR9BePM+WUEei8x7IeFcMRDdKr4 rdp93OmleqsKwEfB1GEHd2dZxtqZPsypwSkJ4xTCm7oaNOlREF83l59u43HCiLV40ln1 pG0RmnaWbYDpSirQpuju3mLR389dgWctakY2Qb4GjZYakmLq7M2YNDKrptgbc9L148Ua BIsA== X-Gm-Message-State: APjAAAVv52RZ7uRM8Go7Cou4a+rTw+kk++H4/7Q8wzYfOjcVUn4TC6dc vyRhbaRG5BkJKgOP0tA/JSWwtg== X-Google-Smtp-Source: APXvYqyMZ+XP/DYBnT+b0/bEtV1bg4DZ2v7pGi2tkNPgOMj6ozhRdzLU/jwSi0kUA3Q+ESL/hNZuXg== X-Received: by 2002:a50:ad98:: with SMTP id a24mr127149884edd.235.1559034200289; Tue, 28 May 2019 02:03:20 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:17 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , Russell King , linux-arm-kernel@lists.infradead.org Subject: [PATCH 06/33] fbdev/cyber2000: Remove struct display Date: Tue, 28 May 2019 11:02:37 +0200 Message-Id: <20190528090304.9388-7-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Entirely unused. Signed-off-by: Daniel Vetter Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst 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 Tue May 28 09:02:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964401 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 2529E76 for ; Tue, 28 May 2019 09:06:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1500D28757 for ; Tue, 28 May 2019 09:06:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 06D302877E; Tue, 28 May 2019 09:06:53 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 937A028757 for ; Tue, 28 May 2019 09:06:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726532AbfE1JGq (ORCPT ); Tue, 28 May 2019 05:06:46 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:38087 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726939AbfE1JDX (ORCPT ); Tue, 28 May 2019 05:03:23 -0400 Received: by mail-ed1-f67.google.com with SMTP id g13so835778edu.5 for ; Tue, 28 May 2019 02:03:22 -0700 (PDT) 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=HZwP5CFzD06sWD0G+Fe0mAzCpHhgcMKFAUp7XhkxC/k=; b=eXb8rxg7fFF6/2RAfZ4NWczgflnTAPw/L+VbbIhxEioapduOh2JwUJvBTIee7RTcn8 /AEmskfBbKkJwNvzDW7ImicadrrECvrGsi/czi03V+Fn1gADb65ZC5uqG6kdNJWkk1ve o3N9d6Vz76kkzKUppLsCnKwnFEu72Q0/Uz8E4= 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=HZwP5CFzD06sWD0G+Fe0mAzCpHhgcMKFAUp7XhkxC/k=; b=dXtEr43NkBaWE9V+F4u+Tr8qxuWwkB5BTeTYz0PS8SNy2KWOYzZLuyWR3eB8nBzcee mW8aAL6Vac6YVSK2XsrVXnA/qrZWloM6Ul0rmtJqlbTtv2+D9edHSEcrvUqt5ksuCTUQ np6M998BYcVgc9DHlYlV4zjlUCP2TAb3kfMPUUycpfDsgRn27kuyXDPVqFPW1rq3FPu0 tGSiGp+qzyFpb7/+XW9/gZiVfyB4wrIQmk9qNx9pT4yiGQg8bN7w/+2b0ICGyEWm44Kb 1SoEGqoRiaUsElitHyMhh9IIgvGlSwX5PDYjwSZJghk/mK7/T6wiV5p7R9YLuRbdmG+y aKgQ== X-Gm-Message-State: APjAAAW5bRGBcygYuuwM2pRM+CKScKhN/gr6vQ2At8dBZVlJBaPSdnvC pT3URS70ZleeWBwKNGXAJfogPA== X-Google-Smtp-Source: APXvYqwHlk+CTEOYRVR2n0Zwg2fJHnhIcAQkS/q4yn3g+Dr67BhbtStsBv6flBr94eYXjUxcKSAJfQ== X-Received: by 2002:a50:bf0c:: with SMTP id f12mr128312359edk.181.1559034201426; Tue, 28 May 2019 02:03:21 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:20 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , Paul Mackerras Subject: [PATCH 07/33] fbdev/aty128fb: Remove dead code Date: Tue, 28 May 2019 11:02:38 +0200 Message-Id: <20190528090304.9388-8-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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 Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst 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 794434891291..b02e67528a99 100644 --- a/drivers/video/fbdev/aty/aty128fb.c +++ b/drivers/video/fbdev/aty/aty128fb.c @@ -2350,70 +2350,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 Tue May 28 09:02:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964223 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 1D18D15E6 for ; Tue, 28 May 2019 09:03:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C35B271FD for ; Tue, 28 May 2019 09:03:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 001EC285C5; Tue, 28 May 2019 09:03:29 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7BBC271FD for ; Tue, 28 May 2019 09:03:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726999AbfE1JD1 (ORCPT ); Tue, 28 May 2019 05:03:27 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:47034 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726974AbfE1JD0 (ORCPT ); Tue, 28 May 2019 05:03:26 -0400 Received: by mail-ed1-f65.google.com with SMTP id f37so30561648edb.13 for ; Tue, 28 May 2019 02:03:24 -0700 (PDT) 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=uAUlzla1CFlAG2FjtxoG6FlQGI0ZQGUaINYTuCwsBxA=; b=hhSXNm6ORof3iKez+dyNLYutgRtv6PnEgzY1CLcewi4MdkY4RG/hxbAxniAiYFpn52 hU7id3r1yubg0jg0/vf8ItXOQTSMScUY/rwhYjsfR/XupG1fA2kElq4fkK3mz0uw2Eau qUOCsPL3IsDpz5lg1fIEKNE3iptL+fcc19ppM= 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=uAUlzla1CFlAG2FjtxoG6FlQGI0ZQGUaINYTuCwsBxA=; b=etZKl0zL3drPUxpBd8fgI9XJ9qFr8Q6zHafod9E67KZVi+GwNeY9dJy57lz/YCY+Od M1+tsDeiQS/GZV0m8C17Jvchu3K9hmWpfd8hLkVE9xRe1cpWOi3KLvrO8H1eDuaEm40B xuNVIcjpb3FMYc/z7+iiQx67BEoZEbA3Ft4bwYkb2K2hyKfYMufiHTmUirghW13nI9uo nA3fNeM+M0IEh2nqQUj6bYCcmIz/vb/ret/IoFtNF2UzaKJQOzd2s2Sjw5Uz0fGsHOXV YocXhad8nm6snc0p2f3TQIQ7wv6nhBXg+ovy3KOWBZ/7otmGvPQOX6XFkxOuggrkfhN6 oynw== X-Gm-Message-State: APjAAAU1l8OiBiTJT5HrBnbHLY+ZHE49pniZZo8MV4czXwTeTVKmgiCL +C/nFqgLYEoypo7jqFuETZb8UQ== X-Google-Smtp-Source: APXvYqyQDEAHDoEZtGC2lhd+S40xqvSqiLa/+TcWzwUVFYlfMpuKB+Y3SZCAD4yE4jnk/4TuUIYBYQ== X-Received: by 2002:a50:ba4b:: with SMTP id 11mr23025614eds.300.1559034203856; Tue, 28 May 2019 02:03:23 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:23 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , Hans de Goede , Greg Kroah-Hartman , Kees Cook , Prarit Bhargava , Konstantin Khorenko , Peter Rosin , Yisheng Xie Subject: [PATCH 08/33] fbcon: s/struct display/struct fbcon_display/ Date: Tue, 28 May 2019 11:02:39 +0200 Message-Id: <20190528090304.9388-9-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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 Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst 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 786f9aab55df..5424051c8e1a 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 Tue May 28 09:02:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964221 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 F0916112C for ; Tue, 28 May 2019 09:03:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1CFE285C5 for ; Tue, 28 May 2019 09:03:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5FB2285F7; Tue, 28 May 2019 09:03:29 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37552285C5 for ; Tue, 28 May 2019 09:03:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726942AbfE1JD1 (ORCPT ); Tue, 28 May 2019 05:03:27 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:33567 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726822AbfE1JD1 (ORCPT ); Tue, 28 May 2019 05:03:27 -0400 Received: by mail-ed1-f66.google.com with SMTP id n17so30687727edb.0 for ; Tue, 28 May 2019 02:03:25 -0700 (PDT) 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=eWzvBOSi043NlPhBjWBcZ5gYsPOn0TslCCY3OR85nNc=; b=AxHczMPWvdB0duF+TZIkUR7zn9ttLdk/LQJ410Odk6YrE3Ov+Xj8w2xf8WBWz+h8zh hWr4b6fx9GdaTYN4B8ue+7obfo93vkEkYnyUUC5slS0fTzODA8qH0Dh4vIKG/yUsL9Dl k1KBtJQ7JTBTxRPR6NwEJyDK2bQCgXhLRM7hA= 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=eWzvBOSi043NlPhBjWBcZ5gYsPOn0TslCCY3OR85nNc=; b=jHCn2cbE7iUWxrR/6oBzuN91mdPls6mSfYCscDZnyyiblem5OeZW7ui1q/LtRDfkvK alDlAcGxSyLAdtKaq1l8+X/PPiOVjY4WMwFuVLKAf/vylNvYnl1exeedKBwh04OIIWsP 1ApU7G5G/5iN6vqrx7bvv46JwpvtvDRSXu/Swz1b7mINf1584PJWLim33ZdoeOQf6C8C 7a1rJGkDduMB5LMEsMV+rLmhvHKXkiRziTZfRgLBcz+tEYT0wpT9m8+2T5kVThIXc48I WsvcWmsrzosmNFT3+aEMTt3MvQMv4GGP8BmaKEqksJicmoGuU5vm4EegEkgXEYAlSI+k v2DQ== X-Gm-Message-State: APjAAAWAE/EBIRCH4g55DDOSSd/PvdL+aiSuuvyp51YDS0y2W9tUhfSg QCLFmEMCWC5+JPGItZ5viLyBOA== X-Google-Smtp-Source: APXvYqxwYBWK+S/Sn+nc60pnOFDN3a1NVbrdhjndc/zKC3s0aq0anlm33HbTi0toBUJUK+1EhIP7hw== X-Received: by 2002:a50:918b:: with SMTP id g11mr128303052eda.24.1559034205270; Tue, 28 May 2019 02:03:25 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:24 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , Daniel Vetter , Hans de Goede , =?utf-8?q?Noralf_Tr=C3=B8nnes?= , Yisheng Xie , Konstantin Khorenko , Prarit Bhargava , Kees Cook Subject: [PATCH 09/33] fbcon: Remove fbcon_has_exited Date: Tue, 28 May 2019 11:02:40 +0200 Message-Id: <20190528090304.9388-10-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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. v3: CI showed me that I still didn't fully understand what's going on here. The leaked references in con2fb_map have been used upon rebinding the fb console in fbcon_init. It worked because fbdev unregistering still cleaned out con2fb_map, and reset it to info_idx. If the last fbdev driver unregistered, then it also reset info_idx, and unregistered the fbcon driver. Imo that's all a bit fragile, so let's keep the con2fb_map reset to -1, and in fbcon_init pick info_idx if we're starting fresh. That means unbinding and rebinding will cleanse the mapping, but why are you doing that if you want to retain the mapping, so should be fine. Also, I think info_idx == -1 is impossible in fbcon_init - we unregister the fbcon in that case. So catch&warn about that. v4: Drop unecessary assignment - I forgot to delete the first assignment of info in fbcon_init. Cc: Sam Ravnborg Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst Signed-off-by: Daniel Vetter Cc: Maarten Lankhorst 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 | 41 ++++++-------------------------- 1 file changed, 7 insertions(+), 34 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 5424051c8e1a..e11bae2787e6 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,13 +1049,12 @@ static const char *fbcon_startup(void) info->var.bits_per_pixel); fbcon_add_cursor_timer(info); - fbcon_has_exited = 0; return display_desc; } static void fbcon_init(struct vc_data *vc, int init) { - struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; + struct fb_info *info; struct fbcon_ops *ops; struct vc_data **default_mode = vc->vc_display_fg; struct vc_data *svc = *default_mode; @@ -1064,9 +1062,13 @@ static void fbcon_init(struct vc_data *vc, int init) int logo = 1, new_rows, new_cols, rows, cols, charcnt = 256; int cap, ret; - if (info_idx == -1 || info == NULL) + if (WARN_ON(info_idx == -1)) return; + if (con2fb_map[vc->vc_num] == -1) + con2fb_map[vc->vc_num] = info_idx; + + info = registered_fb[con2fb_map[vc->vc_num]]; cap = info->flags; if (logo_shown < 0 && console_loglevel <= CONSOLE_LOGLEVEL_QUIET) @@ -3336,14 +3338,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 +3390,6 @@ static int fbcon_event_notify(struct notifier_block *self, fbcon_remap_all(idx); break; } -done: return ret; } @@ -3443,9 +3436,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 +3458,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 +3478,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 +3498,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 +3524,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 +3646,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 +3670,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 +3693,6 @@ static void fbcon_exit(void) info->queue.func = NULL; } } - - fbcon_has_exited = 1; } void __init fb_console_init(void) From patchwork Tue May 28 09:02:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964231 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 1549B76 for ; Tue, 28 May 2019 09:03:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06547271FD for ; Tue, 28 May 2019 09:03:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EDECA285D2; Tue, 28 May 2019 09:03: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE30D287C5 for ; Tue, 28 May 2019 09:03:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727013AbfE1JDc (ORCPT ); Tue, 28 May 2019 05:03:32 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:43658 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726822AbfE1JDa (ORCPT ); Tue, 28 May 2019 05:03:30 -0400 Received: by mail-ed1-f67.google.com with SMTP id w33so27263422edb.10 for ; Tue, 28 May 2019 02:03:29 -0700 (PDT) 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=UVMz2IJ4/RyaqNE4ZvaPs86LwJMcSiemc8l514rOxoE=; b=YwRF4P97LOBFhUta0OKI5wlSv1Ox7DssXRuK+2PmuzP3Bb2FNwARl2akdmKCZyXlht lHNH4diyj6fBWHpDeH4K0gYOQYM0gek4oMHoK34CxS4WpKKsdP2bhwltVDvw34z8ct3A BwBi6OjIWHKaCQP3HMqUL0tNKRaKaadMkDaxA= 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=UVMz2IJ4/RyaqNE4ZvaPs86LwJMcSiemc8l514rOxoE=; b=CTUH2N/JVmINFycny8wVlqRkMFikRFbq/Bbz4+5a1s2CcWnML1KYkjlHtSyCpAoeT8 7tDsE1dPaomevE3COFLhmgihh5nVcb6IdIKY+/iwrVSVidF3zQJXJbxsU08mVO9lrASk Xzu3Ov1zgre75GGQy6tHOD7w+HufM+qBKVO31p1uG9zlN1ULKuvIXEcrZRK8wo4B2SQn z6iuGbVdWXk0eA3qLSXAZM3mRkfCl2hydlt30L7Ts/nWfn250gU7RVqHgjT777RPC3r5 RX0Zch2E4CfZkgNXfFeiWtiNDPb68VxiYDflO79yiUFdtRRRUSd6seanza/DAxvtTmnS hTsA== X-Gm-Message-State: APjAAAWgxOc+XuaUwEslVniMw+JqKbqJpewG0LZth8ybrPzEZ2Tcft76 zaqklQwNcocx6Rco8SfdjR8Ytw== X-Google-Smtp-Source: APXvYqzzJazZYKbqsmGP/BM9TTGVXR1j+0xbyiZYi+o+JaVEFP6ppO34Lw/fLHCAVJ+XHdehH4WMbA== X-Received: by 2002:a50:be42:: with SMTP id b2mr129139954edi.228.1559034206926; Tue, 28 May 2019 02:03:26 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:26 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , Hans de Goede , Greg Kroah-Hartman , =?utf-8?q?Noralf_Tr=C3=B8n?= =?utf-8?q?nes?= , Yisheng Xie , Peter Rosin , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Thomas Zimmermann , Mikulas Patocka , Daniel Mack , Haojian Zhuang , Robert Jarzmik , Konstantin Khorenko , Prarit Bhargava , Gerd Hoffmann , Steve Sakoman , Steve Sakoman , linux-arm-kernel@lists.infradead.org Subject: [PATCH 10/33] fbcon: call fbcon_fb_(un)registered directly Date: Tue, 28 May 2019 11:02:41 +0200 Message-Id: <20190528090304.9388-11-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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. v2: Sam Ravnborg noticed that mach-pxa/am200epd.c has a notifier too, and listens to this. ... Looking at the code it seems to wait for some fb to show up, so that it can get the framebuffer base address from the fb_info struct. I suspect his is some firmware fbdev. Then it uses that information to let the real fbdev driver (metronomefb.c by the looks) get at the framebuffer memory. This doesn't looke like it's easy to fix (except by deleting the entire thing, seems untouched since 2008, we might be able to get away with that), so let's just stuff a few #ifdef into fb.h and fbmem.c and cry over them for a bit. Signed-off-by: Daniel Vetter Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst 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 Cc: Daniel Mack Cc: Haojian Zhuang Cc: Robert Jarzmik Cc: Konstantin Khorenko Cc: Prarit Bhargava Cc: Gerd Hoffmann Cc: Steve Sakoman Cc: Steve Sakoman Cc: linux-arm-kernel@lists.infradead.org --- arch/arm/mach-pxa/am200epd.c | 13 +++++++++++-- drivers/video/fbdev/core/fbcon.c | 14 +++----------- drivers/video/fbdev/core/fbmem.c | 24 +++++++++++++++++------- include/linux/fb.h | 7 +++++-- include/linux/fbcon.h | 4 ++++ 5 files changed, 40 insertions(+), 22 deletions(-) diff --git a/arch/arm/mach-pxa/am200epd.c b/arch/arm/mach-pxa/am200epd.c index 50e18ed37fa6..cac0bb09db14 100644 --- a/arch/arm/mach-pxa/am200epd.c +++ b/arch/arm/mach-pxa/am200epd.c @@ -347,8 +347,17 @@ int __init am200_init(void) { int ret; - /* before anything else, we request notification for any fb - * creation events */ + /* + * Before anything else, we request notification for any fb + * creation events. + * + * FIXME: This is terrible and needs to be nuked. The notifier is used + * to get at the fb base address from the boot splash fb driver, which + * is then passed to metronomefb. Instaed of metronomfb or this board + * support file here figuring this out on their own. + * + * See also the #ifdef in fbmem.c. + */ fb_register_client(&am200_fb_notif); pxa2xx_mfp_config(ARRAY_AND_SIZE(am200_pin_config)); diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index e11bae2787e6..5a9fe0c0dd3c 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3119,14 +3119,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++) { @@ -3155,8 +3155,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 */ @@ -3215,7 +3213,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; @@ -3359,12 +3357,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 8ba674ffb3c9..bed7698ad18a 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,14 @@ 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; +#ifdef CONFIG_GUMSTIX_AM200EPD + { + struct fb_event event; + event.info = fb_info; + fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event); + } +#endif + if (!lockless_register_fb) console_lock(); else @@ -1732,9 +1738,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 +1776,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 +1793,15 @@ 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; +#ifdef CONFIG_GUMSTIX_AM200EPD + { + struct fb_event event; + event.info = fb_info; + fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event); + } +#endif 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..288175fafaf6 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -136,10 +136,13 @@ 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 */ + +#ifdef CONFIG_GUMSTIX_AM200EPD +/* only used by mach-pxa/am200epd.c */ #define FB_EVENT_FB_REGISTERED 0x05 -/* A driver unregistered itself */ #define FB_EVENT_FB_UNREGISTERED 0x06 +#endif + /* 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 Tue May 28 09:02:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964397 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 88967933 for ; Tue, 28 May 2019 09:06:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 782B228757 for ; Tue, 28 May 2019 09:06:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6CACF2877E; Tue, 28 May 2019 09:06: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFABB28757 for ; Tue, 28 May 2019 09:06:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726836AbfE1JGe (ORCPT ); Tue, 28 May 2019 05:06:34 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:38108 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726394AbfE1JDa (ORCPT ); Tue, 28 May 2019 05:03:30 -0400 Received: by mail-ed1-f67.google.com with SMTP id g13so836213edu.5 for ; Tue, 28 May 2019 02:03:28 -0700 (PDT) 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=3WPeIDAqtSnPbDcxMeR1LaTs5pcjbLLnzUOYFaYwyy4=; b=KjLil2b0YP+O0+LLoKZvoQsb+o+ksT4MFgBy/gHuXSCAAGP6P6cA5C0cJ0Q064y4qh MGbSN9Y6fh5TrgSLKOYg3g3hchsqbQ/zTnXkZdsWXQ2yOLHhKkE88weQaBaJDRahFgfh kXldbmLz0TAZjV2rhJuHrpHFHPulmv4hUL1sE= 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=3WPeIDAqtSnPbDcxMeR1LaTs5pcjbLLnzUOYFaYwyy4=; b=hlrxi01KGFlVEjqfjOevOBadnFEQq4eRZptEmaMoq+BWjlDAzrKxc3inlK/tZD5WB4 dVaDJIQkfCljZTyqH5coO8GDN0Z6XKbFlwWNGC8wuvv5NAi6re5s4n6sCVtDxTO6usSb YIM2ZfoZFnTCqmtDKaAufa2aqiXoVMCHufXNKo6se9SCH6AUhgpCfUtH0zwjp1Sq3olp xSQEW9sGjtW0cbV995eXG7HMqFOFP6nKvZSRWbAMIPFuR8D0y8ntc+PpyPbjUAlsgngy Muo9ALFe91+k6nocifomYJyHRzCIwHrah81a7EN4z6mkFQPd8WVb2uk10lb+UTb7FYeI yC6A== X-Gm-Message-State: APjAAAXjIiW4RFwizC0SMLOpvKpwiK/aZekTlZSpmLPYfq8mo8YvS64e 7PbIqqT2le7S1/MgOAbP77/xdg== X-Google-Smtp-Source: APXvYqwMsg+ox2j7/vocxj31v97alIwDq1JoAS4rf3ZZsaq9cI9N6Nbl/phYJ9vu/CPVcy0X+VXgjw== X-Received: by 2002:a05:6402:12ce:: with SMTP id k14mr1550281edx.169.1559034208108; Tue, 28 May 2019 02:03:28 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:27 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Geert Uytterhoeven , Sam Ravnborg , Maarten Lankhorst Subject: [PATCH 11/33] fbdev/sh_mobile: remove sh_mobile_lcdc_display_notify Date: Tue, 28 May 2019 11:02:42 +0200 Message-Id: <20190528090304.9388-12-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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. v2: Also remove sh_mobile_lcdc_must_reconfigure, now unused (Sam). Signed-off-by: Daniel Vetter Reviewed-by: Geert Uytterhoeven (v1) Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst Cc: Geert Uytterhoeven Cc: Daniel Vetter Cc: Sam Ravnborg --- drivers/video/fbdev/sh_mobile_lcdcfb.c | 82 -------------------------- drivers/video/fbdev/sh_mobile_lcdcfb.h | 5 -- 2 files changed, 87 deletions(-) diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c index dc46be38c970..1437695415c9 100644 --- a/drivers/video/fbdev/sh_mobile_lcdcfb.c +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c @@ -534,89 +534,9 @@ static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch) ch->tx_dev->ops->display_off(ch->tx_dev); } -static bool -sh_mobile_lcdc_must_reconfigure(struct sh_mobile_lcdc_chan *ch, - const struct fb_videomode *new_mode) -{ - dev_dbg(ch->info->dev, "Old %ux%u, new %ux%u\n", - ch->display.mode.xres, ch->display.mode.yres, - new_mode->xres, new_mode->yres); - - /* It can be a different monitor with an equal video-mode */ - if (fb_mode_is_equal(&ch->display.mode, new_mode)) - return false; - - dev_dbg(ch->info->dev, "Switching %u -> %u lines\n", - ch->display.mode.yres, new_mode->yres); - ch->display.mode = *new_mode; - - return true; -} - 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 +2460,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 Tue May 28 09:02:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964229 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 2A67515E6 for ; Tue, 28 May 2019 09:03:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1696E271FD for ; Tue, 28 May 2019 09:03:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0AE47285C5; Tue, 28 May 2019 09:03: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E88C285D2 for ; Tue, 28 May 2019 09:03:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727030AbfE1JDb (ORCPT ); Tue, 28 May 2019 05:03:31 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:41991 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbfE1JDb (ORCPT ); Tue, 28 May 2019 05:03:31 -0400 Received: by mail-ed1-f68.google.com with SMTP id g24so2698535eds.9 for ; Tue, 28 May 2019 02:03:29 -0700 (PDT) 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=uqvjuHP1JlltKsAAI+cqqXVrkqUOcJ7eWhpcU6m4g1c=; b=frw58n0pRHAXNDbcXB+xAqYIkvLZxek+SzpkxuUVcIcCgtAz4ksuilklcx2AQ4saSF 4whTeD2QhLuWUQBHUNchNxxkkb8QdQNnYaTwPxS9iD+InQMnlwn6A6Hx4kcb2+t8RIKl C4tVxDn3n3c+Eq+/pdndHPl8PbLYZ9uoeajEE= 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=uqvjuHP1JlltKsAAI+cqqXVrkqUOcJ7eWhpcU6m4g1c=; b=iHvRFFSNpPN5NgYMjPNsVneK1rEAERSdyK5erThpCexcbnNz1hbelgIHKKJPFUcnfy ZaavoqM1t6PDLmeZSJ/kp+xTXUfOhos+QvhMEPWAKWoBVqB2oeTq3sTvaR9gSrw/BbFa lOQJu3vVhrlV23oP9AHlxZ0BhraYB1Z8KlBw0y5wpD1kLYKxSyiag6DY5e7Jl9UPwUoQ O6x415VQiK/Ollwt2xVFt7E0RqGL0t0XJwOSPfaAL49CFPC5IG8pn7F/7STKq1izoK1+ O7O4hNyXcU0+HkrbYspK7MtWa4VMDcn/QtyoGrCGxAZaoG/iKoZ/9g0aL9JjG74JCPdX Zwaw== X-Gm-Message-State: APjAAAVyJmppGlQAYmmJZILCiEmqer/RNt/fLjc61Otz4OqtDidXtnm3 QZEw1na2ZWNHpxtxDDJs4Cz16A== X-Google-Smtp-Source: APXvYqxkR8uRPfRQx/cEMiLS4f+zqTikJ6iJyG5emvQCsp3aU+7WOuJdm2C2xsdHOcVuFOgNa2Uw0Q== X-Received: by 2002:a50:a4f7:: with SMTP id x52mr128120101edb.86.1559034209379; Tue, 28 May 2019 02:03:29 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:28 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst Subject: [PATCH 12/33] fbdev/omap: sysfs files can't disappear before the device is gone Date: Tue, 28 May 2019 11:02:43 +0200 Message-Id: <20190528090304.9388-13-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Which means lock_fb_info can never fail. Remove the error handling. Signed-off-by: Daniel Vetter Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst 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 Tue May 28 09:02: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: 10964395 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 0B08476 for ; Tue, 28 May 2019 09:06:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE4E628757 for ; Tue, 28 May 2019 09:06:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2B542877E; Tue, 28 May 2019 09:06: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D86528757 for ; Tue, 28 May 2019 09:06:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727014AbfE1JDd (ORCPT ); Tue, 28 May 2019 05:03:33 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:37267 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726619AbfE1JDc (ORCPT ); Tue, 28 May 2019 05:03:32 -0400 Received: by mail-ed1-f67.google.com with SMTP id w37so30609315edw.4 for ; Tue, 28 May 2019 02:03:31 -0700 (PDT) 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=vM1aYE2ulFqwNKAI91FehOuN3FngVvZTQQrOwUdJ200=; b=KW37xWZVcPypjbSNTGtze1qbJdJ+h3eyy81RbWAyp7nDLbzjHN5Wkb5DfFZKHDsp2A v6vepSIbHMJFlOq2tkBtTV/XzHFr6pwUkmz2w01+sxCfI4CkmEqKeMStEPkcI1eaw2zU cTRX3cMyqjfte5kX7q5zfCLS6/JyWCmbOWE5k= 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=vM1aYE2ulFqwNKAI91FehOuN3FngVvZTQQrOwUdJ200=; b=RXA8trCbCTIkM2jCHRSgpwQt9GNeoEPleMpxrgVoCGaVXvq8DFlcCCsLoMOJPlRhCS f9Ej4hhnYYGrEEHE+QqaM4b2mE+DG18Oe8UDf0qlHox2pZCX8YhGWmsxyW6D+0z88FJL Dy1vdAAyYhEabQMjcgNHRJp9AISmZWMPnqqYUMnCLVnaqEPeMMPtBZ/WhnAvantn6y0r JbamlQoJNv7gjDTJSj9QUFeQuErEkllrP5BI/yk/+ttEGdogi5LAfBz1tEwyzvVLuYyv v1lct00LrCEb+XmAzxlCxRS+AEOt1DP2VwRZwI2kJy7rcIurJo29JKrTXSzBtkzMPEop RNvw== X-Gm-Message-State: APjAAAXWefR4oWIss/v4zAfQf/dJOnbBc4kBIRhjonhajiB2CTrrDePp NdCmOGYzJD0fUcBxUqa+juH9HA== X-Google-Smtp-Source: APXvYqwU3phWu021ZksHkbFLtcLsKLyfWY2d+xsu54QDYCzOWlQy1gkDllSESV1InsXH4hWCGMcBow== X-Received: by 2002:a50:b3a6:: with SMTP id s35mr129115181edd.220.1559034210796; Tue, 28 May 2019 02:03:30 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:29 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , Rob Clark Subject: [PATCH 13/33] fbdev: sysfs files can't disappear before the device is gone Date: Tue, 28 May 2019 11:02:44 +0200 Message-Id: <20190528090304.9388-14-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Which means lock_fb_info can never fail. Remove the error handling. Signed-off-by: Daniel Vetter Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst 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 Tue May 28 09:02:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964391 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 9B9DE933 for ; Tue, 28 May 2019 09:06:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8881928757 for ; Tue, 28 May 2019 09:06:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A9C02877E; Tue, 28 May 2019 09:06:25 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22B4528757 for ; Tue, 28 May 2019 09:06:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727054AbfE1JDe (ORCPT ); Tue, 28 May 2019 05:03:34 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:35145 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727036AbfE1JDd (ORCPT ); Tue, 28 May 2019 05:03:33 -0400 Received: by mail-ed1-f65.google.com with SMTP id p26so30642918edr.2 for ; Tue, 28 May 2019 02:03:32 -0700 (PDT) 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=OKOX602Fa7Fbm+vbgel7a44WqYHTJVV0M2SnTAYkwyc=; b=XbjOcs4dHqJnV+UpCk3n+c1kQCjrOCXQqy+ipr/hlU/6I1NQ5nHAEzGop2tsgNjl1i 9Tu7wqCFwvpTcMG3rcRbnAtrjxRmaWQIlJSWJSG9NdgCSC8R+iKOe/dLKn7BQPvCbHiy Us7KBVkIhKGzrJgZJY2qZbATBvZ7UMCUA5Jrc= 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=OKOX602Fa7Fbm+vbgel7a44WqYHTJVV0M2SnTAYkwyc=; b=O+8DdwvqKJUJ7vGA/b2ThwEu4X3hwaOQurxCIQldJH3FPrrErzvqYFJQ67ZTrScq8e uPDhJqOVa1TM8kTKmpLqf1l2iF6FErtBe6NFvfa77WDmb0HJsBP2mcR6xemo+QDWfshy PZCG7n7zTTnd5GfH65yYvt7OrBpwAc0fPqFhFGlX6WTy5OLAPUSEHJgmm62bZBn8Zbvx JqGDEVPYHIeLZACGk0PlXWYvJDJh5IhEGgyimRyTz4A+xdlScsMgvTcNhCc+exsLAyCc EZc9yAXMRSUrNyD5VZRp2ZtKhU5q/g5jOV9PzuwC0+x0vjxDDNbVx+UYHWdIwwZSVZhr 1Y5Q== X-Gm-Message-State: APjAAAVF3KlKaMquj7LO1TUtKAynB4HYflJzt5OBw6wlDaTi4TIN6leP woITFkePWNvmtERNrngUTReNHA== X-Google-Smtp-Source: APXvYqyL24FlvYKpJYYc56lCsYATWOVbIhcR8IC7LZtm5HN5vQe4w00rjmH/HxYYsyvnxUX6o2yynw== X-Received: by 2002:aa7:db0c:: with SMTP id t12mr128412092eds.170.1559034212171; Tue, 28 May 2019 02:03:32 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:31 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Sam Ravnborg , Greg Kroah-Hartman , Maarten Lankhorst , Jens Frederich , Daniel Drake , Jon Nettleton Subject: [PATCH 14/33] staging/olpc: lock_fb_info can't fail Date: Tue, 28 May 2019 11:02:45 +0200 Message-Id: <20190528090304.9388-15-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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 Reviewed-by: Sam Ravnborg Acked-by: Greg Kroah-Hartman Reviewed-by: Maarten Lankhorst Cc: Greg Kroah-Hartman 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 Tue May 28 09:02:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964393 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 C543D933 for ; Tue, 28 May 2019 09:06:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B52E828757 for ; Tue, 28 May 2019 09:06:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A93BF2877E; Tue, 28 May 2019 09:06:29 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 47CC328757 for ; Tue, 28 May 2019 09:06:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727247AbfE1JGY (ORCPT ); Tue, 28 May 2019 05:06:24 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:33587 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727051AbfE1JDf (ORCPT ); Tue, 28 May 2019 05:03:35 -0400 Received: by mail-ed1-f67.google.com with SMTP id n17so30688345edb.0 for ; Tue, 28 May 2019 02:03:34 -0700 (PDT) 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=01fUYB3VzPGfcTugqgqBx5jW8iq7wLyVUX3qXdYLYSk=; b=DIUw/kO/LXyngvpKwzC2ewKvPzp/6OUUrTW3jHZNYZjGOyfUOx9k0Ymf2PWGe0uTX1 aFGbqCs0JBCbXRctZ3Clc9hEOdMbgD2j3dVb6uM642xcQ+8j4uPyEreOpxw8GzNrxnV1 fOlYw4DwyEZcV634rmGq6J/k76ZdCQuxlqhWs= 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=01fUYB3VzPGfcTugqgqBx5jW8iq7wLyVUX3qXdYLYSk=; b=DeHrtuS7wBRl9DX+SnTqDPTEjw0OMAoYpOwBhXKVQNXSiuYMR3rNYppsTGFBOHj1HJ hZtFGNi9cbvayxWDvlyEqP8dKUKqlR2cA1jDS1IeYRYwxmgfPSEgUNx8B/uktWaFP6pn /NMKSvrnpnDCJEvHO0h7Baacp6AlgBx26hq8HllsZhZpkXQRbFtMjNJxgAsbrj662yfa OL0NBwNak6dPCeKf37pSSd6pzMV/v6bzbJXCp7ytYPgUlrTjSKusAXi3W7o2gUOJuAcN hTnYwbh/eyZYuVGJi4TFoI0pnqjNaopDoxNwIZ8udqiGZbngfntcC2Wgqii1akqV4fgh ZaMA== X-Gm-Message-State: APjAAAXiFYxs/fQI1KMMN2QVHKhg1eylWARcuvZv3plhYgdh6+zgUOAk 7xiOgM1Rty6qBVGc0NGaBSgcrg== X-Google-Smtp-Source: APXvYqz0EMzb0SG65WaaBqt1bSsx+8cxym9XyhE58ExT9b6/OKWIr27r6jDPAQ9wP/aEEzvPm7cAVg== X-Received: by 2002:a50:8903:: with SMTP id e3mr126039162ede.11.1559034213606; Tue, 28 May 2019 02:03:33 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:32 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , Mikulas Patocka , "David S. Miller" , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= Subject: [PATCH 15/33] fbdev/atyfb: lock_fb_info can't fail Date: Tue, 28 May 2019 11:02:46 +0200 Message-Id: <20190528090304.9388-16-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It's properly protected by reboot_lock. Signed-off-by: Daniel Vetter Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst 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 Tue May 28 09:02:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964389 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 60B8276 for ; Tue, 28 May 2019 09:06:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4EA5A28757 for ; Tue, 28 May 2019 09:06:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 424E42877E; Tue, 28 May 2019 09:06: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BF2728757 for ; Tue, 28 May 2019 09:06:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727097AbfE1JDi (ORCPT ); Tue, 28 May 2019 05:03:38 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:35153 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727074AbfE1JDh (ORCPT ); Tue, 28 May 2019 05:03:37 -0400 Received: by mail-ed1-f68.google.com with SMTP id p26so30643143edr.2 for ; Tue, 28 May 2019 02:03:35 -0700 (PDT) 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=qp8gYAWJCiDOhrz1RfuOYXHHnFuqBtMXvmbENgYp7nA=; b=D/Qm2B4Nwv9VOkhXwW2zqWA9R6pO/8mljnKNDoMbQqwe10J4DIpCovISBE10ZfmIiz DUfZs/QewB0L/nMLc+4gH29xMFxS8TlJqHQOMPNMiOtE5d5W6SGFISi4qVJuzIvKRILw UsMDYJ37BMOxsF4thN3vvqssEwWctti5fq1Os= 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=qp8gYAWJCiDOhrz1RfuOYXHHnFuqBtMXvmbENgYp7nA=; b=AkpmByddhnHm+PwvyAaRE/tCkorRyeKKxa+eJxxWHvlgfhXaiLKXHey8hfJiJu++si LtY30bLPM9ncIK5SbmCd2JfK5wUP/NO0Pqx3kJUtn1kI4cqSJ8PulJL8yB7g9ddwDOsh 7ZgGyl5Ko0gba1G6NCd1JoUH3oVsCOXMfZckmBv9judSa8mmwpuc6o71/ejiAUM5sIyj Z+zp07OTTly1AyDHbbijRcPGR3D+nnLK9rLx2ngcK1fMnd/z2lHoZQYdZuHsdPYTQaUf FoVSmFQVM9MeVnHE70DwMUEJaBIiWJL1Cj3Vlj0k0HYqgJMo7KdD9OsiOeMCN4Fhphpo 5kRw== X-Gm-Message-State: APjAAAVqFNiGE6tV9g2NQnQG2rNt+l+5WwOpK4rvbplmIzKuD9w3P3JH LBZqddL86eclqIpqUABGcqQTxg== X-Google-Smtp-Source: APXvYqxWwkOmq1B5WlNL4LZsiFHjKy9tx1xdx2Sqd/9u6FMIp/LEyZi1VfAxiFE3W+jJaainnSnkzA== X-Received: by 2002:a17:906:491b:: with SMTP id b27mr33967503ejq.234.1559034215068; Tue, 28 May 2019 02:03:35 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:34 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , Hans de Goede , Yisheng Xie , Sergey Senozhatsky , =?utf-8?q?Noralf_Tr?= =?utf-8?q?=C3=B8nnes?= , Peter Rosin , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Mikulas Patocka , "Gustavo A. R. Silva" Subject: [PATCH 16/33] fbdev: lock_fb_info cannot fail Date: Tue, 28 May 2019 11:02:47 +0200 Message-Id: <20190528090304.9388-17-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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 Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst 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 2811c4afde01..e5ae33c1a8e8 100644 --- a/drivers/video/fbdev/core/fbcmap.c +++ b/drivers/video/fbdev/core/fbcmap.c @@ -285,11 +285,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 5a9fe0c0dd3c..a7e2d5b88914 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -2364,8 +2364,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 bed7698ad18a..d73762324ca2 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; } @@ -1734,14 +1703,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 @@ -1759,11 +1724,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 288175fafaf6..aa8f18163151 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -663,7 +663,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 Tue May 28 09:02:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964387 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 72A04933 for ; Tue, 28 May 2019 09:06:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62DE728776 for ; Tue, 28 May 2019 09:06:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 565CF287A2; Tue, 28 May 2019 09:06:17 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B00A628776 for ; Tue, 28 May 2019 09:06:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726964AbfE1JGP (ORCPT ); Tue, 28 May 2019 05:06:15 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:37286 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727092AbfE1JDi (ORCPT ); Tue, 28 May 2019 05:03:38 -0400 Received: by mail-ed1-f68.google.com with SMTP id w37so30609817edw.4 for ; Tue, 28 May 2019 02:03:37 -0700 (PDT) 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=yaKcaql0G9W2FF9dohChSRJyBaT7k6PGxaYxbUWhNMM=; b=PHQiuhYmhLNnw56rd+9LC8Si1kQHN0WBjahUHUsDHHhN83rtOqqfjnBoWC0MuN6RLD B7WAsmRxU2r/bqlBdO+TAka9/Uotec/8FhnJNPmO9th/YkxzJqWIfMSoYbpVV0KChcvi uSCOUKeob0QuWCAcgtyoQhIjJpp+n21uT0MqY= 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=yaKcaql0G9W2FF9dohChSRJyBaT7k6PGxaYxbUWhNMM=; b=d78Es7wFXZu5xf6VUz7GgRxbumD/q4hKPnbmDH2OQkUCIy97NNu0Qg7nXnK0AdXEfG tqaLHqGiAhRuI0/bGvIpEL7NpSunRaS+/sfOAYLsDVyII2ukrnsQeQ5Y6soImAs1V7rS 60Wm5UsniiVWJ18YYElpDgy1HWyDOUaNjaoBmObZ4pNYpLmKsMeOoTHhZ6085AE0oJaG HADA8wb+1vCpaMyhhnY2pvHdYkDACDCVDIf3Zl+XgdWiRkxgP5zVSU9p3tH5V83gy//l S1TVNvsZn8/CWnVMoWFMnrUKi52G5BvuzvItaVk7CZlVlq+UeF9UWHzuHyFplNczYlIQ Pw6A== X-Gm-Message-State: APjAAAVI1sk7cFAjIPJlSBJXezXlNWIrgaMPAzbKk7R9mayfgQyxB5a2 F93Zvq9UWLfP7k75W7NSnfVKbA== X-Google-Smtp-Source: APXvYqzKotm/46uPM24q5yoliICqC9zZiV7ou5KJH+PAaBUjF08Z+9r3Z4qj1R3JTovsspWncdiMbw== X-Received: by 2002:a17:906:24d8:: with SMTP id f24mr8157454ejb.1.1559034216475; Tue, 28 May 2019 02:03:36 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:35 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , Hans de Goede , Sergey Senozhatsky , Peter Rosin , Kees Cook , Konstantin Khorenko , Yisheng Xie , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Mikulas Patocka , Thomas Zimmermann Subject: [PATCH 17/33] fbcon: call fbcon_fb_bind directly Date: Tue, 28 May 2019 11:02:48 +0200 Message-Id: <20190528090304.9388-18-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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 Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst 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 a7e2d5b88914..142686953b71 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3046,7 +3046,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; @@ -3055,25 +3055,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 && @@ -3106,15 +3102,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 */ @@ -3352,10 +3346,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 d73762324ca2..f3fc2e5b193c 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1716,8 +1716,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) @@ -1725,12 +1723,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 aa8f18163151..b6ce041d9e13 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -158,8 +158,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 Tue May 28 09:02:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964383 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 000C676 for ; Tue, 28 May 2019 09:06:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2DD328757 for ; Tue, 28 May 2019 09:06:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6F252877E; Tue, 28 May 2019 09:06:07 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 100A528757 for ; Tue, 28 May 2019 09:06:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727080AbfE1JDk (ORCPT ); Tue, 28 May 2019 05:03:40 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:34600 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727074AbfE1JDk (ORCPT ); Tue, 28 May 2019 05:03:40 -0400 Received: by mail-ed1-f68.google.com with SMTP id p27so30687375eda.1 for ; Tue, 28 May 2019 02:03:38 -0700 (PDT) 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=eHI5IVXk6rbiogxAf4+pmXRYOJ0Nr3KoY/dH7aae4Ec=; b=Ibl6oEES5fVamIiSNWf16iUWxfJctOaeOQ5rpCQdNoJugNugOKwDZ1MekFe5TE2l8z XhRPIQH4qsuRcK75/K3tWSWDApqhZxftrVa6ChZqf+TY0Yzecg3SvB+F5l2KyJ+dHG2S HAOJPMxwQWK9Kp7/OsiRluCDPlH0dhRu2M4XM= 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=eHI5IVXk6rbiogxAf4+pmXRYOJ0Nr3KoY/dH7aae4Ec=; b=JZ5dPy3j3dGHd1V13TNEKTNEHnI+HuhBSUDKmx4I3bxRlhEBHeKLvMgIULqshw1KU9 oT8iAfDqy0ciOxc4Sg33sj2fPZHRYEGTw7vwgJAZn8+yOnnl0L4CbXPqLejHqqnz5ih5 482in0xmXEWCf/df40AiPMoMgvSs9gRYJ/kDG+f4NqalDECEgaswpQsNJrzPH7l2/b9a 47cmu+StPiIe44NoHb0pwlTXjtIBMUSPR/EGiyi1Mxb+fc/elrAMv4K9iUE25VeNUNWt owyLn5hu/F/UQ4+4x52AAv7qGY9fCPZrOsmVqziFPva26Hi0Vx/ihnOhitjNMR0e+FbJ cBQQ== X-Gm-Message-State: APjAAAU6r08BorHMOWpJ9GFGMflTDDMUrbxsmZjZPyEIdzIIXzKXUe7N Trs1Y68FxfzdHFFQ1kAt1/i55Q== X-Google-Smtp-Source: APXvYqxugSDC57A7rPd1r24SAQm6AVxtazuuZ58on72+1pvHZZEIZnYLrALq7Zz4fkvM/USoATjllw== X-Received: by 2002:aa7:d6d3:: with SMTP id x19mr127434171edr.67.1559034217704; Tue, 28 May 2019 02:03:37 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:37 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , =?utf-8?b?TWljaGE=?= =?utf-8?b?xYIgTWlyb3PFgmF3?= , Peter Rosin , Hans de Goede , Mikulas Patocka Subject: [PATCH 18/33] fbdev: make unregister/unlink functions not fail Date: Tue, 28 May 2019 11:02:49 +0200 Message-Id: <20190528090304.9388-19-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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. v2: fixup unregister_framebuffer in savagefb, fbtft, ivtvfb, and neofb drivers, reported by kbuild. Signed-off-by: Daniel Vetter Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst 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/media/pci/ivtv/ivtvfb.c | 6 +- drivers/staging/fbtft/fbtft-core.c | 4 +- drivers/video/fbdev/core/fbmem.c | 73 ++++++-------------- drivers/video/fbdev/neofb.c | 9 +-- drivers/video/fbdev/savage/savagefb_driver.c | 9 +-- include/linux/fb.h | 4 +- 6 files changed, 31 insertions(+), 74 deletions(-) diff --git a/drivers/media/pci/ivtv/ivtvfb.c b/drivers/media/pci/ivtv/ivtvfb.c index cfd21040d0e3..6435c72ff58e 100644 --- a/drivers/media/pci/ivtv/ivtvfb.c +++ b/drivers/media/pci/ivtv/ivtvfb.c @@ -1258,11 +1258,7 @@ static int ivtvfb_callback_cleanup(struct device *dev, void *p) struct osd_info *oi = itv->osd_info; if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { - if (unregister_framebuffer(&itv->osd_info->ivtvfb_info)) { - IVTVFB_WARN("Framebuffer %d is in use, cannot unload\n", - itv->instance); - return 0; - } + unregister_framebuffer(&itv->osd_info->ivtvfb_info); IVTVFB_INFO("Unregister framebuffer %d\n", itv->instance); itv->ivtvfb_restore = NULL; ivtvfb_blank(FB_BLANK_VSYNC_SUSPEND, &oi->ivtvfb_info); diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index 9b07badf4c6c..7cbc1bdd2d8a 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -891,7 +891,9 @@ int fbtft_unregister_framebuffer(struct fb_info *fb_info) if (par->fbtftops.unregister_backlight) par->fbtftops.unregister_backlight(par); fbtft_sysfs_exit(par); - return unregister_framebuffer(fb_info); + unregister_framebuffer(fb_info); + + return 0; } EXPORT_SYMBOL(fbtft_unregister_framebuffer); diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index f3fc2e5b193c..f3bcad30d3ba 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; @@ -1714,32 +1708,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); @@ -1764,36 +1751,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); @@ -1810,7 +1788,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) { @@ -1824,13 +1801,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); @@ -1927,16 +1904,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/drivers/video/fbdev/neofb.c b/drivers/video/fbdev/neofb.c index 5d3a444083f7..b770946a0920 100644 --- a/drivers/video/fbdev/neofb.c +++ b/drivers/video/fbdev/neofb.c @@ -2122,14 +2122,7 @@ static void neofb_remove(struct pci_dev *dev) DBG("neofb_remove"); if (info) { - /* - * If unregister_framebuffer fails, then - * we will be leaving hooks that could cause - * oopsen laying around. - */ - if (unregister_framebuffer(info)) - printk(KERN_WARNING - "neofb: danger danger! Oopsen imminent!\n"); + unregister_framebuffer(info); neo_unmap_video(info); fb_destroy_modedb(info->monspecs.modedb); diff --git a/drivers/video/fbdev/savage/savagefb_driver.c b/drivers/video/fbdev/savage/savagefb_driver.c index 47b78f0138c3..512789f5f884 100644 --- a/drivers/video/fbdev/savage/savagefb_driver.c +++ b/drivers/video/fbdev/savage/savagefb_driver.c @@ -2333,14 +2333,7 @@ static void savagefb_remove(struct pci_dev *dev) DBG("savagefb_remove"); if (info) { - /* - * If unregister_framebuffer fails, then - * we will be leaving hooks that could cause - * oopsen laying around. - */ - if (unregister_framebuffer(info)) - printk(KERN_WARNING "savagefb: danger danger! " - "Oopsen imminent!\n"); + unregister_framebuffer(info); #ifdef CONFIG_FB_SAVAGE_I2C savagefb_delete_i2c_busses(info); diff --git a/include/linux/fb.h b/include/linux/fb.h index b6ce041d9e13..b90cf7d56bd8 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -634,8 +634,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 Tue May 28 09:02:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964385 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 9695415E6 for ; Tue, 28 May 2019 09:06:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 860E728757 for ; Tue, 28 May 2019 09:06:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A8E22877E; Tue, 28 May 2019 09:06: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1056128757 for ; Tue, 28 May 2019 09:06:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726685AbfE1JGH (ORCPT ); Tue, 28 May 2019 05:06:07 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:45795 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727129AbfE1JDk (ORCPT ); Tue, 28 May 2019 05:03:40 -0400 Received: by mail-ed1-f68.google.com with SMTP id g57so15792120edc.12 for ; Tue, 28 May 2019 02:03:39 -0700 (PDT) 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=jemw2QjWxU+UFHjYLKdEyQ9knTBj8Nqm3v5Mrc95+O8=; b=Q2Q/sGFS+3ztGuIG6HjyW4WqtF83a09htVuw4GKSsgH3cHm7dGKzhjvGuCPzzPDkgL E1/NRgZTaeTYcHOps+FhdcT1PbSFGvlgKFkIBRaH+zrG9UMsmLLURLcCTjDwxR0xLIN3 KwwuXSGHz0AEiTSHK9LXqpPeWcu8jfLUGcaEQ= 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=jemw2QjWxU+UFHjYLKdEyQ9knTBj8Nqm3v5Mrc95+O8=; b=mbtiGY8dRsoEo2eI09lN+HE0kYiogwYfzlqDGAkTWsWqgm0UEKwztaFnTo/HNFig6a PhkhmmYdzkXWNggarnMjyT46EDIjigJNYbGp/2QHOuZ8e8rVd8QKCr/uB4LUyJUuv8Yn QFnVVtF2gJqmVS9sWF0wwFFC91nw+Jm1mOuFgvFfThYZDbHT8AByACP0naf4J7RLZ6Gj 3zLx0XogCS0+1UGwoqvHtYhq330tpy1a3ZXyj1KOVXA5s1VyiTtD+3+K29XBHPXnQ1ot 3mkIBKhawlpYfbCnKk45JiHKMu6jnyUGPFNptRYiLuwNnhX0YPfYQ/DtiOwIfEtMPYJX ivTw== X-Gm-Message-State: APjAAAVnhpBjSZErB1k9bD89vB3hoO05CsdYc8w6RdVHrrV1ixXGLXGb KmMtpQNCScm0B5UFlz5xUf5/BQ== X-Google-Smtp-Source: APXvYqzRmMQx8hio/CkC+ykYBbXTDds6GiLnz4oTtSmCC0xHsSsFWfJG1JCAR/ZOcV6FU9c5NjgHVQ== X-Received: by 2002:a50:ad2b:: with SMTP id y40mr126347451edc.237.1559034218893; Tue, 28 May 2019 02:03:38 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:38 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , =?utf-8?b?TWljaGE=?= =?utf-8?b?xYIgTWlyb3PFgmF3?= , Peter Rosin , Hans de Goede , Mikulas Patocka Subject: [PATCH 19/33] fbdev: unify unlink_framebuffer paths Date: Tue, 28 May 2019 11:02:50 +0200 Message-Id: <20190528090304.9388-20-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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. v3: Fix typoe in subject (Maarten). Signed-off-by: Daniel Vetter Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst Cc: Maarten Lankhorst 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 f3bcad30d3ba..bee45e9405b8 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1722,15 +1722,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); @@ -1753,28 +1768,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 Tue May 28 09:02: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: 10964381 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 55DFA112C for ; Tue, 28 May 2019 09:06:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43C2728757 for ; Tue, 28 May 2019 09:06:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3794E2877E; Tue, 28 May 2019 09:06:06 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A794B28757 for ; Tue, 28 May 2019 09:06:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727168AbfE1JDm (ORCPT ); Tue, 28 May 2019 05:03:42 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:43686 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727145AbfE1JDm (ORCPT ); Tue, 28 May 2019 05:03:42 -0400 Received: by mail-ed1-f66.google.com with SMTP id w33so27264315edb.10 for ; Tue, 28 May 2019 02:03:40 -0700 (PDT) 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=l8PYij8neDId3ryticKg/a8o/KS0Lg5p8XO7y5/XF6o=; b=jHDbHakQeNwnznvXASvVWl7yvcYBqpw2pEJjIlODz4RNjgcrPAWF5fDWm+8CRW99mj +7xQ5CZDwyO//HITpeFemyBkOaJ0JKfiLJv+ZlmHcyvjUsvZpGih+aUcSqpRGHs/pn05 cki+OyKVOY+239GGqpg6Av8ilLiYl6+XuyA2U= 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=l8PYij8neDId3ryticKg/a8o/KS0Lg5p8XO7y5/XF6o=; b=ci8fQVw3GBaQE3uqyehwD3ACEELR566W+CtMP3jhRrNzDVuDZqcuI2ufgMq1fAEfqN SU+mNQyD7dCiapPVzUG6F66P4PIhK2WZ2l4/19isUD2NZNWVrgatYbCwE6gJk64rW5QE /9sCn3si6ZnIJ50ag5TyFY8B+1mSAuBjPRctxXvRjyH7JQIIl4ujg38ZhfzOZBTzbb0y ZEnOGIgG76z2KSMU5HM+G6WgANfVQvE/sSZAbig+YQjyqt9okdEXDW2sF8NQJVz+4OTi aCD/qr8cjFXAeXQqhTYZ1vmpoqWhwNjOXBnviLZupCzq1YtJ5nKodS2Aa8k+iBDavml5 M9mg== X-Gm-Message-State: APjAAAVtqy+90vuqOHiXNnsZ17+OelLgALqvJiOfB8mdxAH19dgGOoMv u+o7ZfVDG11rfA0UOFcagHWkUQ== X-Google-Smtp-Source: APXvYqzumxJgc9HSaOSwBQskNq870ESW7zvYMn/AJyD4+7IHP8Wkq4KJBKohlJDANMT2w6DOnmCTrQ== X-Received: by 2002:a50:8a46:: with SMTP id i64mr126933097edi.177.1559034220244; Tue, 28 May 2019 02:03:40 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:39 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Geert Uytterhoeven , Sam Ravnborg , Maarten Lankhorst , Markus Elfring , Wolfram Sang Subject: [PATCH 20/33] fbdev/sh_mob: Remove fb notifier callback Date: Tue, 28 May 2019 11:02:51 +0200 Message-Id: <20190528090304.9388-21-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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 Reviewed-by: Geert Uytterhoeven Tested-by: Geert Uytterhoeven Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst Cc: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Markus Elfring Cc: Geert Uytterhoeven Cc: Wolfram Sang --- 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 1437695415c9..015a02a29d37 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 */ }; @@ -2239,37 +2238,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 */ @@ -2297,8 +2265,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++) @@ -2688,10 +2654,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 Tue May 28 09:02: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: 10964249 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 CE30076 for ; Tue, 28 May 2019 09:03:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE728271FD for ; Tue, 28 May 2019 09:03:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B170E28776; Tue, 28 May 2019 09:03:47 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CCD6271FD for ; Tue, 28 May 2019 09:03:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727184AbfE1JDq (ORCPT ); Tue, 28 May 2019 05:03:46 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:37296 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727104AbfE1JDn (ORCPT ); Tue, 28 May 2019 05:03:43 -0400 Received: by mail-ed1-f65.google.com with SMTP id w37so30610186edw.4 for ; Tue, 28 May 2019 02:03:42 -0700 (PDT) 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=Ooi4hbNCFWLvdn7gPI0VJoLcd+qEK7EqaAEtyPgNrvM=; b=S8RfuEcjpgpmoyZCzNoHK8dLIiuaW5CIB+VxCtfy6GnMIvrlpna7ceB7yiYxlqeHrx jBndnR2Hh/seM8PvHDCU54zhrIhNO//uE0eeo4boFXOzPL0By8avIVPg8TTg4Wj8XJK1 ro2g9jS6/je89BQPID7iNTY1Jt2ifOIDPf2Zs= 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=Ooi4hbNCFWLvdn7gPI0VJoLcd+qEK7EqaAEtyPgNrvM=; b=mQS3wW28L8Yig/9vlrKwZ6HyMUWtlqERKd19Li4LIagx8Qc285PHV2CmYKZlI3LIFQ uw8VUep7A/H//M+MQWqrs8kCvaZQ944nAFeBbEa7DMYoQui9x8XyRGCVWVqFYxUYHNeA XsU+Tc4DOGuBBSz7Lmxs+LVprBomZJE7eZp3C8ry9vhvUvBFHtD69FxIwXY0CVsjGBAv 1V094Kfnc7v7LiOE4oSjrsPksGfFPuptx08EJQHfllpNyLDARI+bm6bpsu3bzcKM0ztf gEIU/SKp57UDXstgiJVV6gmHBuMRJ7lt3bueVf9RveFj8+02WPQLtsF9DYPW2CRVP+j0 jhLQ== X-Gm-Message-State: APjAAAVOzf9Zyg021Wrc3Lc85gYXN1enYg03HiB0A+fEZNPfMebYrpeA lv260kpPD4rItg2TFf55yN7b0w== X-Google-Smtp-Source: APXvYqx2/pj/om14dAedFkMIr9nON3I1vQ8gKLDTPmWBJKmhJYG5UizCgUZgKeSWqd6Rhcjw75tXeg== X-Received: by 2002:a17:906:9145:: with SMTP id y5mr57481511ejw.206.1559034221591; Tue, 28 May 2019 02:03:41 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:40 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , Hans de Goede , Greg Kroah-Hartman , Prarit Bhargava , Kees Cook , Konstantin Khorenko , Yisheng Xie , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Peter Rosin , Mikulas Patocka Subject: [PATCH 21/33] fbdev: directly call fbcon_suspended/resumed Date: Tue, 28 May 2019 11:02:52 +0200 Message-Id: <20190528090304.9388-22-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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. v3: fixup !CONFIG_FRAMEBUFFER_CONSOLE, noticed by kbuild Signed-off-by: Daniel Vetter Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst 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 142686953b71..e3267d71395c 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -2919,7 +2919,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; @@ -2932,7 +2932,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; @@ -3330,12 +3330,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 bee45e9405b8..73269dedcd45 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1917,17 +1917,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 b90cf7d56bd8..794b386415b7 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 diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h index 38d44fdb6d14..790c42ec7b5d 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(struct fb_info *info) {} +static inline void fbcon_resumed(struct fb_info *info) {} #endif #endif /* _LINUX_FBCON_H */ From patchwork Tue May 28 09:02: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: 10964251 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 6A7E5112C for ; Tue, 28 May 2019 09:03:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59E56271FD for ; Tue, 28 May 2019 09:03:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4DB32285E2; Tue, 28 May 2019 09:03: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45EF9285D2 for ; Tue, 28 May 2019 09:03:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727188AbfE1JDq (ORCPT ); Tue, 28 May 2019 05:03:46 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:47081 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727175AbfE1JDp (ORCPT ); Tue, 28 May 2019 05:03:45 -0400 Received: by mail-ed1-f68.google.com with SMTP id f37so30563055edb.13 for ; Tue, 28 May 2019 02:03:43 -0700 (PDT) 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=rNBJhiQm3QtWHoSITdA9k7CBQWZOP0J/7NNptnKcbZo=; b=dYYBlrvtmXuD/rIq0AB0jguBiU/CNNLAbA6WmSlJQIZ+yRCtx/LctjbM1MQD0W/b1y qLcBRd2UA/UxgxFxWmst9VBs+4cNWDRtceOXBTs/vxprZ2s4IAYBexP6TqvhJX1JQKPQ 7DiZ1IZlG5hVp9FoIf3aOBg1jXZNd+XeHj29g= 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=rNBJhiQm3QtWHoSITdA9k7CBQWZOP0J/7NNptnKcbZo=; b=UovGpN+dYvhYlqgzhq5Wdta+obUzcCir4Pp49BsIghfOOJZw+pyBKzZzBCmk/oJt5s 9r4YrTOScwOZyVzj3zMMeY2cdHBemAfxap5UZos4kaddXte/KDjA3F40MCZWWyaGTe13 CALUfHptBd/GstnMS/rSyJGaxiiLl7FzJobjR9rdg64ZYUR31TVVUGtSQd7+qJztCKFU AxKAYBfVWVoQVKgEdwWQ0e5fWSEGrzJMciZbuunAMQRioqQP4DN7EZublwkCR7de8FKZ 8yOHSeCH6KDPYdBe70k1lsUepqNSvu29s080yJRLrowYTj4dlgznna1uu5uKEyvoOlZw PP2A== X-Gm-Message-State: APjAAAUpjR3NvCuZXSY5yXIlZGxFqgeZdyl9NWMVuuDQZru225pRl0QL eJTE046rlm1Tg325SzuBLywdlw== X-Google-Smtp-Source: APXvYqxNNixKWrlzaYumQEkWdIfNSLuYtCKS5s2p8GnMvuoJF4Q+3V//pjVusGXfoJ8b89my2E1rng== X-Received: by 2002:a17:906:cd08:: with SMTP id oz8mr55467207ejb.67.1559034223020; Tue, 28 May 2019 02:03:43 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:42 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , Hans de Goede , Mikulas Patocka , Sergey Senozhatsky , Kees Cook , Peter Rosin , Yisheng Xie , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH 22/33] fbcon: Call fbcon_mode_deleted/new_modelist directly Date: Tue, 28 May 2019 11:02:53 +0200 Message-Id: <20190528090304.9388-23-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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. v2: static inline for the dummy versions, I forgot. Signed-off-by: Daniel Vetter Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst 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 e3267d71395c..515366308537 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3019,8 +3019,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; @@ -3262,7 +3262,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; @@ -3324,7 +3324,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; @@ -3336,10 +3335,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; @@ -3353,9 +3348,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 73269dedcd45..cbdd141e7695 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; @@ -1992,7 +1987,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; @@ -2012,14 +2006,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 794b386415b7..7a788ed8c7b5 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 #ifdef CONFIG_GUMSTIX_AM200EPD /* only used by mach-pxa/am200epd.c */ @@ -142,9 +140,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 790c42ec7b5d..c139834342f5 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(struct fb_info *info) {} static inline void fbcon_resumed(struct fb_info *info) {} +static inline int fbcon_mode_deleted(struct fb_info *info, + struct fb_videomode *mode) { return 0; } +static inline void fbcon_new_modelist(struct fb_info *info) {} #endif #endif /* _LINUX_FBCON_H */ From patchwork Tue May 28 09:02:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964329 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 EEA9E76 for ; Tue, 28 May 2019 09:04:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEAC7271FD for ; Tue, 28 May 2019 09:04:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2102285F7; Tue, 28 May 2019 09:04: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E82C8285E2 for ; Tue, 28 May 2019 09:04:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727191AbfE1JDr (ORCPT ); Tue, 28 May 2019 05:03:47 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:40493 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727146AbfE1JDq (ORCPT ); Tue, 28 May 2019 05:03:46 -0400 Received: by mail-ed1-f65.google.com with SMTP id s19so2500114edq.7 for ; Tue, 28 May 2019 02:03:45 -0700 (PDT) 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=7cWHgfcnxD5I2BYjyMESTRE5UT0aIyijX/8odiiRxgw=; b=GlkHs7h288I4VAt2Wsjm8nLyS+B7h+Dtgxf6FxBZNbe8tu/qGhaA16KftXEf1mJ5ug bL1vUnjwuAB0uvbqE/PZsMxIhuIFbBFYtLhXdSNB/xBXBJ+cHgXwtmYHiVw3Ja48hVMb 3vDsldEi2HaPKptlVv1u+oBma3NTApwQZqe80= 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=7cWHgfcnxD5I2BYjyMESTRE5UT0aIyijX/8odiiRxgw=; b=eAJdjrINwzjfdTpUe6YFs1baxdZHp67PZE/y2aqXPy1uXUatUP6La/oh//Lchmr152 4xk+ZtPNQJlOaSJPXVeLeh3/wnFC75PXYZJz7UGanQyxJ+ccmgoONFXeB6EFdtizxxBw DZzjil7TnoaN4Dd4hFm34RqXGiwnpXAQ5J9mPyV+5dB6TzWz/LnmjHPv8W/D/oJqbuKG laYEj5/xkoEt1t4HIRq/VNSKO8QUc+7yyIyyr4m//y3PPqHOype15+ffPApj4m0qtj+d PXw4Da6fOX3kLzJZEBCMrl5urYLXWVUE1IwGKLdWI9rmbeaMCEwXpfBnyUcAa5Tc41fF zOZw== X-Gm-Message-State: APjAAAVjIg+OlERIG2csYXDlBB0IVe7ti+6/ruzDjG+zOq6nWzsPWPK7 iSIWkM1FySCfk23VgIqcJw6UmQ== X-Google-Smtp-Source: APXvYqyX9S6oHBIHBIGW/9NIZtlG5/2Myp+Wl1BI9XPUva2TrxMFDV17OVdC7KUz960S5dQ16cG0Dw== X-Received: by 2002:a50:ba1a:: with SMTP id g26mr127396218edc.90.1559034224558; Tue, 28 May 2019 02:03:44 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:43 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , Hans de Goede , "Steven Rostedt (VMware)" , Prarit Bhargava , Kees Cook , Yisheng Xie , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Peter Rosin , Mikulas Patocka Subject: [PATCH 23/33] fbdev: Call fbcon_get_requirement directly Date: Tue, 28 May 2019 11:02:54 +0200 Message-Id: <20190528090304.9388-24-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Pretty simple case really. v2: Forgot to remove a break; v3: Add static inline to the dummy versions. Signed-off-by: Daniel Vetter Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst 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 515366308537..ef69bd4ad343 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3283,8 +3283,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; @@ -3325,7 +3325,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) { @@ -3348,10 +3347,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 cbdd141e7695..ddc0c16b8bbf 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 7a788ed8c7b5..0d86aa31bf8d 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -143,8 +143,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 c139834342f5..305e4f2eddac 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(struct fb_info *info) {} static inline int fbcon_mode_deleted(struct fb_info *info, struct fb_videomode *mode) { return 0; } static inline void fbcon_new_modelist(struct fb_info *info) {} +static inline void fbcon_get_requirement(struct fb_info *info, + struct fb_blit_caps *caps) {} #endif #endif /* _LINUX_FBCON_H */ From patchwork Tue May 28 09:02: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: 10964323 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 995D2112C for ; Tue, 28 May 2019 09:04:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A2AA271FD for ; Tue, 28 May 2019 09:04:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E54E28776; Tue, 28 May 2019 09:04: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B11D3271FD for ; Tue, 28 May 2019 09:04:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727199AbfE1JDs (ORCPT ); Tue, 28 May 2019 05:03:48 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:43710 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727189AbfE1JDs (ORCPT ); Tue, 28 May 2019 05:03:48 -0400 Received: by mail-ed1-f68.google.com with SMTP id w33so27264824edb.10 for ; Tue, 28 May 2019 02:03:47 -0700 (PDT) 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=cTKR1bWS92y6jx6235i5jk8TVLc5SUi6voiWrgnxv1k=; b=OHI09ErVKCCmMw4Q30PsUkK6DLxfVjZA/v6bgqkrsxPD+SkwEMnDS4vf/ltiyIINaj Ztss2ZLiyE5rSM5QHY5CO2EJUbNv2J8wR3rHcRdLG5/VJS4lIsTYR6xFu9TJvBrksi6M Bj3zaD4xeBsKjtCVcB/MjLtt13R0cup4wCy24= 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=cTKR1bWS92y6jx6235i5jk8TVLc5SUi6voiWrgnxv1k=; b=NkQd8yP9E0t7F0SFSgvEW2Ryf9HtfLTjjBUlzpboefzJh7kLa7jy8LVA/3AcfqJgFn pKab11CK+hWR3R3ELjs009kxd2weXEMtR4vlmol+RQk4R2mHjBvKejNosVbd9hGMgZa2 dgaR+jvqgscZyZ/BiwwreL+TrhjRn/T0IcfC2Cp6q/uRyfPxo/wIZPHVOr5yFV7ARIMA lmV6lTZKlZZ8pxApt4THqCfSwnCiuUd5BcEkJpZQA4AUAGmz2IEGF3EMN9DF9HTrEUrC opF72n0ZhLaKVhnmniQgmC+Q5NzYW5nSmUnugWv5xgGayaig/PkQRVyhxr0rD6OWl+ZP kTew== X-Gm-Message-State: APjAAAWH/bmGvtIqXunz4LGt+HQErm86xFeA02KGY0cHzJiE2VJDZbRF vAUrk8ttyU71Yp2mtnkK7G1aXA== X-Google-Smtp-Source: APXvYqw0UlMJtntWrCQdXZs42SphN4v03iode4I9FwSIGIRrtr2+bmQmVcbINRSwPmSdFt+oMljvkg== X-Received: by 2002:aa7:dd03:: with SMTP id i3mr90707826edv.93.1559034226420; Tue, 28 May 2019 02:03:46 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:45 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Richard Purdie , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , Lee Jones , Jingoo Han , Hans de Goede , Yisheng Xie Subject: [PATCH 24/33] Revert "backlight/fbcon: Add FB_EVENT_CONBLANK" Date: Tue, 28 May 2019 11:02:55 +0200 Message-Id: <20190528090304.9388-25-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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. v2: Add static inline to the dummy version. Cc: Richard Purdie Signed-off-by: Daniel Vetter Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst 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 Acked-by: Daniel Thompson --- drivers/video/backlight/backlight.c | 2 +- drivers/video/fbdev/core/fbcon.c | 14 +------------- drivers/video/fbdev/core/fbmem.c | 1 + include/linux/fb.h | 4 +--- include/linux/fbcon.h | 2 ++ 5 files changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 1ef8b6fd62ac..5dc07106a59e 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -47,7 +47,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 ef69bd4ad343..a4617067ff24 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -2350,8 +2350,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; @@ -2362,13 +2360,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) @@ -3240,7 +3231,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; @@ -3344,9 +3335,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 ddc0c16b8bbf..9366fbe99a58 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/fb.h b/include/linux/fb.h index 0d86aa31bf8d..1e66fac3124f 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -137,12 +137,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 */ diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h index 305e4f2eddac..d67d7ec51ef9 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 @@ static inline int fbcon_mode_deleted(struct fb_info *info, static inline void fbcon_new_modelist(struct fb_info *info) {} static inline void fbcon_get_requirement(struct fb_info *info, struct fb_blit_caps *caps) {} +static inline void fbcon_fb_blanked(struct fb_info *info, int blank) {} #endif #endif /* _LINUX_FBCON_H */ From patchwork Tue May 28 09:02:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964317 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 B9A6415E6 for ; Tue, 28 May 2019 09:04:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6C26271FD for ; Tue, 28 May 2019 09:04:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A756285F7; Tue, 28 May 2019 09:04:27 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21C21285E2 for ; Tue, 28 May 2019 09:04:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726687AbfE1JE0 (ORCPT ); Tue, 28 May 2019 05:04:26 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:45819 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726862AbfE1JDt (ORCPT ); Tue, 28 May 2019 05:03:49 -0400 Received: by mail-ed1-f67.google.com with SMTP id g57so15792844edc.12 for ; Tue, 28 May 2019 02:03:48 -0700 (PDT) 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=DzlOvTHyKR8X8+iBqAU0JNunUmi7G22ipv63hi4doZE=; b=Ot/iReF0+zGL2ux5khVmaDK70Uagz7In4B2rbxJXjuNP8F6SbXFIAjSqOfAdZolZb2 Y/CAyNTVeJp3rkNo2d/NWhBV91roYEwu0xRWSDB8Tr7Uh5l7hmQ2p8f0CK2uPx6NBg4H dEd9pUT5bwd3PM1mf54qS2N1sUJMXiZ1VAf6s= 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=DzlOvTHyKR8X8+iBqAU0JNunUmi7G22ipv63hi4doZE=; b=N4USMEuCcDffYspjCrNT2XscWW8o31gF/WSdIM5EP702qKWJ130Jwhsg9jbYXz2i2I 5c42o+lPdhfaLBiK1hsucDLGis4VTeBlicQ6n7EgYm2V49JIs+jjdz9UkRAp/nmqkbci hfLvUZcGnb4wP76R3L7HTwmN6u6cdR2Hy48obVcDUT9qb2SOmxkX6NYFZDlibJO2Twie Dgj2Nj2mDed7OcTWIAkOtx0I2t+Sw6GnvmvL7xNFpSq3m3F7PE6JWu/ktarUTaXd//Fd rbTN93xx5IgOp3CRgkoJeiUOjqYwOhVfSJ1WtqwTGTW7Qezl3xNPC24NYEuR+ZhKNb+R B6Ow== X-Gm-Message-State: APjAAAVKKi2rCVh6+or6eBlbmHm2fyFj1pLwWlDce6PKbSrQ2hmxIlth 2vYTsfy1OP7nqw90eKFPaZdlCqmjC2M= X-Google-Smtp-Source: APXvYqxR9rzUeVIfHotbm5CmrJdDR2kkb2EUOxTpdDMxUJEdxcWzu6TDjgW9oBowUrDB8sqrB+FIDw== X-Received: by 2002:a50:a5f1:: with SMTP id b46mr126780110edc.167.1559034227646; Tue, 28 May 2019 02:03:47 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:47 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , =?utf-8?b?TWljaGE=?= =?utf-8?b?xYIgTWlyb3PFgmF3?= , Peter Rosin , Hans de Goede , Mikulas Patocka , Rob Clark Subject: [PATCH 25/33] fbmem: pull fbcon_fb_blanked out of fb_blank Date: Tue, 28 May 2019 11:02:56 +0200 Message-Id: <20190528090304.9388-26-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There's a callchain of: fbcon_fb_blanked -> 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. v3: Fix typo in callchain in the commmit message (Sam). Signed-off-by: Daniel Vetter Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst Cc: Sam Ravnborg 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 9366fbe99a58..d6713dce9e31 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 Tue May 28 09:02:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964313 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 7312376 for ; Tue, 28 May 2019 09:04:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62A4C271FD for ; Tue, 28 May 2019 09:04:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56073285F7; Tue, 28 May 2019 09:04:26 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCD53271FD for ; Tue, 28 May 2019 09:04:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726768AbfE1JEY (ORCPT ); Tue, 28 May 2019 05:04:24 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:42035 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727212AbfE1JDu (ORCPT ); Tue, 28 May 2019 05:03:50 -0400 Received: by mail-ed1-f67.google.com with SMTP id g24so2700027eds.9 for ; Tue, 28 May 2019 02:03:49 -0700 (PDT) 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=xdSAzTv9tDPr6PTxvMhXZVM/Er2L9zs7q0S7NNjW/ok=; b=XG2Xk6QdQnFvZNtT1FJSbJRUie40rMANdM0srLaNSg5DjS2kagtuP2RFgL4VendVOT BabNgErILkSIbHiZbTBTMTYqlOuoHuDBbXOVrWrUlgwpokq6/Wf0htlfVQ/vZhH8sFl9 dkgrYC8vItg/cnP9Ums7sqMpu0F3/0mku30MA= 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=xdSAzTv9tDPr6PTxvMhXZVM/Er2L9zs7q0S7NNjW/ok=; b=MUxjjXCRHS2KUhqdQWlItR/cbfBZJjWFvGoOoImdOCQk2uFfOB92jlyyNc0q1PTY+x I0DngRVaBPixwkLm/X2FcEOA2IgGPqqc1zgjx96Qbc43CDP94qfzoiajQTwmt3jWLApZ B53cnxNc/qYrZYP48tasBSfCkrdm1bB93rNiL0s3lSo0HzNr38czGp5Hg9AYreCtccHc L+vnGm92RXsGdbwVp9s6E/d6N4SAcRw1teCMtdNyxgiIKxN5L+XFydcGlImn6R3vNaV/ aYj/Hl2PydwUPLpR1Z2QwmdHkdbUDlipv+TZnnpYCxFDuwkbKuA25dsgV3FFC8hECUOt YJ/g== X-Gm-Message-State: APjAAAXw0ucw0inYeIdigMFsG1YxBg6TSXfiZF/z2coOS2/gz+rIh1RM iX0FV3iD0FWi1MIuLlS9SXjZpg== X-Google-Smtp-Source: APXvYqz7N+WGbx3CGIzAcTP4j/O/T91KOj5m1m+2vfXlGhtH0z7XZhnZ1uDp1ATj69H/KzvnZS3Kaw== X-Received: by 2002:a50:f4fb:: with SMTP id v56mr128756589edm.13.1559034228987; Tue, 28 May 2019 02:03:48 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:48 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , Hans de Goede , Yisheng Xie , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Peter Rosin , Mikulas Patocka , Rob Clark Subject: [PATCH 26/33] fbdev: remove FBINFO_MISC_USEREVENT around fb_blank Date: Tue, 28 May 2019 11:02:57 +0200 Message-Id: <20190528090304.9388-27-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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 Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst 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 a4617067ff24..b5ee89f16d6c 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -2386,9 +2386,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 d6713dce9e31..25ae466ba593 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 Tue May 28 09:02: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: 10964311 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 80CB676 for ; Tue, 28 May 2019 09:04:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F547271FD for ; Tue, 28 May 2019 09:04:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 633FE285F7; Tue, 28 May 2019 09:04:25 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C063B285E2 for ; Tue, 28 May 2019 09:04:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727229AbfE1JEY (ORCPT ); Tue, 28 May 2019 05:04:24 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:45824 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727228AbfE1JDv (ORCPT ); Tue, 28 May 2019 05:03:51 -0400 Received: by mail-ed1-f66.google.com with SMTP id g57so15793059edc.12 for ; Tue, 28 May 2019 02:03:51 -0700 (PDT) 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=iiVfim/c+lvRDBMKUU1Yj60R+0JeKrGf/yz70RKA77g=; b=JYsGFCPLw0HGmIgkl4SP/xcs7QXPG5ftMgs45iq0et9pU5+4wFqKw0dMai5DrVT4u4 ld5Zz32T14l/6/XAhMdSVqkawzt+gu1WCverQZqTaHCNFsxOdC8/bZymAAf4ztZDQMtu 30rpeKzEEOmbclY0qvZTWQ38AcfubFsdxhkq4= 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=iiVfim/c+lvRDBMKUU1Yj60R+0JeKrGf/yz70RKA77g=; b=Fp7zDW6rtTmxMs+WGX9izRSuZx1XWNgFvL+3hvnxkHhVH1didmXHR0JEe/FnTuNpG4 yezdPAlIjaIR8ckU0NIasYNFx/+x2Np2wgSeb1o0zLCSLLlsTIAzMWiXoo7y9VpejFQO CqbuJDNo6LWvKvqaTctvkkwsJhbc2dNhjw0fSf8PQno3U3pPerFs4hC1tHqswC0xBPBE vws2htiXzwXoXxLmiQP54Sl2jf0VRJLIfWhmBi1HdWCJ/BDCtTrxJ4jafFdQm9NMUyEk RH+5k6+7O1DA5fn5T0PKYPe+Kx1ks6uw+XzibJQiquxQGFKe9gFUnPjAj9ECv7WPfgU2 7N+A== X-Gm-Message-State: APjAAAWKnvqtoCkA9CT/YIJmHJYUb5eP7M/dt1a+57hJyRZyc9zg9xm8 z5/S08c4hLtBzNtnLfziloPkMw== X-Google-Smtp-Source: APXvYqw2LqUX9K5HB5JJb1MV5fYYcTI5zm8X5V8jSfDpsJbxV2t3AOoInz4qZFPA7VbBrQW+eH0NZA== X-Received: by 2002:a05:6402:1256:: with SMTP id l22mr10497147edw.22.1559034230490; Tue, 28 May 2019 02:03:50 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:49 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , =?utf-8?b?TWljaGE=?= =?utf-8?b?xYIgTWlyb3PFgmF3?= , Peter Rosin , Hans de Goede , Mikulas Patocka Subject: [PATCH 27/33] fb: Flatten control flow in fb_set_var Date: Tue, 28 May 2019 11:02:58 +0200 Message-Id: <20190528090304.9388-28-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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 Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst 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 25ae466ba593..96805fe85332 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; + } - ret = info->fbops->fb_check_var(var, info); + if (!info->fbops->fb_check_var) { + *var = info->var; + return 0; + } - if (ret) - goto done; + ret = info->fbops->fb_check_var(var, info); - if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) { - struct fb_var_screeninfo old_var; - struct fb_videomode mode; + if (ret) + return ret; - if (info->fbops->fb_get_caps) { - ret = fb_check_caps(info, var, activate); + if ((var->activate & FB_ACTIVATE_MASK) != FB_ACTIVATE_NOW) + return 0; - if (ret) - goto done; - } + if (info->fbops->fb_get_caps) { + ret = fb_check_caps(info, var, activate); - old_var = info->var; - info->var = *var; + if (ret) + return ret; + } - if (info->fbops->fb_set_par) { - ret = info->fbops->fb_set_par(info); + old_var = info->var; + info->var = *var; - if (ret) { - info->var = old_var; - printk(KERN_WARNING "detected " - "fb_set_par error, " - "error code: %d\n", ret); - goto done; - } - } + 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); + 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 Tue May 28 09:02: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: 10964259 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 68C7C112C for ; Tue, 28 May 2019 09:03:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 58E96271FD for ; Tue, 28 May 2019 09:03:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D061285D2; Tue, 28 May 2019 09:03:57 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 955A3271FD for ; Tue, 28 May 2019 09:03:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727266AbfE1JDy (ORCPT ); Tue, 28 May 2019 05:03:54 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:36046 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726650AbfE1JDy (ORCPT ); Tue, 28 May 2019 05:03:54 -0400 Received: by mail-ed1-f68.google.com with SMTP id a8so30640782edx.3 for ; Tue, 28 May 2019 02:03:52 -0700 (PDT) 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=SgQWN7Qy07XY45PDKbsaea7nHd8fOh7HY7vqc9lDDrs=; b=YhveFO6obxkf1L+jx+Db6oCLojH8CuDk3NDP3lgx0zz5NWc5nsbUOdsUIehgIeM1BN WBWnqZTWmwGNFioJLhLKku7J2HgapnGW/0sSUYT1PcRDKQ2e+WNt4i+aF9S/ndAkM4f4 M8HqFzn+hYlkOTc0lkNvpclW85IFdksfD5yyo= 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=SgQWN7Qy07XY45PDKbsaea7nHd8fOh7HY7vqc9lDDrs=; b=au9Yq9lBPVyZ64HZgHugcASs0aBbAa2+ZCMVm7O3dApvw1/CgcRk849Kc+ZFwD2I6S pw3gKqFAyrcdQaKdXr4iTwK6HXmmVvualAy8YscLPOajMiQwM0mxHFoqjAy/3kU/AGzL 3cuOqTWRjkVznaXNJzMQreVeYKAc+eaVg+yihrlRCnFBEdP+sLg6pVais8dnLQNiGEh0 HZzLWbs+RzfeKzaRYxLFWN7G+YQy6XAdz5X3tJmPoDcKaRspnwN01cfVe4HHgoJm+f+b THtUwWdHse/UsDg5tWTTEu58hQeWOEmNRmK289pgt7YK3RoZ3hne5Mw2rNauo5E1RJ/3 udsg== X-Gm-Message-State: APjAAAVjaFdsRkFcje3+oWEiKZbRTosVlTczqkvonVchWfFYLxqzuaOg rBiE4PZu73TVk3vgEonSxFFXYw== X-Google-Smtp-Source: APXvYqxVTZUIX6lxXo/QeyQ8pL9p1Nq12n0SxFCxYKtzi01dHjTvu+RQjNbAYck6bJqcamIfge9zxA== X-Received: by 2002:a17:906:5390:: with SMTP id g16mr93483147ejo.12.1559034231783; Tue, 28 May 2019 02:03:51 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:51 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Sam Ravnborg , Daniel Vetter , Maarten Lankhorst , Lee Jones , Jingoo Han , Hans de Goede , Yisheng Xie , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Peter Rosin , Mikulas Patocka Subject: [PATCH 28/33] fbcon: replace FB_EVENT_MODE_CHANGE/_ALL with direct calls Date: Tue, 28 May 2019 11:02:59 +0200 Message-Id: <20190528090304.9388-29-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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. v2: backlight notifier is also interested in the mode change event, it calls lcd->set_mode, of which there are 3 implementations. Thanks to Maarten for spotting this. So we keep that. We can ditch the differentiation between mode change and all mode changes (because backlight notifier doesn't care), and we can drop the FBINFO_MISC_USEREVENT stuff too, because that's just to prevent recursion between fbmem.c and fbcon.c. While at it flatten the control flow a bit. v3: Need to add a static inline to the dummy function. v4: Add missing #include to sh_mob (Sam). Cc: Sam Ravnborg Signed-off-by: Daniel Vetter Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst Cc: Maarten Lankhorst 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 Acked-by: Daniel Thompson --- drivers/video/backlight/lcd.c | 1 - drivers/video/fbdev/core/fbcon.c | 15 +++++++++------ drivers/video/fbdev/core/fbmem.c | 21 ++++++++++----------- drivers/video/fbdev/sh_mobile_lcdcfb.c | 12 ++---------- include/linux/fb.h | 2 -- include/linux/fbcon.h | 2 ++ 6 files changed, 23 insertions(+), 30 deletions(-) diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c index 151b18776add..ecdda06989d0 100644 --- a/drivers/video/backlight/lcd.c +++ b/drivers/video/backlight/lcd.c @@ -34,7 +34,6 @@ static int fb_notifier_callback(struct notifier_block *self, 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 b5ee89f16d6c..e98551f96138 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3009,6 +3009,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) { @@ -3318,12 +3327,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 96805fe85332..dd1a708df1a7 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -957,6 +957,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) u32 activate; struct fb_var_screeninfo old_var; struct fb_videomode mode; + struct fb_event event; if (var->activate & FB_ACTIVATE_INV_MODE) { struct fb_videomode mode1, mode2; @@ -1039,19 +1040,17 @@ 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; + if (ret) + return ret; - info->flags &= ~FBINFO_MISC_USEREVENT; - event.info = info; - event.data = &mode; - fb_notifier_call_chain(evnt, &event); - } + event.info = info; + event.data = &mode; + fb_notifier_call_chain(FB_EVENT_MODE_CHANGE, &event); - return ret; + if (flags & FBINFO_MISC_USEREVENT) + fbcon_update_vcs(info, activate & FB_ACTIVATE_ALL); + + return 0; } EXPORT_SYMBOL(fb_set_var); diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c index 015a02a29d37..b8454424910d 100644 --- a/drivers/video/fbdev/sh_mobile_lcdcfb.c +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -1757,8 +1758,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 */ @@ -1780,14 +1779,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 1e66fac3124f..f9c212f9b661 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -139,8 +139,6 @@ struct fb_cursor_user { #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 d67d7ec51ef9..de31eeb22c97 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 @@ static inline void fbcon_new_modelist(struct fb_info *info) {} static inline void fbcon_get_requirement(struct fb_info *info, struct fb_blit_caps *caps) {} static inline void fbcon_fb_blanked(struct fb_info *info, int blank) {} +static inline void fbcon_update_vcs(struct fb_info *info, bool all) {} #endif #endif /* _LINUX_FBCON_H */ From patchwork Tue May 28 09:03:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964299 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 DB87E15E6 for ; Tue, 28 May 2019 09:04:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC62B271FD for ; Tue, 28 May 2019 09:04:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C021A285E2; Tue, 28 May 2019 09:04: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A7C128649 for ; Tue, 28 May 2019 09:04:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727267AbfE1JDz (ORCPT ); Tue, 28 May 2019 05:03:55 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:38172 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726830AbfE1JDz (ORCPT ); Tue, 28 May 2019 05:03:55 -0400 Received: by mail-ed1-f67.google.com with SMTP id g13so838078edu.5 for ; Tue, 28 May 2019 02:03:53 -0700 (PDT) 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=cIvSBS1B4MGUlvtXGtjMOQmcHlrlcr23oBPyjEdIMqw=; b=kEX1dBYsfLZqMz1zXWP5urOCL4wj3GR50ijZkMz53o+IqxGumJznNh5bWHFqzz/57F g2GIL+FYqK5zeRJoDlXmOwePs6wvEYLvE/nkB5jnXi45FLkvBnGQbiXCyV5IfNvHSdoU Rfo20w4pFvtVPLYS9Hx6btvQPMdK9n+DhCJB0= 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=cIvSBS1B4MGUlvtXGtjMOQmcHlrlcr23oBPyjEdIMqw=; b=Q5kKkXok1rFKfPFCnF80Ewv7Dvx9sXr0PQltHX1qpz1dkaOKDO8zy3nnZps2BvAfaE cCj0P9GbzwcPHP2iQBxWp1arw5KhDJns2S05gKFubjD56Y5Q8ZpTmhbyeD+4IjMDEYfE Btc7qxDaZa+IWPIaa+wWL/hbS3+HSIe1aoJP2TlQDp38Ikp3qVNac27opZeqNi8DBfic VtvlnrkLk+rnpKyRHgIOxFS3QhQI6wMpW7qro7AQPmJx0zNUtxxgrSPiSqCAqaT1JUeS BG52R7FKBXCVmblICxlAzFtQSb576AysrgIJMIhJocMSu5ZSKFSjMnh22fQGaAnx/fRp sVgA== X-Gm-Message-State: APjAAAUWz9Z/gzUzHc36PHOZEz48rzBhdtmswrb25zDVgqPrv9XhWPhK 3/jL7eWKFxGyDSwxfJfw4DglZQ== X-Google-Smtp-Source: APXvYqzrT5yIPISvSHUclVX4EyZRCO+vxYwOVOnyeJaJPQCsiQ0H7rBwVIiiDjjc89dl8HybwqjL5A== X-Received: by 2002:a17:906:f14a:: with SMTP id gw10mr94060688ejb.158.1559034233120; Tue, 28 May 2019 02:03:53 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:52 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Lukas Wunner , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , David Airlie , Daniel Vetter , Maxime Ripard , Sean Paul , Hans de Goede , Yisheng Xie Subject: [PATCH 29/33] vgaswitcheroo: call fbcon_remap_all directly Date: Tue, 28 May 2019 11:03:00 +0200 Message-Id: <20190528090304.9388-30-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP While at it, clean up the interface a bit and push the console locking into fbcon.c. v2: Remove now outdated comment (Lukas). v3: Forgot to add static inline to the dummy function. Acked-by: Lukas Wunner Signed-off-by: Daniel Vetter Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst 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 --- drivers/gpu/vga/vga_switcheroo.c | 11 +++-------- drivers/video/fbdev/core/fbcon.c | 14 +++++--------- include/linux/fb.h | 2 -- include/linux/fbcon.h | 2 ++ 4 files changed, 10 insertions(+), 19 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 e98551f96138..158b9d5233e1 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3149,17 +3149,16 @@ void fbcon_fb_unregistered(struct fb_info *info) do_unregister_con_driver(&fb_con); } -/* 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; } @@ -3172,6 +3171,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 @@ -3337,10 +3337,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 f9c212f9b661..25e4b885f5b3 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -139,8 +139,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 de31eeb22c97..69f900d289b2 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 @@ static inline void fbcon_get_requirement(struct fb_info *info, struct fb_blit_caps *caps) {} static inline void fbcon_fb_blanked(struct fb_info *info, int blank) {} static inline void fbcon_update_vcs(struct fb_info *info, bool all) {} +static inline void fbcon_remap_all(struct fb_info *info) {} #endif #endif /* _LINUX_FBCON_H */ From patchwork Tue May 28 09:03: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: 10964295 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 2E6AC15E6 for ; Tue, 28 May 2019 09:04:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E492271FD for ; Tue, 28 May 2019 09:04:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1225B285F7; Tue, 28 May 2019 09:04:17 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45A2D285E2 for ; Tue, 28 May 2019 09:04:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726830AbfE1JEP (ORCPT ); Tue, 28 May 2019 05:04:15 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:43723 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726650AbfE1JD4 (ORCPT ); Tue, 28 May 2019 05:03:56 -0400 Received: by mail-ed1-f67.google.com with SMTP id w33so27265435edb.10 for ; Tue, 28 May 2019 02:03:55 -0700 (PDT) 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=xl+FmsN1b/Z0dRTg7/MTehgEAqXNH21CIN1ZETZQ/L8=; b=P1BhmTk1hbE5r2B+QiA3mLyctcrzMOPiA0FF2afph9QwuSqbe+7Vg34nWxGic2cpIp Dr+njroxLWdPZ8tRtVTzw7pvAOF3qky5AKxB+uMoKHv18H6B828Ycb17qHIsW/Sdilgp hFjFysr93tlnN9Xyxj9PNyqSg4WYWz899PxWI= 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=xl+FmsN1b/Z0dRTg7/MTehgEAqXNH21CIN1ZETZQ/L8=; b=Kw/f9xBD4FOcWp7Ex/mTzVFkqqcXK/j+Sk1tDC9l+ucCcYXS4uFb1wvQWuJiFcfEeN z66qESFFCfcsWRjye+VOcvv3RquibpogUosmHjZyZnPW3GP0XqTtBGW5Hw8MM+Jde/I9 JbUydNw+ZsmRHwomkPd5RWDHH3AKOrrjERwp7D/Jzx3OEww6wXJj8ru+5SgieiHfMXIu mYl+ez6j2ecxLbOEB1oOGsEq27FaAZ0eCE4/X7h7VP9rl/Xs4Ibqr5bOKZQovI9Udtx1 65idoPFo9TlrTb+toAlimvXypNW2g0XJWaftG+7P/iiLo6s4ozsT9W2hrVw59UbvKPhQ pwPw== X-Gm-Message-State: APjAAAVdSfSFCVSUnCJZr2a4+1sq//Tfcg4129vdzC1cpGqZFOcxC8h4 ui2NrDWc9pGiMIIMigcIradmhA== X-Google-Smtp-Source: APXvYqzRA7UP0UMRngIGDlfV8DR7R4CLDWGwCYwpTvM3Dr/srd+AZ3tufkvaM/d//bxX/fxuu4blxg== X-Received: by 2002:a50:fa4a:: with SMTP id c10mr3181724edq.35.1559034234601; Tue, 28 May 2019 02:03:54 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:53 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , Hans de Goede , Yisheng Xie , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Peter Rosin , Mikulas Patocka Subject: [PATCH 30/33] fbcon: Call con2fb_map functions directly Date: Tue, 28 May 2019 11:03:01 +0200 Message-Id: <20190528090304.9388-31-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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. v2: add missing uaccess.h include (alpha fails to compile otherwise), reported by kbuild. v3: Remember to also drop the #defines (Maarten) v4: Add the static inline to dummy functions. Signed-off-by: Daniel Vetter Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst Cc: Maarten Lankhorst 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 | 59 +++++++++++++++++++------------- drivers/video/fbdev/core/fbmem.c | 34 ++---------------- include/linux/fb.h | 4 --- include/linux/fbcon.h | 4 +++ 4 files changed, 42 insertions(+), 59 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 158b9d5233e1..fbd28aeff307 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -76,6 +76,7 @@ #include #include #include /* For counting font checksums */ +#include #include #include @@ -3318,29 +3319,47 @@ void fbcon_get_requirement(struct fb_info *info, } } -static int fbcon_event_notify(struct notifier_block *self, - unsigned long action, void *data) +int fbcon_set_con2fb_map_ioctl(void __user *argp) { - struct fb_event *event = data; - struct fb_info *info = event->info; - struct fb_con2fbmap *con2fb; - int idx, ret = 0; + struct fb_con2fbmap con2fb; + int ret; - 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; + 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 */ @@ -3372,10 +3391,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) @@ -3648,7 +3663,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"); @@ -3684,7 +3698,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 dd1a708df1a7..64dd732021d8 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1092,10 +1092,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; @@ -1157,38 +1155,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/fb.h b/include/linux/fb.h index 25e4b885f5b3..303771264644 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -133,10 +133,6 @@ struct fb_cursor_user { #define FB_EVENT_FB_UNREGISTERED 0x06 #endif -/* 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 /* A hardware display blank early change occurred */ diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h index 69f900d289b2..ff5596dd30f8 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 @@ static inline void fbcon_get_requirement(struct fb_info *info, static inline void fbcon_fb_blanked(struct fb_info *info, int blank) {} static inline void fbcon_update_vcs(struct fb_info *info, bool all) {} static inline void fbcon_remap_all(struct fb_info *info) {} +static inline int fbcon_set_con2fb_map_ioctl(void __user *argp) { return 0; } +static inline int fbcon_get_con2fb_map_ioctl(void __user *argp) { return 0; } #endif #endif /* _LINUX_FBCON_H */ From patchwork Tue May 28 09:03:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964279 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 A708676 for ; Tue, 28 May 2019 09:04:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97EB1271FD for ; Tue, 28 May 2019 09:04:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8BFE2285F7; Tue, 28 May 2019 09:04: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BDB8271FD for ; Tue, 28 May 2019 09:04:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727308AbfE1JD6 (ORCPT ); Tue, 28 May 2019 05:03:58 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:38179 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727290AbfE1JD5 (ORCPT ); Tue, 28 May 2019 05:03:57 -0400 Received: by mail-ed1-f66.google.com with SMTP id g13so838289edu.5 for ; Tue, 28 May 2019 02:03:56 -0700 (PDT) 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=KOGyYDuulYoZlGMMrGlYnho9Xow/hNHN2r6g5KqqxbA=; b=LmD9YyG7s+OqvV8GaC+iTvVDRdtjPeq/zghiL4J+/ZI7u5Eg21vxnuzwTFovpBti8O 3LjHgkfSbO5QNC3qJK3ek9epxYfj2V3oUkdq1yYwA2dDDqa0UrVbBDP43PYt6yNfhlLc AWLn+vFL5yhJ8lJhJdU43jJDDzQDEKyiJifa4= 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=KOGyYDuulYoZlGMMrGlYnho9Xow/hNHN2r6g5KqqxbA=; b=BZlhXMwU9rwoiIX9AfF7M2BXyxy8b/5hYA+mdcpVCg6VYDKfgWgpo3G75WlcvjNNg/ gYT/4o5X2KiEi6U6tHBAM0onlCyIWQkXb5R9RzGD5IrJufMZJXm0N9N0FNRpkcQg7Tis CnbhZFNjyh6S4D3w5qRJ9QRb3NrDwLawoqKjdD7MynybW1iOfP982gVpev2VKLCBGwiH 3ygc1elKRFTZpszvZe+mcEidFumVx26StXC3Xul1Zh5aT+UePU7yurlvebwbLB+SUz+Y irri77TjSzxhNsHtA7slujeJHv7ghjIcTvu8buQRI/lokoaZK7//M8DSCSr5casXAMU9 JM0w== X-Gm-Message-State: APjAAAUSO/2pyuR8PnGg6IE4fyhAMselUlrzy4TxAklc12+ME1azPE8e 3gfXXnnJ7emyM4Dr8+WmH8w/tA== X-Google-Smtp-Source: APXvYqyUrqB+xoH0ka3duTbZa5FPC3QZa0uDwLH0U5RXdNxaQd1JKD8pOMMaPMJ2kKeKORQcacvUQg== X-Received: by 2002:a50:e048:: with SMTP id g8mr128055262edl.26.1559034236177; Tue, 28 May 2019 02:03:56 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:55 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , Hans de Goede , Yisheng Xie Subject: [PATCH 31/33] fbcon: Document what I learned about fbcon locking Date: Tue, 28 May 2019 11:03:02 +0200 Message-Id: <20190528090304.9388-32-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It's not pretty. Signed-off-by: Daniel Vetter Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst Cc: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Hans de Goede Cc: Yisheng Xie --- 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 fbd28aeff307..d6ba3610ee83 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -88,6 +88,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 Tue May 28 09:03: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: 10964277 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 E8EE476 for ; Tue, 28 May 2019 09:04:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9C7A271FD for ; Tue, 28 May 2019 09:04:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CDDE0285F7; Tue, 28 May 2019 09:04:07 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6AD8B271FD for ; Tue, 28 May 2019 09:04:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727318AbfE1JD7 (ORCPT ); Tue, 28 May 2019 05:03:59 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:38968 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727302AbfE1JD7 (ORCPT ); Tue, 28 May 2019 05:03:59 -0400 Received: by mail-ed1-f66.google.com with SMTP id e24so30648088edq.6 for ; Tue, 28 May 2019 02:03:57 -0700 (PDT) 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=Ke/GY+csAQwGtKfSDgwB4In+ezGB+Eqia0Ds1dJ9YhI=; b=CFU413T3RVZAG0aMmPcjs3AON0A2oxThmIVGBKOyHKD0ptGSsUcZS2vKN6Qch3X0/5 u2hNoqtA/7YbPThjei/M2sqXZ0vMaO32NgE/qFmWbVW5wghOYRWParZNL6d+KJdt1aI1 1hf/zAPtOYsk7o3PXzm1GIN4mR3dg0Ufxc6Ic= 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=Ke/GY+csAQwGtKfSDgwB4In+ezGB+Eqia0Ds1dJ9YhI=; b=N+5pBld8hmNSq+m2MhynpCO1K5e1JVS6cGQrTjEs6EWW7tZS0QyiijwcORjYl+YB3/ NhNcAMzr8M+B9UwrGUC9ogzII7E3WbbEvqONYIIGweAGXrhECDZSpib90uIab5mi+RD2 P7o+BicPr2VeI995jncqTKrwwWEH44B0qHhylLBj8AZLxmUcnT/ocNmbP5rKgUAekp7C 6ztwqbPAVOmYyqu9WpDjiBdYgce2Jn6avgmKxeBqfWgrnfLWeOJk9/8Oe6vEsX0hl9hL 9Ww/iRnzK4+Oj82zmrbScIps7T2G+09OVd8j11h7bXIv1CzEVjwgjuJNmcoFbl60m3C2 +sKw== X-Gm-Message-State: APjAAAUHvirS32WpnGSeo02qBkPc3M1La8JF+ywWGdyOsFXw5vrGasF9 Oj1SnTm+7p0WF+0jYTbXkHTwMA== X-Google-Smtp-Source: APXvYqyIT1ztzcC6zHzmIxYYspUIOonVQpRlZvfSL5l9bmuKi+qnlo7uboLkAwKXA1zf88XtJiIcsw== X-Received: by 2002:a50:a4f7:: with SMTP id x52mr128123059edb.86.1559034237342; Tue, 28 May 2019 02:03:57 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:56 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Greg Kroah-Hartman , Maarten Lankhorst , Jens Frederich , Daniel Drake , Jon Nettleton Subject: [PATCH 32/33] staging/olpc_dcon: Add drm conversion to TODO Date: Tue, 28 May 2019 11:03:03 +0200 Message-Id: <20190528090304.9388-33-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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 Reviewed-by: Sam Ravnborg Acked-by: Greg Kroah-Hartman Reviewed-by: Maarten Lankhorst Cc: Greg Kroah-Hartman 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 From patchwork Tue May 28 09:03:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10964267 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 0657D112C for ; Tue, 28 May 2019 09:04:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBDAD271FD for ; Tue, 28 May 2019 09:04:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF0A3285D2; Tue, 28 May 2019 09:04:01 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87B1C271FD for ; Tue, 28 May 2019 09:04:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727311AbfE1JEA (ORCPT ); Tue, 28 May 2019 05:04:00 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:42046 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727218AbfE1JEA (ORCPT ); Tue, 28 May 2019 05:04:00 -0400 Received: by mail-ed1-f65.google.com with SMTP id g24so2700709eds.9 for ; Tue, 28 May 2019 02:03:59 -0700 (PDT) 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=HU1EQ+v38P9QJolnmXZTrOO2rSD6T7u0Lqw2ZLkiLWs=; b=I/7AsYIlcIbykNwShZDT9vqdf0W2l+mAfbQvvY1pNwfgs1W0LbkA4t+YgIW85/3uHO bTSykFOJBi17eYvOrMy8aAuO/GbqB2OLqAj4V9SBcfmO69y+tfbM0o7u5JDDHKRZ4I+y c4JkYTOM0jo97idl5z+S/KV2EusVrq92+9MXo= 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=HU1EQ+v38P9QJolnmXZTrOO2rSD6T7u0Lqw2ZLkiLWs=; b=FodCSSrkl6kKxwOLNc7bqTmw25ES/fApqLADY+cq3HVFF9iDajygllpkOlTCPyeyrj cEZsBT0MbxotRETx7cHsemROvdsNk0UZToR4xHYlPhdBGNxlybXm5kQCPLezUMW5FOEM 0hjNYA0gqtzIT5b2dDvhDCnoNatv6v9oTimibLm0qdajsyLAAIeAh+FpAyeI+ei9giZa gVSoLFD1kkM4EKlgLsFmhpu2p75iXDg3SVWHnOS2rLkus7tYT4l70EJ0sFH/04GVLgTp tFGMlQSB/Lgg2+Sp2RtUSsx/7d4D9q9kYRQwmfNPO0r/HahTSULRZmP5Xd9odOGVnTKD m9aw== X-Gm-Message-State: APjAAAVBTXpVbk8U6ch3/cyCSRfRW/ZyGereBZ8bmQYkQ4syhYOMyG7D InhiuQxG5clmMYOi84oN7CVvXw== X-Google-Smtp-Source: APXvYqz9RdhfaDx2JF7fgePZMlTSmHplGB4DlBCTqMFDkYawJ7AszXHKVriOXKY3FK7S7TQRU+5DbA== X-Received: by 2002:a50:b3a6:: with SMTP id s35mr129117953edd.220.1559034238538; Tue, 28 May 2019 02:03:58 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:57 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , Lee Jones , Jingoo Han Subject: [PATCH 33/33] backlight: simplify lcd notifier Date: Tue, 28 May 2019 11:03:04 +0200 Message-Id: <20190528090304.9388-34-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP With all the work I've done on replacing fb notifier calls with direct calls into fbcon the backlight/lcd notifier is the only user left. It will only receive events now that it cares about, hence we can remove this check. Signed-off-by: Daniel Vetter Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Acked-by: Daniel Thompson --- drivers/video/backlight/lcd.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c index ecdda06989d0..d6b653aa4ee9 100644 --- a/drivers/video/backlight/lcd.c +++ b/drivers/video/backlight/lcd.c @@ -30,17 +30,6 @@ static int fb_notifier_callback(struct notifier_block *self, struct lcd_device *ld; struct fb_event *evdata = data; - /* If we aren't interested in this event, skip it immediately ... */ - switch (event) { - case FB_EVENT_BLANK: - case FB_EVENT_MODE_CHANGE: - case FB_EARLY_EVENT_BLANK: - case FB_R_EARLY_EVENT_BLANK: - break; - default: - return 0; - } - ld = container_of(self, struct lcd_device, fb_notif); if (!ld->ops) return 0;