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

gpu: host1x: syncpt: Request syncpoints per client

Rather than request syncpoints for a struct device *, request them for a
struct host1x_client *. This is important because subsequent patches are
going to break the assumption that host1x will always be the parent for
devices requesting a syncpoint. It's also a more natural choice because
host1x clients are really the only ones that will know how to deal with
syncpoints.

Note that host1x clients are always guaranteed to be children of host1x,
regardless of their location in the device tree.

Signed-off-by: Thierry Reding <treding@nvidia.com>

+14 -14
+1 -1
drivers/gpu/drm/tegra/dc.c
··· 1756 1756 struct drm_plane *cursor = NULL; 1757 1757 int err; 1758 1758 1759 - dc->syncpt = host1x_syncpt_request(dc->dev, flags); 1759 + dc->syncpt = host1x_syncpt_request(client, flags); 1760 1760 if (!dc->syncpt) 1761 1761 dev_warn(dc->dev, "failed to allocate syncpoint\n"); 1762 1762
+1 -1
drivers/gpu/drm/tegra/gr2d.c
··· 36 36 if (!gr2d->channel) 37 37 return -ENOMEM; 38 38 39 - client->syncpts[0] = host1x_syncpt_request(client->dev, flags); 39 + client->syncpts[0] = host1x_syncpt_request(client, flags); 40 40 if (!client->syncpts[0]) { 41 41 host1x_channel_put(gr2d->channel); 42 42 return -ENOMEM;
+1 -1
drivers/gpu/drm/tegra/gr3d.c
··· 46 46 if (!gr3d->channel) 47 47 return -ENOMEM; 48 48 49 - client->syncpts[0] = host1x_syncpt_request(client->dev, flags); 49 + client->syncpts[0] = host1x_syncpt_request(client, flags); 50 50 if (!client->syncpts[0]) { 51 51 host1x_channel_put(gr3d->channel); 52 52 return -ENOMEM;
+1 -1
drivers/gpu/drm/tegra/vic.c
··· 167 167 goto detach_device; 168 168 } 169 169 170 - client->syncpts[0] = host1x_syncpt_request(client->dev, 0); 170 + client->syncpts[0] = host1x_syncpt_request(client, 0); 171 171 if (!client->syncpts[0]) { 172 172 err = -ENOMEM; 173 173 goto free_channel;
+8 -8
drivers/gpu/host1x/syncpt.c
··· 54 54 } 55 55 56 56 static struct host1x_syncpt *host1x_syncpt_alloc(struct host1x *host, 57 - struct device *dev, 57 + struct host1x_client *client, 58 58 unsigned long flags) 59 59 { 60 60 int i; ··· 76 76 } 77 77 78 78 name = kasprintf(GFP_KERNEL, "%02u-%s", sp->id, 79 - dev ? dev_name(dev) : NULL); 79 + client ? dev_name(client->dev) : NULL); 80 80 if (!name) 81 81 goto free_base; 82 82 83 - sp->dev = dev; 83 + sp->client = client; 84 84 sp->name = name; 85 85 86 86 if (flags & HOST1X_SYNCPT_CLIENT_MANAGED) ··· 419 419 420 420 /** 421 421 * host1x_syncpt_request() - request a syncpoint 422 - * @dev: device requesting the syncpoint 422 + * @client: client requesting the syncpoint 423 423 * @flags: flags 424 424 * 425 425 * host1x client drivers can use this function to allocate a syncpoint for ··· 427 427 * use by the client exclusively. When no longer using a syncpoint, a host1x 428 428 * client driver needs to release it using host1x_syncpt_free(). 429 429 */ 430 - struct host1x_syncpt *host1x_syncpt_request(struct device *dev, 430 + struct host1x_syncpt *host1x_syncpt_request(struct host1x_client *client, 431 431 unsigned long flags) 432 432 { 433 - struct host1x *host = dev_get_drvdata(dev->parent); 433 + struct host1x *host = dev_get_drvdata(client->parent->parent); 434 434 435 - return host1x_syncpt_alloc(host, dev, flags); 435 + return host1x_syncpt_alloc(host, client, flags); 436 436 } 437 437 EXPORT_SYMBOL(host1x_syncpt_request); 438 438 ··· 456 456 host1x_syncpt_base_free(sp->base); 457 457 kfree(sp->name); 458 458 sp->base = NULL; 459 - sp->dev = NULL; 459 + sp->client = NULL; 460 460 sp->name = NULL; 461 461 sp->client_managed = false; 462 462
+1 -1
drivers/gpu/host1x/syncpt.h
··· 44 44 const char *name; 45 45 bool client_managed; 46 46 struct host1x *host; 47 - struct device *dev; 47 + struct host1x_client *client; 48 48 struct host1x_syncpt_base *base; 49 49 50 50 /* interrupt data */
+1 -1
include/linux/host1x.h
··· 157 157 u32 host1x_syncpt_incr_max(struct host1x_syncpt *sp, u32 incrs); 158 158 int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout, 159 159 u32 *value); 160 - struct host1x_syncpt *host1x_syncpt_request(struct device *dev, 160 + struct host1x_syncpt *host1x_syncpt_request(struct host1x_client *client, 161 161 unsigned long flags); 162 162 void host1x_syncpt_free(struct host1x_syncpt *sp); 163 163