drm/tegra: Remove host1x drm_bus implementation
authorThierry Reding <treding@nvidia.com>
Thu, 22 May 2014 07:57:15 +0000 (09:57 +0200)
committerThierry Reding <treding@nvidia.com>
Thu, 5 Jun 2014 21:14:46 +0000 (23:14 +0200)
The DRM core can now cope with drivers that don't have an associated
struct drm_bus, so the host1x implementation is no longer useful.

Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/tegra/Makefile
drivers/gpu/drm/tegra/bus.c [deleted file]
drivers/gpu/drm/tegra/dc.c
drivers/gpu/drm/tegra/drm.c
drivers/gpu/drm/tegra/drm.h
drivers/gpu/drm/tegra/dsi.c
drivers/gpu/drm/tegra/gr2d.c
drivers/gpu/drm/tegra/gr3d.c
drivers/gpu/drm/tegra/hdmi.c
drivers/gpu/drm/tegra/sor.c

index d43f21bb459685b3cd26436902a45a171d412947..2c66a8db9da4290a3b4e70074868a23f6d4e8c78 100644 (file)
@@ -1,7 +1,6 @@
 ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG
 
 tegra-drm-y := \
-       bus.o \
        drm.o \
        gem.o \
        fb.o \
diff --git a/drivers/gpu/drm/tegra/bus.c b/drivers/gpu/drm/tegra/bus.c
deleted file mode 100644 (file)
index b3a66d6..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2013 NVIDIA Corporation
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include "drm.h"
-
-static int drm_host1x_set_busid(struct drm_device *dev,
-                               struct drm_master *master)
-{
-       const char *device = dev_name(dev->dev);
-       const char *bus = dev->dev->bus->name;
-
-       master->unique_len = strlen(bus) + 1 + strlen(device);
-       master->unique_size = master->unique_len;
-
-       master->unique = kmalloc(master->unique_len + 1, GFP_KERNEL);
-       if (!master->unique)
-               return -ENOMEM;
-
-       snprintf(master->unique, master->unique_len + 1, "%s:%s", bus, device);
-
-       return 0;
-}
-
-static struct drm_bus drm_host1x_bus = {
-       .set_busid = drm_host1x_set_busid,
-};
-
-int drm_host1x_init(struct drm_driver *driver, struct host1x_device *device)
-{
-       struct drm_device *drm;
-       int ret;
-
-       driver->bus = &drm_host1x_bus;
-
-       drm = drm_dev_alloc(driver, &device->dev);
-       if (!drm)
-               return -ENOMEM;
-
-       ret = drm_dev_register(drm, 0);
-       if (ret)
-               goto err_free;
-
-       DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver->name,
-                driver->major, driver->minor, driver->patchlevel,
-                driver->date, drm->primary->index);
-
-       return 0;
-
-err_free:
-       drm_dev_unref(drm);
-       return ret;
-}
-
-void drm_host1x_exit(struct drm_driver *driver, struct host1x_device *device)
-{
-       struct tegra_drm *tegra = dev_get_drvdata(&device->dev);
-
-       drm_put_dev(tegra->drm);
-}
index 859e424e15e51939e8cd6979ce49546f7a8a7a36..323216789b6957694fbca13a29e981f3495ce498 100644 (file)
@@ -1104,26 +1104,26 @@ static int tegra_dc_debugfs_exit(struct tegra_dc *dc)
 
 static int tegra_dc_init(struct host1x_client *client)
 {
-       struct tegra_drm *tegra = dev_get_drvdata(client->parent);
+       struct drm_device *drm = dev_get_drvdata(client->parent);
        struct tegra_dc *dc = host1x_client_to_dc(client);
        int err;
 
-       drm_crtc_init(tegra->drm, &dc->base, &tegra_crtc_funcs);
+       drm_crtc_init(drm, &dc->base, &tegra_crtc_funcs);
        drm_mode_crtc_set_gamma_size(&dc->base, 256);
        drm_crtc_helper_add(&dc->base, &tegra_crtc_helper_funcs);
 
-       err = tegra_dc_rgb_init(tegra->drm, dc);
+       err = tegra_dc_rgb_init(drm, dc);
        if (err < 0 && err != -ENODEV) {
                dev_err(dc->dev, "failed to initialize RGB output: %d\n", err);
                return err;
        }
 
-       err = tegra_dc_add_planes(tegra->drm, dc);
+       err = tegra_dc_add_planes(drm, dc);
        if (err < 0)
                return err;
 
        if (IS_ENABLED(CONFIG_DEBUG_FS)) {
-               err = tegra_dc_debugfs_init(dc, tegra->drm->primary);
+               err = tegra_dc_debugfs_init(dc, drm->primary);
                if (err < 0)
                        dev_err(dc->dev, "debugfs setup failed: %d\n", err);
        }
index 09ee77923d6769bab76c202adc09de7a38508def..3396f9f6a9f76b598434f3679dbf7c0f629e4817 100644 (file)
@@ -33,7 +33,6 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
        if (!tegra)
                return -ENOMEM;
 
-       dev_set_drvdata(drm->dev, tegra);
        mutex_init(&tegra->clients_lock);
        INIT_LIST_HEAD(&tegra->clients);
        drm->dev_private = tegra;
@@ -640,14 +639,40 @@ int tegra_drm_unregister_client(struct tegra_drm *tegra,
        return 0;
 }
 
-static int host1x_drm_probe(struct host1x_device *device)
+static int host1x_drm_probe(struct host1x_device *dev)
 {
-       return drm_host1x_init(&tegra_drm_driver, device);
+       struct drm_driver *driver = &tegra_drm_driver;
+       struct drm_device *drm;
+       int err;
+
+       drm = drm_dev_alloc(driver, &dev->dev);
+       if (!drm)
+               return -ENOMEM;
+
+       drm_dev_set_unique(drm, dev_name(&dev->dev));
+       dev_set_drvdata(&dev->dev, drm);
+
+       err = drm_dev_register(drm, 0);
+       if (err < 0)
+               goto unref;
+
+       DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver->name,
+                driver->major, driver->minor, driver->patchlevel,
+                driver->date, drm->primary->index);
+
+       return 0;
+
+unref:
+       drm_dev_unref(drm);
+       return err;
 }
 
-static int host1x_drm_remove(struct host1x_device *device)
+static int host1x_drm_remove(struct host1x_device *dev)
 {
-       drm_host1x_exit(&tegra_drm_driver, device);
+       struct drm_device *drm = dev_get_drvdata(&dev->dev);
+
+       drm_dev_unregister(drm);
+       drm_dev_unref(drm);
 
        return 0;
 }
index 784fd5c77441b7c476ede7c0c7b214bb169407f7..6b8fe9d86ed47d22c8bc651c368820a545e633a5 100644 (file)
@@ -249,10 +249,6 @@ static inline int tegra_output_check_mode(struct tegra_output *output,
        return output ? -ENOSYS : -EINVAL;
 }
 
-/* from bus.c */
-int drm_host1x_init(struct drm_driver *driver, struct host1x_device *device);
-void drm_host1x_exit(struct drm_driver *driver, struct host1x_device *device);
-
 /* from rgb.c */
 int tegra_dc_rgb_probe(struct tegra_dc *dc);
 int tegra_dc_rgb_remove(struct tegra_dc *dc);
index 3838575f71c64c6e2a7966adc20f284e773401c4..bd56f2affa7895b2d1e0fbd556e3e811f8e78f14 100644 (file)
@@ -715,7 +715,7 @@ static int tegra_dsi_pad_calibrate(struct tegra_dsi *dsi)
 
 static int tegra_dsi_init(struct host1x_client *client)
 {
-       struct tegra_drm *tegra = dev_get_drvdata(client->parent);
+       struct drm_device *drm = dev_get_drvdata(client->parent);
        struct tegra_dsi *dsi = host1x_client_to_dsi(client);
        int err;
 
@@ -723,14 +723,14 @@ static int tegra_dsi_init(struct host1x_client *client)
        dsi->output.dev = client->dev;
        dsi->output.ops = &dsi_ops;
 
-       err = tegra_output_init(tegra->drm, &dsi->output);
+       err = tegra_output_init(drm, &dsi->output);
        if (err < 0) {
                dev_err(client->dev, "output setup failed: %d\n", err);
                return err;
        }
 
        if (IS_ENABLED(CONFIG_DEBUG_FS)) {
-               err = tegra_dsi_debugfs_init(dsi, tegra->drm->primary);
+               err = tegra_dsi_debugfs_init(dsi, drm->primary);
                if (err < 0)
                        dev_err(dsi->dev, "debugfs setup failed: %d\n", err);
        }
index 2c7ca748edf57f5e89eacd22af50885a0771182c..7c53941f2a9ea347d6ff44eb1583efc629b611d7 100644 (file)
@@ -28,7 +28,7 @@ static inline struct gr2d *to_gr2d(struct tegra_drm_client *client)
 static int gr2d_init(struct host1x_client *client)
 {
        struct tegra_drm_client *drm = host1x_to_drm_client(client);
-       struct tegra_drm *tegra = dev_get_drvdata(client->parent);
+       struct drm_device *dev = dev_get_drvdata(client->parent);
        unsigned long flags = HOST1X_SYNCPT_HAS_BASE;
        struct gr2d *gr2d = to_gr2d(drm);
 
@@ -42,17 +42,17 @@ static int gr2d_init(struct host1x_client *client)
                return -ENOMEM;
        }
 
-       return tegra_drm_register_client(tegra, drm);
+       return tegra_drm_register_client(dev->dev_private, drm);
 }
 
 static int gr2d_exit(struct host1x_client *client)
 {
        struct tegra_drm_client *drm = host1x_to_drm_client(client);
-       struct tegra_drm *tegra = dev_get_drvdata(client->parent);
+       struct drm_device *dev = dev_get_drvdata(client->parent);
        struct gr2d *gr2d = to_gr2d(drm);
        int err;
 
-       err = tegra_drm_unregister_client(tegra, drm);
+       err = tegra_drm_unregister_client(dev->dev_private, drm);
        if (err < 0)
                return err;
 
index 0cbb24b1ae04feef3e3bd602936c0e469715527e..30f5ba9bd6d05c508eac1306c7b1468e6c515587 100644 (file)
@@ -37,7 +37,7 @@ static inline struct gr3d *to_gr3d(struct tegra_drm_client *client)
 static int gr3d_init(struct host1x_client *client)
 {
        struct tegra_drm_client *drm = host1x_to_drm_client(client);
-       struct tegra_drm *tegra = dev_get_drvdata(client->parent);
+       struct drm_device *dev = dev_get_drvdata(client->parent);
        unsigned long flags = HOST1X_SYNCPT_HAS_BASE;
        struct gr3d *gr3d = to_gr3d(drm);
 
@@ -51,17 +51,17 @@ static int gr3d_init(struct host1x_client *client)
                return -ENOMEM;
        }
 
-       return tegra_drm_register_client(tegra, drm);
+       return tegra_drm_register_client(dev->dev_private, drm);
 }
 
 static int gr3d_exit(struct host1x_client *client)
 {
        struct tegra_drm_client *drm = host1x_to_drm_client(client);
-       struct tegra_drm *tegra = dev_get_drvdata(client->parent);
+       struct drm_device *dev = dev_get_drvdata(client->parent);
        struct gr3d *gr3d = to_gr3d(drm);
        int err;
 
-       err = tegra_drm_unregister_client(tegra, drm);
+       err = tegra_drm_unregister_client(dev->dev_private, drm);
        if (err < 0)
                return err;
 
index fec1a63d32c92afc4f47643781677094aeded4fa..ba067bb767e376ea4aaa5a7f5fe5917d1608b7c2 100644 (file)
@@ -1347,7 +1347,7 @@ static int tegra_hdmi_debugfs_exit(struct tegra_hdmi *hdmi)
 
 static int tegra_hdmi_init(struct host1x_client *client)
 {
-       struct tegra_drm *tegra = dev_get_drvdata(client->parent);
+       struct drm_device *drm = dev_get_drvdata(client->parent);
        struct tegra_hdmi *hdmi = host1x_client_to_hdmi(client);
        int err;
 
@@ -1355,14 +1355,14 @@ static int tegra_hdmi_init(struct host1x_client *client)
        hdmi->output.dev = client->dev;
        hdmi->output.ops = &hdmi_ops;
 
-       err = tegra_output_init(tegra->drm, &hdmi->output);
+       err = tegra_output_init(drm, &hdmi->output);
        if (err < 0) {
                dev_err(client->dev, "output setup failed: %d\n", err);
                return err;
        }
 
        if (IS_ENABLED(CONFIG_DEBUG_FS)) {
-               err = tegra_hdmi_debugfs_init(hdmi, tegra->drm->primary);
+               err = tegra_hdmi_debugfs_init(hdmi, drm->primary);
                if (err < 0)
                        dev_err(client->dev, "debugfs setup failed: %d\n", err);
        }
index 7d66f6e5391990a650b7ebb7e6056dec256a879c..5c67d97bd21d31c76812e4656ece1714c6971fa9 100644 (file)
@@ -1044,7 +1044,7 @@ static int tegra_sor_debugfs_exit(struct tegra_sor *sor)
 
 static int tegra_sor_init(struct host1x_client *client)
 {
-       struct tegra_drm *tegra = dev_get_drvdata(client->parent);
+       struct drm_device *drm = dev_get_drvdata(client->parent);
        struct tegra_sor *sor = host1x_client_to_sor(client);
        int err;
 
@@ -1056,14 +1056,14 @@ static int tegra_sor_init(struct host1x_client *client)
        sor->output.dev = sor->dev;
        sor->output.ops = &sor_ops;
 
-       err = tegra_output_init(tegra->drm, &sor->output);
+       err = tegra_output_init(drm, &sor->output);
        if (err < 0) {
                dev_err(sor->dev, "output setup failed: %d\n", err);
                return err;
        }
 
        if (IS_ENABLED(CONFIG_DEBUG_FS)) {
-               struct dentry *root = tegra->drm->primary->debugfs_root;
+               struct dentry *root = drm->primary->debugfs_root;
 
                err = tegra_sor_debugfs_init(sor, root);
                if (err < 0)