From nobody Tue Apr 28 02:27:44 2026 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 DF5D3CCA48F for ; Tue, 7 Jun 2022 21:02:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378520AbiFGVB2 (ORCPT ); Tue, 7 Jun 2022 17:01:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357627AbiFGT6Y (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.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 74C63186B8B for ; Tue, 7 Jun 2022 11:24:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654626230; 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=K5asxgZuJ1ujMS5G/D+zRXTIuzzJ85zczcuYLGDdaiU=; b=cGYAoH002C/veCQ1RcFlwj4sigjUWwGjbgrBqaT1QM1EjhMrb434QM6blHzZk3BBUeMm8i 3DpvPhnK2lGvUXerHEAB9ynref4SiOnkPKAeHE+GlqOWAaN3EMxrImen1UabZsKHf70Zm0 ruznY/e3UE7+IVz8zWbqd9ZEbsmJm4Q= 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-157-b1kb1bawN9S1NnpusBYh2Q-1; Tue, 07 Jun 2022 14:23:47 -0400 X-MC-Unique: b1kb1bawN9S1NnpusBYh2Q-1 Received: by mail-wm1-f72.google.com with SMTP id be12-20020a05600c1e8c00b0039c506b52a4so1920239wmb.1 for ; Tue, 07 Jun 2022 11:23:47 -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=K5asxgZuJ1ujMS5G/D+zRXTIuzzJ85zczcuYLGDdaiU=; b=YG9PZG1zE9mQQyCjGvOK5Sxk8AMV0jv3VgAlyLYLRInwCpkJS1kweLX/l8VnAlpoJb ZHfhIQpBglBfxRdv/4gRg7AfNyyMPnFMhaBVU8tpz1kt1bF4TbRVHqROg/5+PuuWYabp Jk1j2gmHLqbuRqSaZwuVaFtA1JKW60djA0ocJs9gWUG8/X6E3jXcLL+1H5Ze26emG/6E MBQ0Ix1gnCtbnc217eWw81QNIrs3dgJaJkEDIk0nN3TFk6/tjh8iw9EJbIYcvFYzo1bq 5vSCxPK8aAiOUtazPF0L2Ax0HVMyOfW/xUlk+pUn8pSDKUUtM8FKH7gJbQcUI7SR+Ei0 fJew== X-Gm-Message-State: AOAM530FqvSZpeOyPjBS5W7Hmwyy1vihwh+ZYfvRG6Rsjd7BA1Pdq4XR P6UijC4cH1X3Yle9dH7vbjNGoxOqFgtpTQIY4Fx9whRBA+vSQUOo9LmaF04CK+tUleogqEpCwCo pqH7rAu/AyelMeK2Ojj7eJF6dRNGMV+UKPSuA7ZFEPFlRlAot472qHkusIBO+wtAk7ss8tgeTLW o= X-Received: by 2002:a5d:6085:0:b0:213:b9b5:d985 with SMTP id w5-20020a5d6085000000b00213b9b5d985mr25936183wrt.113.1654626226058; Tue, 07 Jun 2022 11:23:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygUAWU18BEnEUrIRuTGd/XPIJF8uGKTTIOeWs5V/3pu465g0xtNSzJBp6qYlJzCjICEjYCLA== X-Received: by 2002:a5d:6085:0:b0:213:b9b5:d985 with SMTP id w5-20020a5d6085000000b00213b9b5d985mr25936143wrt.113.1654626225695; Tue, 07 Jun 2022 11:23:45 -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.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 11:23:45 -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 Subject: [PATCH v6 1/5] firmware: sysfb: Make sysfb_create_simplefb() return a pdev pointer Date: Tue, 7 Jun 2022 20:23:34 +0200 Message-Id: <20220607182338.344270-2-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This function just returned 0 on success or an errno code on error, but it could be useful for sysfb_init() callers to have a pointer to the device. Signed-off-by: Javier Martinez Canillas Reviewed-by: Daniel Vetter Reviewed-by: Thomas Zimmermann --- (no changes since v3) Changes in v3: - Add Thomas Zimmermann's Reviewed-by tag to patch #1. Changes in v2: - Rebase on top of latest drm-misc-next and fix conflicts (Daniel Vetter). drivers/firmware/sysfb.c | 4 ++-- drivers/firmware/sysfb_simplefb.c | 16 ++++++++-------- include/linux/sysfb.h | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c index 2bfbb05f7d89..b032f40a92de 100644 --- a/drivers/firmware/sysfb.c +++ b/drivers/firmware/sysfb.c @@ -46,8 +46,8 @@ static __init int sysfb_init(void) /* try to create a simple-framebuffer device */ compatible =3D sysfb_parse_mode(si, &mode); if (compatible) { - ret =3D sysfb_create_simplefb(si, &mode); - if (!ret) + pd =3D sysfb_create_simplefb(si, &mode); + if (!IS_ERR(pd)) return 0; } =20 diff --git a/drivers/firmware/sysfb_simplefb.c b/drivers/firmware/sysfb_sim= plefb.c index bda8712bfd8c..a353e27f83f5 100644 --- a/drivers/firmware/sysfb_simplefb.c +++ b/drivers/firmware/sysfb_simplefb.c @@ -57,8 +57,8 @@ __init bool sysfb_parse_mode(const struct screen_info *si, return false; } =20 -__init int sysfb_create_simplefb(const struct screen_info *si, - const struct simplefb_platform_data *mode) +__init struct platform_device *sysfb_create_simplefb(const struct screen_i= nfo *si, + const struct simplefb_platform_data *mode) { struct platform_device *pd; struct resource res; @@ -76,7 +76,7 @@ __init int sysfb_create_simplefb(const struct screen_info= *si, base |=3D (u64)si->ext_lfb_base << 32; if (!base || (u64)(resource_size_t)base !=3D base) { printk(KERN_DEBUG "sysfb: inaccessible VRAM base\n"); - return -EINVAL; + return ERR_PTR(-EINVAL); } =20 /* @@ -93,7 +93,7 @@ __init int sysfb_create_simplefb(const struct screen_info= *si, length =3D mode->height * mode->stride; if (length > size) { printk(KERN_WARNING "sysfb: VRAM smaller than advertised\n"); - return -EINVAL; + return ERR_PTR(-EINVAL); } length =3D PAGE_ALIGN(length); =20 @@ -104,11 +104,11 @@ __init int sysfb_create_simplefb(const struct screen_= info *si, res.start =3D base; res.end =3D res.start + length - 1; if (res.end <=3D res.start) - return -EINVAL; + return ERR_PTR(-EINVAL); =20 pd =3D platform_device_alloc("simple-framebuffer", 0); if (!pd) - return -ENOMEM; + return ERR_PTR(-ENOMEM); =20 sysfb_apply_efi_quirks(pd); =20 @@ -124,10 +124,10 @@ __init int sysfb_create_simplefb(const struct screen_= info *si, if (ret) goto err_put_device; =20 - return 0; + return pd; =20 err_put_device: platform_device_put(pd); =20 - return ret; + return ERR_PTR(ret); } diff --git a/include/linux/sysfb.h b/include/linux/sysfb.h index b0dcfa26d07b..708152e9037b 100644 --- a/include/linux/sysfb.h +++ b/include/linux/sysfb.h @@ -72,8 +72,8 @@ static inline void sysfb_apply_efi_quirks(struct platform= _device *pd) =20 bool sysfb_parse_mode(const struct screen_info *si, struct simplefb_platform_data *mode); -int sysfb_create_simplefb(const struct screen_info *si, - const struct simplefb_platform_data *mode); +struct platform_device *sysfb_create_simplefb(const struct screen_info *si, + const struct simplefb_platform_data *mode); =20 #else /* CONFIG_SYSFB_SIMPLE */ =20 @@ -83,10 +83,10 @@ static inline bool sysfb_parse_mode(const struct screen= _info *si, return false; } =20 -static inline int sysfb_create_simplefb(const struct screen_info *si, - const struct simplefb_platform_data *mode) +static inline struct platform_device *sysfb_create_simplefb(const struct s= creen_info *si, + const struct simplefb_platform_data *mode) { - return -EINVAL; + return ERR_PTR(-EINVAL); } =20 #endif /* CONFIG_SYSFB_SIMPLE */ --=20 2.36.1 From nobody Tue Apr 28 02:27:44 2026 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 CE735CCA48C for ; Tue, 7 Jun 2022 21:02:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378495AbiFGVBW (ORCPT ); Tue, 7 Jun 2022 17:01:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357576AbiFGT6Y (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 9B5051B4356 for ; Tue, 7 Jun 2022 11:24:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654626231; 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=oeKZwEXEPcVasf7F1CNd9feC/iLhpeWLvWAJd8mL+VI=; b=ITmVk/vEDrSYb8pmPO6E4O0QFW3AOmsJn7USdHe11CWaSkfuGFt6eh3N1UnVf+SQWHjMkq hXAUxc/xagrXy4c0e13w3z8bv2iIg10/syOlh8RRuUP1yxQoezhJ3rcrgxbwZZRCqLYJU8 QsM0cVv4TmM0PPskc2yIHEWQwzRceiI= 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-564-daImitcGMU6zlgm2QO8IHQ-1; Tue, 07 Jun 2022 14:23:49 -0400 X-MC-Unique: daImitcGMU6zlgm2QO8IHQ-1 Received: by mail-wm1-f71.google.com with SMTP id j40-20020a05600c1c2800b003972dbb1066so13093880wms.4 for ; Tue, 07 Jun 2022 11:23:48 -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=oeKZwEXEPcVasf7F1CNd9feC/iLhpeWLvWAJd8mL+VI=; b=PH2gx4UrkGad8hrss8wdT3Jt3gvvCaEw8I4jSOM+bItrx8KeXajxN9+l37fwwzbYCJ seD90LvfiCMOCILE/VG4GngsdwTRdonKxSY0n2A1RVBnuxTTSyCRLPww3Tra3Byqubip aBkiz90mecQzDdEDDjtdWQ7TSvHdFjeY/tAIp9RzRK2rmHBxuDLNPFHNY17RtzbAtGIu TWOFptbUe0+/tWno805Lqh4NZpevB4irkwKVCotTb6QnDCLPyWFkU9nhBr89+EPQYOjo jr9/Cb2HmByTX2TgWS46wWgqvibyQoyexOWmBMFFYM182oFNrhQ8LvfRR37IYtWkymvg c6lw== X-Gm-Message-State: AOAM5335hAZVpaiQ2PoQHXaf4gCUA01mozJMn6v17yvm+gl9qgUZfy4P g3bsasoRtL7wXxaJxOJ12VrczQ7JKnTtEci07X0PfuJL7gT4b8+U0Aodl1MvUstNtSCTvYSuPpi dNs9ckr2SghFRhIyirwXgLkQ1B4VosLpmUupvlrTaaDhpMjirl8KrVpjV4BFyp5v3GgbbOCHeAF 0= X-Received: by 2002:a5d:4526:0:b0:210:bac2:ba63 with SMTP id j6-20020a5d4526000000b00210bac2ba63mr30068090wra.677.1654626227497; Tue, 07 Jun 2022 11:23:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3NykQdMwif9epScM2xkEJ+WQL2CXLMZHRuVgUZST1zsqWvA2TpoYWLilwG1xnetgJI+uYXQ== X-Received: by 2002:a5d:4526:0:b0:210:bac2:ba63 with SMTP id j6-20020a5d4526000000b00210bac2ba63mr30068041wra.677.1654626227134; Tue, 07 Jun 2022 11:23:47 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 11:23:46 -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 , Jonathan Corbet , linux-doc@vger.kernel.org Subject: [PATCH v6 2/5] firmware: sysfb: Add sysfb_disable() helper function Date: Tue, 7 Jun 2022 20:23:35 +0200 Message-Id: <20220607182338.344270-3-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This can be used by subsystems to unregister a platform device registered by sysfb and also to disable future platform device registration in sysfb. Suggested-by: Daniel Vetter Signed-off-by: Javier Martinez Canillas Reviewed-by: Daniel Vetter --- Changes in v6: - Drop sysfb_try_unregister() helper since is no longer needed. Changes in v4: - Make sysfb_disable() to also attempt to unregister a device. Changes in v2: - Add kernel-doc comments and include in other_interfaces.rst (Daniel Vette= r). .../driver-api/firmware/other_interfaces.rst | 6 +++ drivers/firmware/sysfb.c | 54 ++++++++++++++++--- include/linux/sysfb.h | 13 +++++ 3 files changed, 67 insertions(+), 6 deletions(-) diff --git a/Documentation/driver-api/firmware/other_interfaces.rst b/Docum= entation/driver-api/firmware/other_interfaces.rst index b81794e0cfbb..06ac89adaafb 100644 --- a/Documentation/driver-api/firmware/other_interfaces.rst +++ b/Documentation/driver-api/firmware/other_interfaces.rst @@ -13,6 +13,12 @@ EDD Interfaces .. kernel-doc:: drivers/firmware/edd.c :internal: =20 +Generic System Framebuffers Interface +------------------------------------- + +.. kernel-doc:: drivers/firmware/sysfb.c + :export: + Intel Stratix10 SoC Service Layer --------------------------------- Some features of the Intel Stratix10 SoC require a level of privilege diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c index b032f40a92de..1f276f108cc9 100644 --- a/drivers/firmware/sysfb.c +++ b/drivers/firmware/sysfb.c @@ -34,21 +34,59 @@ #include #include =20 +static struct platform_device *pd; +static DEFINE_MUTEX(disable_lock); +static bool disabled; + +static bool sysfb_unregister(void) +{ + if (IS_ERR_OR_NULL(pd)) + return false; + + platform_device_unregister(pd); + pd =3D NULL; + + return true; +} + +/** + * sysfb_disable() - disable the Generic System Framebuffers support + * + * This disables the registration of system framebuffer devices that match= the + * generic drivers that make use of the system framebuffer set up by firmw= are. + * + * It also unregisters a device if this was already registered by sysfb_in= it(). + * + * Context: The function can sleep. A @disable_lock mutex is acquired to s= erialize + * against sysfb_init(), that registers a system framebuffer devi= ce. + */ +void sysfb_disable(void) +{ + mutex_lock(&disable_lock); + sysfb_unregister(); + disabled =3D true; + mutex_unlock(&disable_lock); +} +EXPORT_SYMBOL_GPL(sysfb_disable); + static __init int sysfb_init(void) { struct screen_info *si =3D &screen_info; struct simplefb_platform_data mode; - struct platform_device *pd; const char *name; bool compatible; - int ret; + int ret =3D 0; + + mutex_lock(&disable_lock); + if (disabled) + goto unlock_mutex; =20 /* try to create a simple-framebuffer device */ compatible =3D sysfb_parse_mode(si, &mode); if (compatible) { pd =3D sysfb_create_simplefb(si, &mode); if (!IS_ERR(pd)) - return 0; + goto unlock_mutex; } =20 /* if the FB is incompatible, create a legacy framebuffer device */ @@ -60,8 +98,10 @@ static __init int sysfb_init(void) name =3D "platform-framebuffer"; =20 pd =3D platform_device_alloc(name, 0); - if (!pd) - return -ENOMEM; + if (!pd) { + ret =3D -ENOMEM; + goto unlock_mutex; + } =20 sysfb_apply_efi_quirks(pd); =20 @@ -73,9 +113,11 @@ static __init int sysfb_init(void) if (ret) goto err; =20 - return 0; + goto unlock_mutex; err: platform_device_put(pd); +unlock_mutex: + mutex_unlock(&disable_lock); return ret; } =20 diff --git a/include/linux/sysfb.h b/include/linux/sysfb.h index 708152e9037b..e9baee4ae361 100644 --- a/include/linux/sysfb.h +++ b/include/linux/sysfb.h @@ -55,6 +55,19 @@ struct efifb_dmi_info { int flags; }; =20 +#ifdef CONFIG_SYSFB + +void sysfb_disable(void); + +#else /* CONFIG_SYSFB */ + +static inline void sysfb_disable(void) +{ + +} + +#endif /* CONFIG_SYSFB */ + #ifdef CONFIG_EFI =20 extern struct efifb_dmi_info efifb_dmi_list[]; --=20 2.36.1 From nobody Tue Apr 28 02:27:44 2026 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 F040DCCA48E for ; Tue, 7 Jun 2022 21:02:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378542AbiFGVBb (ORCPT ); Tue, 7 Jun 2022 17:01:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357614AbiFGT6Z (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 DDB5B1B780C for ; Tue, 7 Jun 2022 11:24:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654626231; 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=StC4cluhx0W7Rllbrgc/pueXaApx6GQrB2WlIMVpuw8PQ5KGWRGmw++iJA19cskdMd8SuJ zVYdnSzhCBP7/VCRhTnT5+1JO6DZqKsao/VuTBHTA8y1qrFxNBGXUCfBMTV0VMhmUJHry8 wPX2AyPy0rOlWA7W025iZ2w6claPzrs= 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-650-YgoQLJA-P_Kq7VdEt-lKpQ-1; Tue, 07 Jun 2022 14:23:50 -0400 X-MC-Unique: YgoQLJA-P_Kq7VdEt-lKpQ-1 Received: by mail-wm1-f70.google.com with SMTP id e19-20020a05600c4e5300b0039c4b6acd83so4585459wmq.2 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=QlFfjSMHo3QYF9PT2dTuURjIlnh03tMFX6ssVc8X4k6k8cbWNP+HSAjvGQu/sdZxH0 FrolyafohOcuX/GdJZ75d35tJc04NuuCiD21rWhoxSaiFMsbr8F9uLyuPef/tgfskv1G xu2AfPqbH/vmqqjJTIN39wl0Xf5wGbpZ8CxEXsQoDP/298cOjDbx0w6yBImkZrNHhDbz qyUNaBwC6h35Eo/SRUlqliaN6rgEB2QLknhzXTAZz/w3/90AXYMrOGXlIZYQnsqSSt9g WYnuHGIxZIath5OiZ+Nz3xiONKqPWCX27ggWHm+BoR29xlEO6t2IDwVWTFrqLQ308YfW u3eA== X-Gm-Message-State: AOAM530ASUckIX8OiNM2jw5qb5Z38F2Ot/m7kOy2kMIqbMrUstuvV+l3 IUA6YeXr0QUJEgj3qpjQalAhfWJtfLpzk9S35qwOloEl5okkaI/cHvjdK1DLg0ryE/KbRnogFyt uw76B0rUpbXhkJ7WjsUCqXK0Flxnw79w4u9eNQ58ezj86EbrJgDTIp934OSGXhsoKkdo+ASk1Y3 k= X-Received: by 2002:a05:6000:1b03:b0:216:43b4:82f1 with SMTP id f3-20020a0560001b0300b0021643b482f1mr18992426wrz.232.1654626229070; 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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 framebuffe= rs, 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/fb= mem.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 =3D true; } =20 + /* + * 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); --=20 2.36.1 From nobody Tue Apr 28 02:27:44 2026 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 4BE08CCA49A for ; Tue, 7 Jun 2022 21:02:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379052AbiFGVCA (ORCPT ); Tue, 7 Jun 2022 17:02:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357470AbiFGT7C (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 199421BAEAB for ; Tue, 7 Jun 2022 11:24:26 -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-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-591-UqxgHZuVNMaPNu9toCUtJA-1; Tue, 07 Jun 2022 14:23:51 -0400 X-MC-Unique: UqxgHZuVNMaPNu9toCUtJA-1 Received: by mail-wm1-f71.google.com with SMTP id k16-20020a7bc310000000b0038e6cf00439so9009027wmj.0 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=ZURUtdFG16ifLlpmg1pGxqgewKJk8d9+X36+6In9lGKm1gidi0mS7AltXCQIj/Sbi2 h6eI2dBYhLhIrLx8KUkSsnGmk91VrXoq2uWLrSNSh2SOtEOfspCA/V4kCmujZHnmj32v NYRu6cZSGK0zoczBPl67bP7b0TnzSg9Cq0b4Iv0UzC27g2RXmIYglDWspw/suPAbAFzW rq9i3lnA/2Cros6q521q4CnClo6J2kNfwmS+R26zqtjH5nNnaZ5k4na7RVOsHteL3Z6f kliDJdkMxrM2au6YyKq3cQTjMzVRo46Svz75A5efA1em0koVqoNDTN90bVF+Jpd1EXZi B3Jw== X-Gm-Message-State: AOAM531Ka4S2uKpoiQlUXOC2pliyZxXkoa9+ePOG0ukHqrKgjh8vttIB 0go48i/hYdcoY3QrID+XP+15qRUGbuhNNdYQm8PxSrIk4qBBehVDqL3AkK4qDK8nxutnh04J6Aa z0ogMjhzqP9L5+cpY/skOn8ic+E78AJOd9k3Vp4driiZAC4PjisC/T0LrxqTdWkBYLmjoXXh3rt w= X-Received: by 2002:a05:600c:3d1b:b0:39b:1743:4d84 with SMTP id bh27-20020a05600c3d1b00b0039b17434d84mr29741835wmb.118.1654626230467; 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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 =3D NULL; efi_memory_desc_t md; =20 - /* - * 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 !=3D VIDEO_TYPE_EFI || pci_dev_disabled) return -ENODEV; =20 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; =20 - /* - * 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; =20 --=20 2.36.1 From nobody Tue Apr 28 02:27:44 2026 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 86BCECCA490 for ; Tue, 7 Jun 2022 21:02:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379229AbiFGVCN (ORCPT ); Tue, 7 Jun 2022 17:02:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357940AbiFGT7C (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.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 379A61BBAD8 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-356-SAisHlqNP5WsHUtNi6HY6Q-1; Tue, 07 Jun 2022 14:23:53 -0400 X-MC-Unique: SAisHlqNP5WsHUtNi6HY6Q-1 Received: by mail-wr1-f70.google.com with SMTP id c16-20020a5d4cd0000000b00213b1d4a96cso3618521wrt.1 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=f3JxSlTgPlQAjXLF6kkXcs9ymkWH9K2VLFf2599DLbTDayOylkYBPqKw53bStqJJyV H9bAxz+XMPNcBfWukeX4Uq5p2k1lzr3wZqhdbLhoROulaCryz+TonjHw94x7cqiILvTq S6dHmmbTzY5/L4ptQpRQSaQU16KVH5BE7V+0PH7Bv7H3JAHAFfuwe6XYa9YSyE5oWGpg 2iBMqXEygJq3GGKoIHRVI9Fb4D/DGg4znPQoZCSleNlIr46l0iCL0HLSdnXzU+zYg3yy yFk18Ym3quGuThEQYwm44ayZ0Ft/Jw7n/VzSFfzkEvyjD7j1towRo6nK45ebdlslBpGc y1wA== X-Gm-Message-State: AOAM5318VWDgIIFfOqor/eGuvsm/EiA10iXNYGOViot8QLtoEe6GIN3/ +v9AT/G/QEKUnIwWfhx9m9oyV1XN13oTa0zE7Qd1GyDbW2jDzthFXGCAnmlLOXQcvnHcpnj8nid HHSvmHtFv19k6rKQ76XQnF59iUcIPEQV9tI16HzCatU/0ZOWWgqwBcnhNY+hnq51bmxSZKgsPBB 4= X-Received: by 2002:a05:6000:711:b0:217:371e:b7ff with SMTP id bs17-20020a056000071100b00217371eb7ffmr16261836wrb.127.1654626232103; 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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/fb= mem.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); =20 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 =3D 0; i < FB_MAX; i++) \ + if (!registered_fb[i]) {} else =20 bool fb_center_logo __read_mostly; =20 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_screeninf= o *var, extern int fb_get_options(const char *name, char **option); extern int fb_new_modelist(struct fb_info *info); =20 +#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; =20 -#define for_each_registered_fb(i) \ - for (i =3D 0; i < FB_MAX; i++) \ - if (!registered_fb[i]) {} else - static inline void lock_fb_info(struct fb_info *info) { mutex_lock(&info->lock); --=20 2.36.1