Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp912581rwi; Wed, 19 Oct 2022 04:40:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Rgwwgp2bMB1I2dgeU1vAj0iWWiiiY/UsWWhEffysacJ09sg8RParTPcMsL3Ab9SVV2g51 X-Received: by 2002:a17:902:ba95:b0:17f:9943:2dea with SMTP id k21-20020a170902ba9500b0017f99432deamr8058826pls.81.1666179624344; Wed, 19 Oct 2022 04:40:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666179624; cv=none; d=google.com; s=arc-20160816; b=ePbYLLVRgOvq4Acf3y/B1Fnglv796JdlO4fpP632cy9PJQJKyddinykS4yNThSqizn 8WJjDhBjlfPtDaSao2nIfEVsLtWsCvvSUacQgzX6FZDzuRHH6dBbYLhzb4fT46h2SSrs zKYdSUyBdky7PUKfCFF0GM64SZsypUcxjMz2X/akPNW16Yj5YfNDKuVjpAPvG/7wMzUf 89PVlDqsmdMNdbeZbZFafwNDSveNcQQPuFGYzPOOL5Vq06MhGWrm8UxPR4w1GqwJ7/nh DJ0sZ5YQxN51vUnrbPxGDnhwvyxVuw4dXllk0HdV6kgPV0OJ+NMEnDOa1Poviitmm37v 1qdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=U6eY5bL12X2qKp52Hitse650aPa62aN54mPIuo3+3nU=; b=QhvGUBPRncnx0I7yFeZxtlVxCBTJzZ5AcDES6sumVHg38mmudgoTcUo0b8i9ATtll+ lHMD0mvCN/CZ1GZ2vnSFHr42y4n63fXqwTvjtUNQ42AAeZb2YnuW8IRQ09R5lbjJmIcu KhHp8J3HV01dtfLhiGd8tDwdMWwrteg4c0nOfUAd7Sk83ddzT0ijYM6K7zXgU6Efcvg1 N0w2MnOOQ/WvyFtWySMHbDD4EC4OotvzjRjmFUt1rU1Xn3vc+dJUXoNveDSFPGxn8GWC f4MbJPaScNGThQw4wqqHuXjEPEWiA0w+NxnBGfT5IlC/QXHeSBFREboU1z8raG8RkdMx dx0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=asJX0QaT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e15-20020a17090301cf00b001781cf050b6si21184332plh.14.2022.10.19.04.40.12; Wed, 19 Oct 2022 04:40:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=asJX0QaT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232559AbiJSKns (ORCPT + 99 others); Wed, 19 Oct 2022 06:43:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232255AbiJSKmu (ORCPT ); Wed, 19 Oct 2022 06:42:50 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0BDD5F103; Wed, 19 Oct 2022 03:19:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 314FFB823BC; Wed, 19 Oct 2022 08:53:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 681ADC433C1; Wed, 19 Oct 2022 08:53:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169637; bh=0n3wCM2FLB57ac0bicBovbICBhHb3K3wk0u9suBfZPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=asJX0QaTJV8qDwBShXtiIXXHST2Qybn+sceGuRkw6+BW9Ed6TMkB6Bemzm2WfmJ/u G1c2WwoHEUg/WUpDrK2fkWWT92B+zagQucJAkc9sJEeeNJao1WQL2qk/IJc/E6lwmY A3UQv3oyYv3nugP2SEBSCQl8dlcrIULq37teh2fQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Zimmermann , Javier Martinez Canillas , Zack Rusin , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Helge Deller , Alex Deucher , Zhen Lei , Changcheng Deng , Maarten Lankhorst , Maxime Ripard , dri-devel@lists.freedesktop.org, Sasha Levin Subject: [PATCH 6.0 352/862] video/aperture: Disable and unregister sysfb devices via aperture helpers Date: Wed, 19 Oct 2022 10:27:19 +0200 Message-Id: <20221019083305.595661084@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Zimmermann [ Upstream commit 5e01376124309b4dbd30d413f43c0d9c2f60edea ] Call sysfb_disable() before removing conflicting devices in aperture helpers. Fixes sysfb state if fbdev has been disabled. Signed-off-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas Fixes: fb84efa28a48 ("drm/aperture: Run fbdev removal before internal helpers") Cc: Zack Rusin Cc: Thomas Zimmermann Cc: Javier Martinez Canillas Cc: Daniel Vetter Cc: Daniel Vetter Cc: Sam Ravnborg Cc: Helge Deller Cc: Alex Deucher Cc: Zhen Lei Cc: Changcheng Deng Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: dri-devel@lists.freedesktop.org Link: https://patchwork.freedesktop.org/patch/msgid/20220718072322.8927-8-tzimmermann@suse.de Signed-off-by: Sasha Levin --- drivers/video/aperture.c | 14 ++++++++++++++ drivers/video/fbdev/core/fbmem.c | 12 ------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/video/aperture.c b/drivers/video/aperture.c index 538f2d40acda..d245826a9324 100644 --- a/drivers/video/aperture.c +++ b/drivers/video/aperture.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -286,7 +287,20 @@ int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t si #if IS_REACHABLE(CONFIG_FB) struct apertures_struct *a; int ret; +#endif + + /* + * If a driver asked to unregister a platform device registered by + * sysfb, then can be assumed that this is a driver for a display + * that is set up by the system firmware and has a generic driver. + * + * Drivers for devices that don't have a generic driver will never + * ask for this, so let's assume that a real driver for the display + * was already probed and prevent sysfb to register devices later. + */ + sysfb_disable(); +#if IS_REACHABLE(CONFIG_FB) a = alloc_apertures(1); if (!a) return -ENOMEM; diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 02b0cf2cfafe..bda4d304feb6 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -1777,17 +1776,6 @@ int remove_conflicting_framebuffers(struct apertures_struct *a, do_free = true; } - /* - * If a driver asked to unregister a platform device registered by - * sysfb, then can be assumed that this is a driver for a display - * that is set up by the system firmware and has a generic driver. - * - * Drivers for devices that don't have a generic driver will never - * ask for this, so let's assume that a real driver for the display - * was already probed and prevent sysfb to register devices later. - */ - sysfb_disable(); - mutex_lock(®istration_lock); do_remove_conflicting_framebuffers(a, name, primary); mutex_unlock(®istration_lock); -- 2.35.1