From patchwork Wed Oct 19 08:27:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5069 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp248959wrs; Wed, 19 Oct 2022 03:45:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6vy+y+LHeAJT+se18a30viChs8qnoR5K1qVJ8I4CkgDpJMkD95g02BceCXQL2DgLTBN4DD X-Received: by 2002:a17:90a:354:b0:20a:6867:4a2b with SMTP id 20-20020a17090a035400b0020a68674a2bmr44639388pjf.157.1666176301343; Wed, 19 Oct 2022 03:45:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176301; cv=none; d=google.com; s=arc-20160816; b=PuMURJ4kQl78kNFbqy4ZMEKePVY03rL/ayTe4RMBal2PnSvZpvbr6F6VbgVVrja10L uy2nNG2GtS7mvV8Mm/wWwRtc4bK+/fvuU2hg1XFhTXEChWZa9RL3dhEhM9ZAaTJ3GRPr y7H46SHwqdxeMe/sBfVjwJCLR974vXW3rdSTWs9iRzV1XEslPuBVDQWRtx23fGMY8k6j JKzHU42KJ6iVuNOFfrKhXLcCbELabZa0i+7A9o4TDdo2kahjbc9PmPKHJ4/KvO0Dq+BX rf/j9XDRPbGF/cXcCOigLdI7en4THHnZMute1KLIEh2AFzpkJR7uNvc4dkfzQvXxAaP6 nkmQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lp15-20020a17090b4a8f00b00202a34035bfsi18401215pjb.78.2022.10.19.03.44.46; Wed, 19 Oct 2022 03:45:01 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112481315439885?= X-GMAIL-MSGID: =?utf-8?q?1747112481315439885?= 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);