Skip to content

Commit 617dd7c

Browse files
committed
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>
1 parent 6a341fd commit 617dd7c

7 files changed

Lines changed: 14 additions & 14 deletions

File tree

‎drivers/gpu/drm/tegra/dc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1756,7 +1756,7 @@ static int tegra_dc_init(struct host1x_client *client)
17561756
struct drm_plane *cursor = NULL;
17571757
int err;
17581758

1759-
dc->syncpt = host1x_syncpt_request(dc->dev, flags);
1759+
dc->syncpt = host1x_syncpt_request(client, flags);
17601760
if (!dc->syncpt)
17611761
dev_warn(dc->dev, "failed to allocate syncpoint\n");
17621762

‎drivers/gpu/drm/tegra/gr2d.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static int gr2d_init(struct host1x_client *client)
3636
if (!gr2d->channel)
3737
return -ENOMEM;
3838

39-
client->syncpts[0] = host1x_syncpt_request(client->dev, flags);
39+
client->syncpts[0] = host1x_syncpt_request(client, flags);
4040
if (!client->syncpts[0]) {
4141
host1x_channel_put(gr2d->channel);
4242
return -ENOMEM;

‎drivers/gpu/drm/tegra/gr3d.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static int gr3d_init(struct host1x_client *client)
4646
if (!gr3d->channel)
4747
return -ENOMEM;
4848

49-
client->syncpts[0] = host1x_syncpt_request(client->dev, flags);
49+
client->syncpts[0] = host1x_syncpt_request(client, flags);
5050
if (!client->syncpts[0]) {
5151
host1x_channel_put(gr3d->channel);
5252
return -ENOMEM;

‎drivers/gpu/drm/tegra/vic.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static int vic_init(struct host1x_client *client)
167167
goto detach_device;
168168
}
169169

170-
client->syncpts[0] = host1x_syncpt_request(client->dev, 0);
170+
client->syncpts[0] = host1x_syncpt_request(client, 0);
171171
if (!client->syncpts[0]) {
172172
err = -ENOMEM;
173173
goto free_channel;

‎drivers/gpu/host1x/syncpt.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static void host1x_syncpt_base_free(struct host1x_syncpt_base *base)
5454
}
5555

5656
static struct host1x_syncpt *host1x_syncpt_alloc(struct host1x *host,
57-
struct device *dev,
57+
struct host1x_client *client,
5858
unsigned long flags)
5959
{
6060
int i;
@@ -76,11 +76,11 @@ static struct host1x_syncpt *host1x_syncpt_alloc(struct host1x *host,
7676
}
7777

7878
name = kasprintf(GFP_KERNEL, "%02u-%s", sp->id,
79-
dev ? dev_name(dev) : NULL);
79+
client ? dev_name(client->dev) : NULL);
8080
if (!name)
8181
goto free_base;
8282

83-
sp->dev = dev;
83+
sp->client = client;
8484
sp->name = name;
8585

8686
if (flags & HOST1X_SYNCPT_CLIENT_MANAGED)
@@ -419,20 +419,20 @@ int host1x_syncpt_init(struct host1x *host)
419419

420420
/**
421421
* host1x_syncpt_request() - request a syncpoint
422-
* @dev: device requesting the syncpoint
422+
* @client: client requesting the syncpoint
423423
* @flags: flags
424424
*
425425
* host1x client drivers can use this function to allocate a syncpoint for
426426
* subsequent use. A syncpoint returned by this function will be reserved for
427427
* use by the client exclusively. When no longer using a syncpoint, a host1x
428428
* client driver needs to release it using host1x_syncpt_free().
429429
*/
430-
struct host1x_syncpt *host1x_syncpt_request(struct device *dev,
430+
struct host1x_syncpt *host1x_syncpt_request(struct host1x_client *client,
431431
unsigned long flags)
432432
{
433-
struct host1x *host = dev_get_drvdata(dev->parent);
433+
struct host1x *host = dev_get_drvdata(client->parent->parent);
434434

435-
return host1x_syncpt_alloc(host, dev, flags);
435+
return host1x_syncpt_alloc(host, client, flags);
436436
}
437437
EXPORT_SYMBOL(host1x_syncpt_request);
438438

@@ -456,7 +456,7 @@ void host1x_syncpt_free(struct host1x_syncpt *sp)
456456
host1x_syncpt_base_free(sp->base);
457457
kfree(sp->name);
458458
sp->base = NULL;
459-
sp->dev = NULL;
459+
sp->client = NULL;
460460
sp->name = NULL;
461461
sp->client_managed = false;
462462

‎drivers/gpu/host1x/syncpt.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct host1x_syncpt {
4444
const char *name;
4545
bool client_managed;
4646
struct host1x *host;
47-
struct device *dev;
47+
struct host1x_client *client;
4848
struct host1x_syncpt_base *base;
4949

5050
/* interrupt data */

‎include/linux/host1x.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ int host1x_syncpt_incr(struct host1x_syncpt *sp);
157157
u32 host1x_syncpt_incr_max(struct host1x_syncpt *sp, u32 incrs);
158158
int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout,
159159
u32 *value);
160-
struct host1x_syncpt *host1x_syncpt_request(struct device *dev,
160+
struct host1x_syncpt *host1x_syncpt_request(struct host1x_client *client,
161161
unsigned long flags);
162162
void host1x_syncpt_free(struct host1x_syncpt *sp);
163163

0 commit comments

Comments
 (0)