From patchwork Wed Apr 6 21:39:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 558995 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB0E8C433F5 for ; Wed, 6 Apr 2022 21:49:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236292AbiDFVvf (ORCPT ); Wed, 6 Apr 2022 17:51:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233507AbiDFVvL (ORCPT ); Wed, 6 Apr 2022 17:51:11 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 66ABE8C7D8 for ; Wed, 6 Apr 2022 14:40:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649281255; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KV4A7vxPY5Ri/A7ExTRv30H1oUVvMjyO4SRhZ4A4Rkc=; b=XMC3DO44F13IS1QdQwPv660gawUPeVr7VoCzC3L6fgK8nJcOt+V/TXyPx+Qxwez9zyi9+G 27TGLvWnJWHKluKduDBoYLSkVgWoDknJx/RI0bFmjAKmStwH9/i2iV0cL89i4LXuPBgx7E mJdYz4Jq9dnjHlU89qU+TLMixvrjfwM= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-256-jC2uqHHgN0KwAHWUhI2KMA-1; Wed, 06 Apr 2022 17:40:55 -0400 X-MC-Unique: jC2uqHHgN0KwAHWUhI2KMA-1 Received: by mail-wm1-f71.google.com with SMTP id n21-20020a05600c4f9500b0038e3b0aa367so2430216wmq.1 for ; Wed, 06 Apr 2022 14:40:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KV4A7vxPY5Ri/A7ExTRv30H1oUVvMjyO4SRhZ4A4Rkc=; b=RuxmEowZnEOCDpUtmV126gAEs82qx/v9XxvG1NAR27V+8rgeNt9gkKYwYpnuLD4ScJ mDFdKq9wH5LwcIYilagyq9fkY8YdSG00FT+wd7CQPZycWwyjsKLPsKaiPrRK5NDJi6Jc yZ92+YJH+K7yNrQHa/HlWqX7kCM6K/0GMNguR3qH2UL3mf1Wq5eb4GrzDYRA2CIR2FNT 27RZhZAVwYrrpiURyL8FPxDC7KaxFydslfJWv23t0kF2JS+IccmofnN2v9NyXSO0Tg4H y07pG5e4jdP19kf0T8HFYTUISzPnCBPOVDHKiEHkDPuxpMygQNsHXTkm0+TwEpf5EzFc mntA== X-Gm-Message-State: AOAM532ZblWZladOQs2qAUMMwjjj4RbIeFIrGWdFCUJjgCfXIz8mzf6d /3TIzaq/N5TUS0rHntk1/inb4Y/0AVlI3FAcOC3st09htDUCsS5kL79fDaYJZOeAfCLgKax/lmw uYn506ejxMlPDj/oUVk8vtL0= X-Received: by 2002:adf:d1e8:0:b0:206:fdb:849 with SMTP id g8-20020adfd1e8000000b002060fdb0849mr8274608wrd.251.1649281253648; Wed, 06 Apr 2022 14:40:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/mJZqMWnMsmiDK/QHEbj6zIloBdqX55fsoP+DxKAu2//ICDmt3KL7sczE6heg786RoMwiDQ== X-Received: by 2002:adf:d1e8:0:b0:206:fdb:849 with SMTP id g8-20020adfd1e8000000b002060fdb0849mr8274601wrd.251.1649281253422; Wed, 06 Apr 2022 14:40:53 -0700 (PDT) Received: from minerva.home ([92.176.231.205]) by smtp.gmail.com with ESMTPSA id o29-20020a05600c511d00b0038e3532b23csm5876020wms.15.2022.04.06.14.40.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 14:40:53 -0700 (PDT) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, Thomas Zimmermann , Daniel Vetter , Javier Martinez Canillas , Alex Deucher , Geert Uytterhoeven , Guenter Roeck , Helge Deller , Sam Ravnborg , Xiyu Yang , Zhen Lei , Zheyu Ma , linux-fbdev@vger.kernel.org Subject: [RESEND RFC PATCH 3/5] fbdev: Restart conflicting fb removal loop when unregistering devices Date: Wed, 6 Apr 2022 23:39:17 +0200 Message-Id: <20220406213919.600294-4-javierm@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220406213919.600294-1-javierm@redhat.com> References: <20220406213919.600294-1-javierm@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Drivers that want to remove registered conflicting framebuffers prior to register their own framebuffer, calls remove_conflicting_framebuffers(). This function takes the registration_lock mutex, to prevent a races when drivers register framebuffer devices. But if a conflicting framebuffer device is found, the underlaying platform device is unregistered and this will lead to the platform driver .remove callback to be called, which in turn will call to the unregister_framebuffer() that takes the same lock. To prevent this, a struct fb_info.forced_out field was used as indication to unregister_framebuffer() whether the mutex has to be grabbed or not. A cleaner solution is to drop the lock before platform_device_unregister() so unregister_framebuffer() can take it when called from the fbdev driver, and just grab the lock again after the device has been registered and do a removal loop restart. Since the framebuffer devices will already be removed, the loop would just finish when no more conflicting framebuffers are found. Suggested-by: Daniel Vetter Signed-off-by: Javier Martinez Canillas --- drivers/video/fbdev/core/fbmem.c | 21 ++++++++++++++------- include/linux/fb.h | 1 - 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index b585339509b0..c1bfb8df9cba 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1555,6 +1555,7 @@ static void do_remove_conflicting_framebuffers(struct apertures_struct *a, { int i; +restart_removal: /* check all firmware fbs and kick off if the base addr overlaps */ for_each_registered_fb(i) { struct apertures_struct *gen_aper; @@ -1582,8 +1583,18 @@ static void do_remove_conflicting_framebuffers(struct apertures_struct *a, * fix would add code to remove the device from the system. */ if (dev_is_platform(device)) { - registered_fb[i]->forced_out = true; + /* + * Drop the lock since the driver will call to the + * unregister_framebuffer() function that takes it. + */ + mutex_unlock(®istration_lock); platform_device_unregister(to_platform_device(device)); + mutex_lock(®istration_lock); + /* + * Restart the removal now that the platform device + * has been unregistered and its associated fb gone. + */ + goto restart_removal; } else { pr_warn("fb%d: cannot remove device\n", i); do_unregister_framebuffer(registered_fb[i]); @@ -1917,13 +1928,9 @@ EXPORT_SYMBOL(register_framebuffer); void unregister_framebuffer(struct fb_info *fb_info) { - bool forced_out = fb_info->forced_out; - - if (!forced_out) - mutex_lock(®istration_lock); + mutex_lock(®istration_lock); do_unregister_framebuffer(fb_info); - if (!forced_out) - mutex_unlock(®istration_lock); + mutex_unlock(®istration_lock); } EXPORT_SYMBOL(unregister_framebuffer); diff --git a/include/linux/fb.h b/include/linux/fb.h index 39baa9a70779..f1e0cd751b06 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -503,7 +503,6 @@ struct fb_info { } *apertures; bool skip_vt_switch; /* no VT switch on suspend/resume required */ - bool forced_out; /* set when being removed by another driver */ }; static inline struct apertures_struct *alloc_apertures(unsigned int max_num) { From patchwork Wed Apr 6 21:39:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 558994 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66C57C4332F for ; Wed, 6 Apr 2022 21:49:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236461AbiDFVvh (ORCPT ); Wed, 6 Apr 2022 17:51:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236368AbiDFVvL (ORCPT ); Wed, 6 Apr 2022 17:51:11 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AB7C0657AF for ; Wed, 6 Apr 2022 14:40:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649281257; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U2QzSBkwn7Yafa/16sbGGbBUM4FbySeU5GGeHJm/Jx0=; b=eijo4Y+s7R0Z3IGqxaQ/vf61sKD2t8ISx5f3/2lxe8bel826T1dBDmxaV5lDiGfGXtJgdJ 2cvURDpmc8cqmBOwm5x0oepupf26b0aSKbZJITF3hhjNvYI7z/KnUuKAnDUryPB+uE+8uJ IRg6Ahvb2x3RKzPqcNvrpi+kbPqbcxQ= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-651-8kvxkqqkPBKn-q7e-3Oe8w-1; Wed, 06 Apr 2022 17:40:56 -0400 X-MC-Unique: 8kvxkqqkPBKn-q7e-3Oe8w-1 Received: by mail-wm1-f71.google.com with SMTP id i6-20020a05600c354600b0038be262d9d9so3531675wmq.8 for ; Wed, 06 Apr 2022 14:40:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=U2QzSBkwn7Yafa/16sbGGbBUM4FbySeU5GGeHJm/Jx0=; b=X6mp5ko+PJLYozbfg7Z2YWJzfieS0WREp7BTosl+6BXeHLAbxKJ+Ejp6ze0q1ro2og dVuOHjtw6RbC6MPHT7Hs1wbwuv4Z+9dyS0HMV7TBYwN727iDFjB47Is1doWTH0P8J9wI xyA3u3Esh3/H+CPozvi9SGXMAQ6FSDwctK6eVacdI24kiJd7Y/t0i/UQjaPDJ74nZBCL L3bRFoL4PYIUcGGzzlafb0bVmW5LrAQypwnSF7SkepQsq2WStZZ5K3A/Mq0qVGiL8N3W uVoQYsBVUImCznGedTJyS3klqvHILqGJ8V+HorMzHs4hwvGDxYwwuyrB7rJ/yzomkgRq OdmQ== X-Gm-Message-State: AOAM532AoJSDutUrVpdZNbiCV1uVArdxgcxQugAETCniTj3LMjT2G70B MyoGpdbvE3PioRefvdkd/coP9Tzm+f48wqAZS4oAI0t+WrX+0xE2h0t5LCv0urpoO8swNa27Q6d ynnkysn8XCeWgx453k35aEG8= X-Received: by 2002:a05:600c:6004:b0:38c:6c00:4316 with SMTP id az4-20020a05600c600400b0038c6c004316mr9499666wmb.6.1649281255705; Wed, 06 Apr 2022 14:40:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy98rnXAztsyk4KBqYgyk86f1BpoiJOrcBFIcbWPB9DOuUKh2YKVe/1UDGOsUjrhGSlhCdgYw== X-Received: by 2002:a05:600c:6004:b0:38c:6c00:4316 with SMTP id az4-20020a05600c600400b0038c6c004316mr9499656wmb.6.1649281255447; Wed, 06 Apr 2022 14:40:55 -0700 (PDT) Received: from minerva.home ([92.176.231.205]) by smtp.gmail.com with ESMTPSA id o29-20020a05600c511d00b0038e3532b23csm5876020wms.15.2022.04.06.14.40.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 14:40:55 -0700 (PDT) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, Thomas Zimmermann , Daniel Vetter , Javier Martinez Canillas , Alex Deucher , Guenter Roeck , Helge Deller , Sam Ravnborg , Xiyu Yang , Zhen Lei , linux-fbdev@vger.kernel.org Subject: [RESEND RFC PATCH 4/5] fbdev: Fix some race conditions between fbmem and sysfb Date: Wed, 6 Apr 2022 23:39:18 +0200 Message-Id: <20220406213919.600294-5-javierm@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220406213919.600294-1-javierm@redhat.com> References: <20220406213919.600294-1-javierm@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org The platform devices registered in sysfb match with a firmware-based fbdev or DRM driver, that are used to have early graphics using framebuffers set up by the system firmware. Real DRM drivers later are probed and remove all conflicting framebuffers, leading to these platform devices for generic drivers to be unregistered. But the current solution has two issues that this patch fixes: 1) It is a layering violation for the fbdev core to unregister a device that was registered by sysfb. Instead, the sysfb_try_unregister() helper function can be called for sysfb to attempt unregistering the device if is the one registered. 2) The sysfb_init() function could be called after a DRM driver is probed and requested to unregister devices for drivers with a conflicting fb. To prevent this, disable any future sysfb platform device registration by calling sysfb_disable(), if a driver requested to remove conflicting framebuffers with remove_conflicting_framebuffers(). Suggested-by: Daniel Vetter Signed-off-by: Javier Martinez Canillas --- drivers/video/fbdev/core/fbmem.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index c1bfb8df9cba..acf641b05d11 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -1588,7 +1589,10 @@ static void do_remove_conflicting_framebuffers(struct apertures_struct *a, * unregister_framebuffer() function that takes it. */ mutex_unlock(®istration_lock); - platform_device_unregister(to_platform_device(device)); + if (!sysfb_try_unregister(device)) { + /* sysfb didn't register this device, unregister it */ + platform_device_unregister(to_platform_device(device)); + } mutex_lock(®istration_lock); /* * Restart the removal now that the platform device @@ -1781,6 +1785,17 @@ 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); From patchwork Wed Apr 6 21:39:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 558384 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3017AC433F5 for ; Wed, 6 Apr 2022 21:49:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236519AbiDFVvi (ORCPT ); Wed, 6 Apr 2022 17:51:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236388AbiDFVvM (ORCPT ); Wed, 6 Apr 2022 17:51:12 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DD4FE5B3D7 for ; Wed, 6 Apr 2022 14:41:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649281260; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4FhXBUnLq/AeYpcQ43hIiOOWtFlBWzfoVNvi0Bsh0Mg=; b=PyUfjGCC1VQFwn7lvEXn9IaB8SfkWw63Oi/RdasUCAQ4WZbSlyNZuw5y7qn95Xp6+gD+UF 7FUEv95qfmg6ShaDW1Gr1skp8u+EBXfg/Q5ca4H0tHwq/azB1mDp2Fwg+sSbRwpx/RDIpM CJHFQro0+shaq22fQd0UTbiWesgNsBE= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-631-E5D0HNKOPqCL1y069tjALg-1; Wed, 06 Apr 2022 17:40:59 -0400 X-MC-Unique: E5D0HNKOPqCL1y069tjALg-1 Received: by mail-wm1-f72.google.com with SMTP id x8-20020a7bc768000000b0038e73173886so1901152wmk.6 for ; Wed, 06 Apr 2022 14:40:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4FhXBUnLq/AeYpcQ43hIiOOWtFlBWzfoVNvi0Bsh0Mg=; b=KegbbIbdR5A9cHck95RZru7dddqNjh+AJnE6ZxaFWxeJLjy7B0G6jvDWVwwfzWsu7b KAYEW5SI9f3fuj2zQvkAEiiES8RpIuEOuWukW3UIjIkNrbNzNd63cvD1jVbWpGdjnzUW bYQHU5bG73EvOgeC6jb7AXky11vjDJVcLidfuf6ygPxX8jlZQbjc+HuPRcn9nxMhUqqz qdSYWYd5lO/gDP1KR4N95r5owk2WU4IJwFm/NwuyUfvd88TxpinBirtVBdUq5ISgWpmM RCqQF5Nov30X7eQ6Vln/a08Iwxeo7cuUF2m2IFSHiEW49NyY/sCaBAUPLM7nRcq1Ri2I k8QA== X-Gm-Message-State: AOAM5324vav9XJiYBms2D7GGtl7ZOnwgfu5AWnvkfMAn8WANmJLZRfSs JwqleaHV0p5j5k2dsjBi+8LwUdwSlsC93JXL5krBvMMVHdGuqGsYV6xTq6ej3qQqI+La1CYJW6H RNBMBvz2w/Ntp/xFqiQzV+zg= X-Received: by 2002:a7b:cf2f:0:b0:38e:6f21:bba9 with SMTP id m15-20020a7bcf2f000000b0038e6f21bba9mr9082584wmg.94.1649281257932; Wed, 06 Apr 2022 14:40:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzu0lYRk3QkxgnvH66v8eUTrMYR+LVlqeV9xMaH6jcY66CpHDS6DKp0bRanjMtEYrzwKOSL2A== X-Received: by 2002:a7b:cf2f:0:b0:38e:6f21:bba9 with SMTP id m15-20020a7bcf2f000000b0038e6f21bba9mr9082565wmg.94.1649281257668; Wed, 06 Apr 2022 14:40:57 -0700 (PDT) Received: from minerva.home ([92.176.231.205]) by smtp.gmail.com with ESMTPSA id o29-20020a05600c511d00b0038e3532b23csm5876020wms.15.2022.04.06.14.40.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 14:40:57 -0700 (PDT) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, Thomas Zimmermann , Daniel Vetter , Zack Rusin , Javier Martinez Canillas , Hans de Goede , Ilya Trukhanov , Daniel Vetter , Peter Jones , linux-fbdev@vger.kernel.org, Helge Deller Subject: [RESEND RFC PATCH 5/5] Revert "fbdev: Prevent probing generic drivers if a FB is already registered" Date: Wed, 6 Apr 2022 23:39:19 +0200 Message-Id: <20220406213919.600294-6-javierm@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220406213919.600294-1-javierm@redhat.com> References: <20220406213919.600294-1-javierm@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org From: Daniel Vetter This reverts commit fb561bf9abde49f7e00fdbf9ed2ccf2d86cac8ee. With commit 27599aacbaefcbf2af7b06b0029459bbf682000d Author: Thomas Zimmermann Date: Tue Jan 25 10:12:18 2022 +0100 fbdev: Hot-unplug firmware fb devices on forced removal this should be fixed properly and we can remove this somewhat hackish check here (e.g. this won't catch drm drivers if fbdev emulation isn't enabled). Cc: Thomas Zimmermann Cc: Zack Rusin Cc: Javier Martinez Canillas Cc: Zack Rusin Cc: Hans de Goede Cc: Ilya Trukhanov Signed-off-by: Daniel Vetter Cc: Peter Jones Cc: linux-fbdev@vger.kernel.org Signed-off-by: Javier Martinez Canillas --- drivers/video/fbdev/efifb.c | 11 ----------- drivers/video/fbdev/simplefb.c | 11 ----------- 2 files changed, 22 deletions(-) diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c index ea42ba6445b2..edca3703b964 100644 --- a/drivers/video/fbdev/efifb.c +++ b/drivers/video/fbdev/efifb.c @@ -351,17 +351,6 @@ static int efifb_probe(struct platform_device *dev) char *option = NULL; efi_memory_desc_t md; - /* - * Generic drivers must not be registered if a framebuffer exists. - * If a native driver was probed, the display hardware was already - * taken and attempting to use the system framebuffer is dangerous. - */ - if (num_registered_fb > 0) { - dev_err(&dev->dev, - "efifb: a framebuffer is already registered\n"); - return -EINVAL; - } - if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI || pci_dev_disabled) return -ENODEV; diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c index 94fc9c6d0411..0ef41173325a 100644 --- a/drivers/video/fbdev/simplefb.c +++ b/drivers/video/fbdev/simplefb.c @@ -413,17 +413,6 @@ static int simplefb_probe(struct platform_device *pdev) struct simplefb_par *par; struct resource *res, *mem; - /* - * Generic drivers must not be registered if a framebuffer exists. - * If a native driver was probed, the display hardware was already - * taken and attempting to use the system framebuffer is dangerous. - */ - if (num_registered_fb > 0) { - dev_err(&pdev->dev, - "simplefb: a framebuffer is already registered\n"); - return -EINVAL; - } - if (fb_get_options("simplefb", NULL)) return -ENODEV;