return 0;
}
+int nvhost_syncpt_get_ref(struct nvhost_syncpt *sp, u32 id)
+{
+ return atomic_inc_return(&sp->ref[id]);
+}
+
+int nvhost_syncpt_read_ref(struct nvhost_syncpt *sp, u32 id)
+{
+ return atomic_read(&sp->ref[id]);
+}
+
+void nvhost_syncpt_put_ref(struct nvhost_syncpt *sp, u32 id)
+{
+ WARN_ON(nvhost_syncpt_read_ref(sp, id) == 0);
+ if (atomic_dec_and_test(&sp->ref[id]))
+ nvhost_free_syncpt(id);
+}
+
+void nvhost_syncpt_put_ref_ext(u32 id)
+{
+ nvhost_syncpt_put_ref(&nvhost->syncpt, id);
+}
+EXPORT_SYMBOL_GPL(nvhost_syncpt_put_ref_ext);
+
int nvhost_syncpt_init(struct platform_device *dev,
struct nvhost_syncpt *sp)
{
sp->lock_counts =
kzalloc(sizeof(atomic_t) * nvhost_syncpt_nb_mlocks(sp),
GFP_KERNEL);
+ sp->ref = kzalloc(sizeof(atomic_t) * nb_pts, GFP_KERNEL);
#ifdef CONFIG_TEGRA_GRHOST_SYNC
sp->timeline = kzalloc(sizeof(struct nvhost_sync_timeline *) *
nb_pts, GFP_KERNEL);
sp->client_managed[i] = true;
sp->syncpt_names[i] = NULL;
sp->last_used_by[i] = NULL;
+ atomic_set(&sp->ref[i], 0);
#ifdef CONFIG_TEGRA_GRHOST_SYNC
sp->timeline[i] = nvhost_sync_timeline_create(sp, i);
kfree(sp->max_val);
sp->max_val = NULL;
+ kfree(sp->ref);
+ sp->ref = NULL;
+
kfree(sp->lock_counts);
sp->lock_counts = NULL;
atomic_t *min_val;
atomic_t *max_val;
atomic_t *lock_counts;
+ atomic_t *ref;
const char **syncpt_names;
const char **last_used_by;
struct nvhost_syncpt_attr *syncpt_attrs;
int nvhost_syncpt_mark_used(struct nvhost_syncpt *sp,
u32 chid, u32 syncptid);
+int nvhost_syncpt_get_ref(struct nvhost_syncpt *sp, u32 id);
+void nvhost_syncpt_put_ref(struct nvhost_syncpt *sp, u32 id);
+int nvhost_syncpt_read_ref(struct nvhost_syncpt *sp, u32 id);
+
#endif
u32 param);
u32 nvhost_get_syncpt_host_managed_by_name(const char *syncpt_name);
void nvhost_free_syncpt(u32 id);
+void nvhost_syncpt_put_ref_ext(u32 id);
const char *nvhost_syncpt_get_name(struct platform_device *dev, int id);
u32 nvhost_syncpt_incr_max_ext(struct platform_device *dev, u32 id, u32 incrs);
void nvhost_syncpt_cpu_incr_ext(struct platform_device *dev, u32 id);