]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
gpu: host1x: Request channels for clients, not devices
authorThierry Reding <treding@nvidia.com>
Mon, 18 Jun 2018 12:01:51 +0000 (14:01 +0200)
committerThierry Reding <treding@nvidia.com>
Mon, 28 Oct 2019 10:18:33 +0000 (11:18 +0100)
A struct device doesn't carry much information that a channel might be
interested in, but the client very much does. Request channels for the
clients rather than their parent devices and store a pointer to them
in order to have that information available when needed.

Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/tegra/gr2d.c
drivers/gpu/drm/tegra/gr3d.c
drivers/gpu/drm/tegra/vic.c
drivers/gpu/host1x/channel.c
drivers/gpu/host1x/channel.h
include/linux/host1x.h

index 641299cc85b83511c2ccfdeaf294d6b7fa381425..3cbb4a029c41c8977c97a0881ea8be89d1758b93 100644 (file)
@@ -40,7 +40,7 @@ static int gr2d_init(struct host1x_client *client)
        struct gr2d *gr2d = to_gr2d(drm);
        int err;
 
-       gr2d->channel = host1x_channel_request(client->dev);
+       gr2d->channel = host1x_channel_request(client);
        if (!gr2d->channel)
                return -ENOMEM;
 
index 8b9a35b1cbb3ce86e5fbdffd7f371e7a9858f965..87a386134cc4499de6eec54f877f86782ef657aa 100644 (file)
@@ -49,7 +49,7 @@ static int gr3d_init(struct host1x_client *client)
        struct gr3d *gr3d = to_gr3d(drm);
        int err;
 
-       gr3d->channel = host1x_channel_request(client->dev);
+       gr3d->channel = host1x_channel_request(client);
        if (!gr3d->channel)
                return -ENOMEM;
 
index cd0399fd8c6366db3857ca502eb238720ad0107b..c97a61c877af15e8a2d97d73ff5710c340557263 100644 (file)
@@ -198,7 +198,7 @@ static int vic_init(struct host1x_client *client)
                vic->domain = tegra->domain;
        }
 
-       vic->channel = host1x_channel_request(client->dev);
+       vic->channel = host1x_channel_request(client);
        if (!vic->channel) {
                err = -ENOMEM;
                goto detach;
index 1436295aa4500bdfc600f796034e657643bb804b..4cd212bb570d5237c76518ea648a901790a90146 100644 (file)
@@ -115,14 +115,14 @@ static struct host1x_channel *acquire_unused_channel(struct host1x *host)
 
 /**
  * host1x_channel_request() - Allocate a channel
- * @device: Host1x unit this channel will be used to send commands to
+ * @client: Host1x client this channel will be used to send commands to
  *
- * Allocates a new host1x channel for @device. May return NULL if CDMA
+ * Allocates a new host1x channel for @client. May return NULL if CDMA
  * initialization fails.
  */
-struct host1x_channel *host1x_channel_request(struct device *dev)
+struct host1x_channel *host1x_channel_request(struct host1x_client *client)
 {
-       struct host1x *host = dev_get_drvdata(dev->parent);
+       struct host1x *host = dev_get_drvdata(client->dev->parent);
        struct host1x_channel_list *chlist = &host->channel_list;
        struct host1x_channel *channel;
        int err;
@@ -133,7 +133,8 @@ struct host1x_channel *host1x_channel_request(struct device *dev)
 
        kref_init(&channel->refcount);
        mutex_init(&channel->submitlock);
-       channel->dev = dev;
+       channel->client = client;
+       channel->dev = client->dev;
 
        err = host1x_hw_channel_init(host, channel, channel->id);
        if (err < 0)
@@ -148,7 +149,7 @@ struct host1x_channel *host1x_channel_request(struct device *dev)
 fail:
        clear_bit(channel->id, chlist->allocated_channels);
 
-       dev_err(dev, "failed to initialize channel\n");
+       dev_err(client->dev, "failed to initialize channel\n");
 
        return NULL;
 }
index 4fd694834f74438c972e2af7af6bfef3badc7324..39044ff6c3aab1eff020dec36b97d0e50fb71cf2 100644 (file)
@@ -26,6 +26,7 @@ struct host1x_channel {
        unsigned int id;
        struct mutex submitlock;
        void __iomem *regs;
+       struct host1x_client *client;
        struct device *dev;
        struct host1x_cdma cdma;
 };
index e6eea45e115496c4eba3514d5dccbc79c8e0deac..4396cd566a33fcf2e10518258f7551efaf8dd0fd 100644 (file)
@@ -158,7 +158,7 @@ u32 host1x_syncpt_base_id(struct host1x_syncpt_base *base);
 struct host1x_channel;
 struct host1x_job;
 
-struct host1x_channel *host1x_channel_request(struct device *dev);
+struct host1x_channel *host1x_channel_request(struct host1x_client *client);
 struct host1x_channel *host1x_channel_get(struct host1x_channel *channel);
 void host1x_channel_put(struct host1x_channel *channel);
 int host1x_job_submit(struct host1x_job *job);