From patchwork Tue Jun 7 18:23:36 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: 12872331 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 A2AD5CCA47C for ; Tue, 7 Jun 2022 19:59:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353541AbiFGT7P (ORCPT ); Tue, 7 Jun 2022 15:59:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357588AbiFGT6Y (ORCPT ); Tue, 7 Jun 2022 15:58:24 -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 307C41B7836 for ; Tue, 7 Jun 2022 11:24:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654626232; 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=UVERor1pDjv50JOPQD6dbA5hWF6IpXrW4mZT/xer28A=; b=h7Sz1larvRxJt1b36YC0eXE50ymixJ4vKcfr+iBxhb9bbPsjkV+lVdYasJSUdQKcieP0CF RXDeG49E5oABm1jIFUKXVaZXwVhx8m02E+l9oCNRAQ9oG4B1nXijFPpOru2FmcuXJdCXmv bxObNmb4IkoKdMnC6nbpJfOjrY+XscQ= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-590-M6O6CWbVP42s8k2WvhE2wQ-1; Tue, 07 Jun 2022 14:23:50 -0400 X-MC-Unique: M6O6CWbVP42s8k2WvhE2wQ-1 Received: by mail-wr1-f72.google.com with SMTP id c7-20020adfa707000000b002184d715e69so1165125wrd.10 for ; Tue, 07 Jun 2022 11:23:50 -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=UVERor1pDjv50JOPQD6dbA5hWF6IpXrW4mZT/xer28A=; b=x6woGw0d6aycQS5S5WzvANTMvOYmeCQzK9Y/9NgMQRx/x8jgImvnqEyQmchgc1AsUA AvkWHFCjCTbFfV8gkO3C4x4g54zBn1KcXB4ncgMJwIn+K38hP9RB0gQTl3YA/beKRkfA yWR6WtiMK95fm8KHlx/80LU9X+QNW3vG/OWfgyup11fbGFn9RNY9eOyfctiFCRJl9U1+ jhTTKWUJ2tg8iYupFKlbd0p1R4Rtqlv84Avtca60sxL9TxmlJjLCSAXuydkhL9/Soc+6 dyWFA7BCorLKxfeW9YUHeEwnnRye6U5fmudPeBnLWWzNplDLvrNBF2Vg+ZHp6T54oELX i+ZQ== X-Gm-Message-State: AOAM531J7R39J3QIXiTxksP7iTNnaKLXPmkxXUDSF4wGi0bVI36wfLoB RYb59uVnagEDy4by/qxXdKH16glnHg+VUZxkMB4XmuqStGomuuTyACV78WuCo6NK6AMPIriCT1a P9ngBZqoDtEWnyF3zdKaPR4k= X-Received: by 2002:a05:6000:1b03:b0:216:43b4:82f1 with SMTP id f3-20020a0560001b0300b0021643b482f1mr18992414wrz.232.1654626229027; Tue, 07 Jun 2022 11:23:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIJ2ZaSX69tcbwGyt9OTbAcEXndsJiDIZKc+WEe5sBYC0UmDo7XaAT1uT5eNOYdA7eP4tzzQ== X-Received: by 2002:a05:6000:1b03:b0:216:43b4:82f1 with SMTP id f3-20020a0560001b0300b0021643b482f1mr18992391wrz.232.1654626228799; Tue, 07 Jun 2022 11:23:48 -0700 (PDT) Received: from minerva.home (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id m8-20020a05600c4f4800b003942a244f51sm28267502wmq.42.2022.06.07.11.23.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 11:23:48 -0700 (PDT) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, Thomas Zimmermann , Laszlo Ersek , Alex Williamson , Gerd Hoffmann , kvm@vger.kernel.org, Greg Kroah-Hartman , Daniel Vetter , Javier Martinez Canillas , Daniel Vetter , Helge Deller , linux-fbdev@vger.kernel.org Subject: [PATCH v6 3/5] fbdev: Disable sysfb device registration when removing conflicting FBs Date: Tue, 7 Jun 2022 20:23:36 +0200 Message-Id: <20220607182338.344270-4-javierm@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607182338.344270-1-javierm@redhat.com> References: <20220607182338.344270-1-javierm@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org The platform devices registered by sysfb match with firmware-based DRM or fbdev drivers, that are used to have early graphics using a framebuffer provided by the system firmware. DRM or fbdev 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 a race, since the sysfb_init() function could be called after a DRM or fbdev driver is probed and request to unregister the devices for drivers with conflicting framebuffes. To prevent this, disable any future sysfb platform device registration by calling sysfb_disable(), if a driver requests to remove the conflicting framebuffers. Suggested-by: Daniel Vetter Signed-off-by: Javier Martinez Canillas Reviewed-by: Daniel Vetter --- Changes in v6: - Move the sysfb_disable() before the remove conflicting framebuffers loop (Daniel Vetter). Changes in v5: - Move the sysfb_disable() call at conflicting framebuffers again to avoid the need of a DRIVER_FIRMWARE capability flag. - Add Daniel Vetter's Reviewed-by tag again since reverted to the old patch that he already reviewed in v2. Changes in v3: - Call sysfb_disable() when a DRM dev and a fbdev are registered rather than when conflicting framebuffers are removed (Thomas Zimmermann). - Call sysfb_disable() when a fbdev framebuffer is registered rather than when conflicting framebuffers are removed (Thomas Zimmermann). - Drop Daniel Vetter's Reviewed-by tag since patch changed a lot. Changes in v2: - Explain in the commit message that fbmem has to unregister the device as fallback if a driver registered the device itself (Daniel Vetter). - Also explain that fallback in a comment in the code (Daniel Vetter). - Don't encode in fbmem the assumption that sysfb will always register platform devices (Daniel Vetter). - Add a FIXME comment about drivers registering devices (Daniel Vetter). drivers/video/fbdev/core/fbmem.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 2fda5917c212..e0720fef0ee6 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 @@ -1764,6 +1765,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 Tue Jun 7 18:23:37 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: 12872332 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 3334EC433EF for ; Tue, 7 Jun 2022 19:59:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357003AbiFGT7Y (ORCPT ); Tue, 7 Jun 2022 15:59:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357673AbiFGT6Z (ORCPT ); Tue, 7 Jun 2022 15:58:25 -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 472A71B783D for ; Tue, 7 Jun 2022 11:24:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654626232; 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=s12dM/fUNAK8FcN2HDfoJsYb2JSXAKJ07j+xEpEzvhM=; b=OWsCBO1jS/m8i4Mwi/4aQOsaxNu2Qiy9cQfq9xm9y4nkFn8QhzmL4MiMf75P49Rqwqx6t9 K8RH+nsYizEC/bsTt1nioahN2MPM7/dj+R3JgFoK70DXovoPHR5fZbApDvjZbjXVmmqjki L9X9QBpAy2ZnckPputE9M3D9fMQ/NWo= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-154-tXeTOVyjMcq5mIypKmLeVg-1; Tue, 07 Jun 2022 14:23:51 -0400 X-MC-Unique: tXeTOVyjMcq5mIypKmLeVg-1 Received: by mail-wm1-f70.google.com with SMTP id j40-20020a05600c1c2800b003972dbb1066so13093935wms.4 for ; Tue, 07 Jun 2022 11:23:51 -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=s12dM/fUNAK8FcN2HDfoJsYb2JSXAKJ07j+xEpEzvhM=; b=1G/AXbcx+cvUKcObWCKpFsi4Y84qjT8F/eiJ5Q4/WwTgrSfgzpDNlegfJ/ufoDOhC7 FbQhjuVpWwAHO5b1Hjyg5CkeFf/Wo9ijI89z6nkynljjkgQ8IUFHfKW/7O5aB4BUDvzy vy8/QhcICwUQXuCar3OWAc16qKTz8ar+dztHjYXgyUqtHUmxBnoZAX6KzUOuv60/8Hb9 tCB1AhoYAKxnGW9KGInz2iANOI4SxpCwGvMBckdFpyYvawDjzbJjkxYtiApK15+iV7+j e3DGgVyG5CamVMgHi3yg3U18RSW60YUcdIUUHJ2zjyYV/OwIS3SGFDG/yIUA9yzSKM8R +QdQ== X-Gm-Message-State: AOAM530ldQkpHexa/iJym0SZ5HvtfRg3FZrE7NoYqcbN5wJxCuUUqdM/ xDdmjU6CymyvEegDQBur8BuuF7lMSUICcmwAlz5NWlTpqteaYXRHUGG5LrYFs3XY/AZgXs063gH CZS8h+56ESn5uF6LRBL+bRLQ= X-Received: by 2002:a05:600c:3d1b:b0:39b:1743:4d84 with SMTP id bh27-20020a05600c3d1b00b0039b17434d84mr29741814wmb.118.1654626230272; Tue, 07 Jun 2022 11:23:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHm5Esw2Ac7SpEx33f/vi2LUTuERvwYyQv2tSJ4Nx4mYKDItiXTPZoaSeRZfdNCayFMtQlEg== X-Received: by 2002:a05:600c:3d1b:b0:39b:1743:4d84 with SMTP id bh27-20020a05600c3d1b00b0039b17434d84mr29741791wmb.118.1654626230045; Tue, 07 Jun 2022 11:23:50 -0700 (PDT) Received: from minerva.home (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id m8-20020a05600c4f4800b003942a244f51sm28267502wmq.42.2022.06.07.11.23.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 11:23:49 -0700 (PDT) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, Thomas Zimmermann , Laszlo Ersek , Alex Williamson , Gerd Hoffmann , kvm@vger.kernel.org, Greg Kroah-Hartman , Daniel Vetter , Zack Rusin , Javier Martinez Canillas , Hans de Goede , Ilya Trukhanov , Daniel Vetter , Peter Jones , linux-fbdev@vger.kernel.org, Helge Deller Subject: [PATCH v6 4/5] Revert "fbdev: Prevent probing generic drivers if a FB is already registered" Date: Tue, 7 Jun 2022 20:23:37 +0200 Message-Id: <20220607182338.344270-5-javierm@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607182338.344270-1-javierm@redhat.com> References: <20220607182338.344270-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 Signed-off-by: Daniel Vetter Reviewed-by: Javier Martinez Canillas Cc: Peter Jones Cc: linux-fbdev@vger.kernel.org Signed-off-by: Javier Martinez Canillas --- (no changes since v1) 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; From patchwork Tue Jun 7 18:23:38 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: 12872333 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 7D6B1C433EF for ; Tue, 7 Jun 2022 19:59:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357796AbiFGT7r (ORCPT ); Tue, 7 Jun 2022 15:59:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357935AbiFGT7C (ORCPT ); Tue, 7 Jun 2022 15:59:02 -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 407E01BBADA for ; Tue, 7 Jun 2022 11:24:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654626234; 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=P4f3wHn7jIrIURtw341a5ADfTmzk5i8t59cyMFQz5Qc=; b=Xw4HHWK9BFohqfbyqXsndyNgX19ayI7Gri9nvVyAhnDSAS69b3VGCx5V+2JkJo2Pm6n78f eOdI75AOMO6uAafiZiDTCndifelG6JaNCAf8WoiJt5UZ9yJRsS5kMvG62DbTJNUVKqbBy3 1S7frUjuyDro36D10+XguV9r3j4lLVc= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-351-Vv_cJYZSPYqWgVCPWUplhw-1; Tue, 07 Jun 2022 14:23:53 -0400 X-MC-Unique: Vv_cJYZSPYqWgVCPWUplhw-1 Received: by mail-wr1-f70.google.com with SMTP id c11-20020adffb4b000000b0020ff998391dso4179894wrs.8 for ; Tue, 07 Jun 2022 11:23:53 -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=P4f3wHn7jIrIURtw341a5ADfTmzk5i8t59cyMFQz5Qc=; b=xr1bZAq7L5+pVxgOGL7VRdz5o5WywmFHi1wf2kE9SKjncJSCGqeGvpYnn9Z9uEam+D 315XGPnLFx/HkmRIolSsuF2lr34kdCGzqIKWN8Oyvwd5euZN+19Uw+GqCIotKXdaA2O8 k7WPuyC2+UNqu7kplUp1VbfrbhvcbQcTDZoTfjh9ghzHTA2HJp+9lf+6O4MghXbl6KUZ FUqNDeIIVuxfke8rh3+huK6z//s94P55xUEGWzqnW5qP3E+PGti/W0ivPsJXddvmCncC M8KxIP65769flv9/roasZ7tfaMbfvciY+aicdWqgBcTqsLwfS8JozvIg23EYxdj7Hbuk WhCw== X-Gm-Message-State: AOAM530xKs8xdwNCZeCow7jg2esGSDjlW65vQrPZ7fxaZH+KJJkxSAZy oyW4h65rA1hA5CcArSAfrI+zz/+H+Y4EhrC3fRc8jrUOSvZxedibPWgrRUKfbxgqhIBlf+c/vyH FevOmQHmzFaooeGWP3YcGEac= X-Received: by 2002:a05:6000:711:b0:217:371e:b7ff with SMTP id bs17-20020a056000071100b00217371eb7ffmr16261823wrb.127.1654626232063; Tue, 07 Jun 2022 11:23:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/N4WjMmddIXMJgSScZ/qUGCGSnIp6UQDq474dS3NmqfffRft8Ws4ePchj9FzlpDpPJ0DOSA== X-Received: by 2002:a05:6000:711:b0:217:371e:b7ff with SMTP id bs17-20020a056000071100b00217371eb7ffmr16261787wrb.127.1654626231742; Tue, 07 Jun 2022 11:23:51 -0700 (PDT) Received: from minerva.home (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id m8-20020a05600c4f4800b003942a244f51sm28267502wmq.42.2022.06.07.11.23.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 11:23:51 -0700 (PDT) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, Thomas Zimmermann , Laszlo Ersek , Alex Williamson , Gerd Hoffmann , kvm@vger.kernel.org, Greg Kroah-Hartman , Daniel Vetter , kernel test robot , Jens Frederich , Jon Nettleton , linux-staging@lists.linux.dev, Daniel Vetter , Javier Martinez Canillas , Daniel Vetter , Helge Deller , Matthew Wilcox , Sam Ravnborg , Tetsuo Handa , Zhen Lei , Alex Deucher , Xiyu Yang , linux-fbdev@vger.kernel.org, Zheyu Ma , Guenter Roeck Subject: [PATCH v6 5/5] fbdev: Make registered_fb[] private to fbmem.c Date: Tue, 7 Jun 2022 20:23:38 +0200 Message-Id: <20220607182338.344270-6-javierm@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607182338.344270-1-javierm@redhat.com> References: <20220607182338.344270-1-javierm@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org From: Daniel Vetter Well except when the olpc dcon fbdev driver is enabled, that thing digs around in there in rather unfixable ways. Cc oldc_dcon maintainers as fyi. v2: I typoed the config name (0day) Cc: kernel test robot Cc: Jens Frederich Cc: Jon Nettleton Cc: Greg Kroah-Hartman Cc: linux-staging@lists.linux.dev Signed-off-by: Daniel Vetter Signed-off-by: Daniel Vetter Reviewed-by: Javier Martinez Canillas Cc: Daniel Vetter Cc: Helge Deller Cc: Matthew Wilcox Cc: Sam Ravnborg Cc: Tetsuo Handa Cc: Zhen Lei Cc: Alex Deucher Cc: Xiyu Yang Cc: linux-fbdev@vger.kernel.org Cc: Zheyu Ma Cc: Guenter Roeck Signed-off-by: Javier Martinez Canillas --- (no changes since v1) drivers/video/fbdev/core/fbmem.c | 8 ++++++-- include/linux/fb.h | 7 +++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index e0720fef0ee6..bdb08b665b43 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -50,10 +50,14 @@ static DEFINE_MUTEX(registration_lock); struct fb_info *registered_fb[FB_MAX] __read_mostly; -EXPORT_SYMBOL(registered_fb); - int num_registered_fb __read_mostly; +#if IS_ENABLED(CONFIG_FB_OLPC_DCON) +EXPORT_SYMBOL(registered_fb); EXPORT_SYMBOL(num_registered_fb); +#endif +#define for_each_registered_fb(i) \ + for (i = 0; i < FB_MAX; i++) \ + if (!registered_fb[i]) {} else bool fb_center_logo __read_mostly; diff --git a/include/linux/fb.h b/include/linux/fb.h index bbe1e4571899..c563e24b6293 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -632,16 +632,15 @@ extern int fb_get_color_depth(struct fb_var_screeninfo *var, extern int fb_get_options(const char *name, char **option); extern int fb_new_modelist(struct fb_info *info); +#if IS_ENABLED(CONFIG_FB_OLPC_DCON) extern struct fb_info *registered_fb[FB_MAX]; + extern int num_registered_fb; +#endif extern bool fb_center_logo; extern int fb_logo_count; extern struct class *fb_class; -#define for_each_registered_fb(i) \ - for (i = 0; i < FB_MAX; i++) \ - if (!registered_fb[i]) {} else - static inline void lock_fb_info(struct fb_info *info) { mutex_lock(&info->lock);