Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpu: host1x: Request channels for clients, not devices

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>

+12 -10
+1 -1
drivers/gpu/drm/tegra/gr2d.c
··· 40 40 struct gr2d *gr2d = to_gr2d(drm); 41 41 int err; 42 42 43 - gr2d->channel = host1x_channel_request(client->dev); 43 + gr2d->channel = host1x_channel_request(client); 44 44 if (!gr2d->channel) 45 45 return -ENOMEM; 46 46
+1 -1
drivers/gpu/drm/tegra/gr3d.c
··· 49 49 struct gr3d *gr3d = to_gr3d(drm); 50 50 int err; 51 51 52 - gr3d->channel = host1x_channel_request(client->dev); 52 + gr3d->channel = host1x_channel_request(client); 53 53 if (!gr3d->channel) 54 54 return -ENOMEM; 55 55
+1 -1
drivers/gpu/drm/tegra/vic.c
··· 198 198 vic->domain = tegra->domain; 199 199 } 200 200 201 - vic->channel = host1x_channel_request(client->dev); 201 + vic->channel = host1x_channel_request(client); 202 202 if (!vic->channel) { 203 203 err = -ENOMEM; 204 204 goto detach;
+7 -6
drivers/gpu/host1x/channel.c
··· 115 115 116 116 /** 117 117 * host1x_channel_request() - Allocate a channel 118 - * @device: Host1x unit this channel will be used to send commands to 118 + * @client: Host1x client this channel will be used to send commands to 119 119 * 120 - * Allocates a new host1x channel for @device. May return NULL if CDMA 120 + * Allocates a new host1x channel for @client. May return NULL if CDMA 121 121 * initialization fails. 122 122 */ 123 - struct host1x_channel *host1x_channel_request(struct device *dev) 123 + struct host1x_channel *host1x_channel_request(struct host1x_client *client) 124 124 { 125 - struct host1x *host = dev_get_drvdata(dev->parent); 125 + struct host1x *host = dev_get_drvdata(client->dev->parent); 126 126 struct host1x_channel_list *chlist = &host->channel_list; 127 127 struct host1x_channel *channel; 128 128 int err; ··· 133 133 134 134 kref_init(&channel->refcount); 135 135 mutex_init(&channel->submitlock); 136 - channel->dev = dev; 136 + channel->client = client; 137 + channel->dev = client->dev; 137 138 138 139 err = host1x_hw_channel_init(host, channel, channel->id); 139 140 if (err < 0) ··· 149 148 fail: 150 149 clear_bit(channel->id, chlist->allocated_channels); 151 150 152 - dev_err(dev, "failed to initialize channel\n"); 151 + dev_err(client->dev, "failed to initialize channel\n"); 153 152 154 153 return NULL; 155 154 }
+1
drivers/gpu/host1x/channel.h
··· 26 26 unsigned int id; 27 27 struct mutex submitlock; 28 28 void __iomem *regs; 29 + struct host1x_client *client; 29 30 struct device *dev; 30 31 struct host1x_cdma cdma; 31 32 };
+1 -1
include/linux/host1x.h
··· 158 158 struct host1x_channel; 159 159 struct host1x_job; 160 160 161 - struct host1x_channel *host1x_channel_request(struct device *dev); 161 + struct host1x_channel *host1x_channel_request(struct host1x_client *client); 162 162 struct host1x_channel *host1x_channel_get(struct host1x_channel *channel); 163 163 void host1x_channel_put(struct host1x_channel *channel); 164 164 int host1x_job_submit(struct host1x_job *job);