[PATCH 6/7] drm/tegra: Initialize fbdev DRM client

Thomas Zimmermann
2023-03-30T08:36:22Z

Initialize the fbdev client in the fbdev code with empty helper
functions. Also clean up the client. The helpers will later
implement various functionality of the DRM client. No functional
changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/gpu/drm/tegra/fbdev.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/fbdev.c b/drivers/gpu/drm/tegra/fbdev.c
index 2400d42f82e4..31a95a955efb 100644
--- a/drivers/gpu/drm/tegra/fbdev.c
+++ b/drivers/gpu/drm/tegra/fbdev.c
@@ -125,6 +125,30 @@ static const struct drm_fb_helper_funcs tegra_fb_helper_funcs = {
.fb_probe = tegra_fbdev_probe,
};

+/*
+ * struct drm_client
+ */
+
+static void tegra_fbdev_client_unregister(struct drm_client_dev *client)
+{ }
+
+static int tregra_fbdev_client_restore(struct drm_client_dev *client)
+{
+ return 0;
+}
+
+static int tegra_fbdev_client_hotplug(struct drm_client_dev *client)
+{
+ return 0;
+}
+
+static const struct drm_client_funcs tegra_fbdev_client_funcs = {
+ .owner = THIS_MODULE,
+ .unregister = tegra_fbdev_client_unregister,
+ .restore = tegra_fbdev_client_restore,
+ .hotplug = tegra_fbdev_client_hotplug,
+};
+
static struct drm_fb_helper *tegra_fbdev_create(struct drm_device *drm)
{
struct drm_fb_helper *helper;
@@ -151,11 +175,15 @@ static int tegra_fbdev_init(struct drm_fb_helper *helper,
struct drm_device *drm = helper->dev;
int err;

+ err = drm_client_init(dev, &helper->client, "fbdev", &tegra_fbdev_client_funcs);
+ if (err)
+ return err;
+
err = drm_fb_helper_init(drm, helper);
if (err < 0) {
dev_err(drm->dev, "failed to initialize DRM FB helper: %d\n",
err);
- return err;
+ goto err_drm_client_release;
}

err = drm_fb_helper_initial_config(helper);
@@ -169,6 +197,8 @@ static int tegra_fbdev_init(struct drm_fb_helper *helper,

fini:
drm_fb_helper_fini(helper);
+err_drm_client_release:
+ drm_client_release(&helper->client);
return err;
}

@@ -191,6 +221,7 @@ static void tegra_fbdev_exit(struct drm_fb_helper *helper)
}

drm_fb_helper_fini(helper);
+ drm_client_release(&helper->client);
tegra_fbdev_free(helper);
}

--
2.40.0