git: 01a14c88d9fb - stable/13 - fb: Add a default getinfo method

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Thu, 02 Feb 2023 11:29:49 UTC
The branch stable/13 has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=01a14c88d9fb5bb209b869512d31cdf512fbb433

commit 01a14c88d9fb5bb209b869512d31cdf512fbb433
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2022-06-21 13:52:49 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2023-02-02 11:28:47 +0000

    fb: Add a default getinfo method
    
    fb_getinfo is badly designed as it returns either the
    info if the driver have the method or ENXIO via the kobj stuff
    if the driver doesn't have it.
    Add a default method that returns NULL as the code already checks this
    and it avoid changing the interface.
    None of the drm drivers supported have this method and it sometimes
    fails and panic when loading them (for now only usb-c docks seems to be
    affected).
    
    MFC after:      3 days
    Sponsored by:   Beckhoff Automation GmbH & Co. KG
    
    (cherry picked from commit 3cbf6518d6eea08e0fbe6d7c609debac5ab31992)
---
 sys/dev/fb/fb_if.m | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/sys/dev/fb/fb_if.m b/sys/dev/fb/fb_if.m
index 53e4563bb6f5..938cececa409 100644
--- a/sys/dev/fb/fb_if.m
+++ b/sys/dev/fb/fb_if.m
@@ -3,6 +3,14 @@
 
 INTERFACE fb;
 
+CODE {
+	static struct fb_info *
+	fb_default_getinfo(device_t dev)
+	{
+		return (NULL);
+	}
+};
+
 METHOD struct fb_info * getinfo {
 	device_t dev;
-};
+} DEFAULT fb_default_getinfo;