We maintain no global list of framebuffers, but it's a useful thing to
have if only for informational purposes. Add a struct class for this use
case.

Signed-off-by: Ahmad Fatoum <a.fat...@barebox.org>
---
 drivers/video/fb.c | 4 ++++
 include/fb.h       | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index 2ff5bbcfe290..939368a0de68 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -9,6 +9,8 @@
 #include <fs.h>
 #include <init.h>
 
+DEFINE_DEV_CLASS(fb_class, "fb");
+
 static int fb_ioctl(struct cdev* cdev, unsigned int req, void *data)
 {
        struct fb_info *info = cdev->priv;
@@ -346,6 +348,8 @@ int register_framebuffer(struct fb_info *info)
        if (ret)
                goto err_free;
 
+       class_add_device(&fb_class, &info->dev);
+
        dev_add_param_bool(dev, "enable", fb_enable_set, fb_enable_get,
                        &info->p_enable, info);
 
diff --git a/include/fb.h b/include/fb.h
index 01c5ce0bf377..1e3b330ab725 100644
--- a/include/fb.h
+++ b/include/fb.h
@@ -225,4 +225,6 @@ void fb_of_reserve_add_fixup(struct fb_info *info);
 int register_fbconsole(struct fb_info *fb);
 void *fb_get_screen_base(struct fb_info *info);
 
+extern struct class fb_class;
+
 #endif /* __FB_H */
-- 
2.39.5


Reply via email to