cregit-Linux how code gets into the kernel

Release 4.7 drivers/staging/android/sync.c

/*
 * drivers/base/sync.c
 *
 * Copyright (C) 2012 Google, Inc.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#include <linux/debugfs.h>
#include <linux/export.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/anon_inodes.h>

#include "sync.h"


#define CREATE_TRACE_POINTS
#include "trace/sync.h"


static const struct fence_ops android_fence_ops;


struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops, int size, const char *name) { struct sync_timeline *obj; if (size < sizeof(struct sync_timeline)) return NULL; obj = kzalloc(size, GFP_KERNEL); if (!obj) return NULL; kref_init(&obj->kref); obj->ops = ops; obj->context = fence_context_alloc(1); strlcpy(obj->name, name, sizeof(obj->name)); INIT_LIST_HEAD(&obj->child_list_head); INIT_LIST_HEAD(&obj->active_list_head); spin_lock_init(&obj->child_list_lock); sync_timeline_debug_add(obj); return obj; }

Contributors

PersonTokensPropCommitsCommitProp
erik gillingerik gilling11590.55%360.00%
maarten lankhorstmaarten lankhorst118.66%120.00%
ioana ciorneiioana ciornei10.79%120.00%
Total127100.00%5100.00%

EXPORT_SYMBOL(sync_timeline_create);
static void sync_timeline_free(struct kref *kref) { struct sync_timeline *obj = container_of(kref, struct sync_timeline, kref); sync_timeline_debug_remove(obj); kfree(obj); }

Contributors

PersonTokensPropCommitsCommitProp
erik gillingerik gilling3597.22%266.67%
maarten lankhorstmaarten lankhorst12.78%133.33%
Total36100.00%3100.00%


static void sync_timeline_get(struct sync_timeline *obj) { kref_get(&obj->kref); }

Contributors

PersonTokensPropCommitsCommitProp
maarten lankhorstmaarten lankhorst19100.00%1100.00%
Total19100.00%1100.00%


static void sync_timeline_put(struct sync_timeline *obj) { kref_put(&obj->kref, sync_timeline_free); }

Contributors

PersonTokensPropCommitsCommitProp
maarten lankhorstmaarten lankhorst21100.00%1100.00%
Total21100.00%1100.00%


void sync_timeline_destroy(struct sync_timeline *obj) { obj->destroyed = true; /* * Ensure timeline is marked as destroyed before * changing timeline's fences status. */ smp_wmb(); sync_timeline_put(obj); }

Contributors

PersonTokensPropCommitsCommitProp
erik gillingerik gilling2080.00%125.00%
prakash kamliyaprakash kamliya312.00%125.00%
niv yehezkelniv yehezkel14.00%125.00%
maarten lankhorstmaarten lankhorst14.00%125.00%
Total25100.00%4100.00%

EXPORT_SYMBOL(sync_timeline_destroy);
void sync_timeline_signal(struct sync_timeline *obj) { unsigned long flags; struct fence *fence, *next; trace_sync_timeline(obj); spin_lock_irqsave(&obj->child_list_lock, flags); list_for_each_entry_safe(fence, next, &obj->active_list_head, active_list) { if (fence_is_signaled_locked(fence)) list_del_init(&fence->active_list); } spin_unlock_irqrestore(&obj->child_list_lock, flags); }

Contributors

PersonTokensPropCommitsCommitProp
erik gillingerik gilling4054.05%125.00%
maarten lankhorstmaarten lankhorst2837.84%125.00%
gustavo padovangustavo padovan56.76%125.00%
alistair strachanalistair strachan11.35%125.00%
Total74100.00%4100.00%

EXPORT_SYMBOL(sync_timeline_signal);
struct fence *sync_pt_create(struct sync_timeline *obj, int size) { unsigned long flags; struct fence *fence; if (size < sizeof(*fence)) return NULL; fence = kzalloc(size, GFP_KERNEL); if (!fence) return NULL; spin_lock_irqsave(&obj->child_list_lock, flags); sync_timeline_get(obj); fence_init(fence, &android_fence_ops, &obj->child_list_lock, obj->context, ++obj->value); list_add_tail(&fence->child_list, &obj->child_list_head); INIT_LIST_HEAD(&fence->active_list); spin_unlock_irqrestore(&obj->child_list_lock, flags); return fence; }

Contributors

PersonTokensPropCommitsCommitProp
erik gillingerik gilling6249.60%350.00%
maarten lankhorstmaarten lankhorst5140.80%116.67%
gustavo padovangustavo padovan118.80%116.67%
ioana ciorneiioana ciornei10.80%116.67%
Total125100.00%6100.00%

EXPORT_SYMBOL(sync_pt_create);
static const char *android_fence_get_driver_name(struct fence *fence) { struct sync_timeline *parent = fence_parent(fence); return parent->ops->driver_name; }

Contributors

PersonTokensPropCommitsCommitProp
gustavo padovangustavo padovan1963.33%133.33%
erik gillingerik gilling1033.33%133.33%
maarten lankhorstmaarten lankhorst13.33%133.33%
Total30100.00%3100.00%


static const char *android_fence_get_timeline_name(struct fence *fence) { struct sync_timeline *parent = fence_parent(fence); return parent->name; }

Contributors

PersonTokensPropCommitsCommitProp
gustavo padovangustavo padovan2796.43%150.00%
maarten lankhorstmaarten lankhorst13.57%150.00%
Total28100.00%2100.00%


static void android_fence_release(struct fence *fence) { struct sync_timeline *parent = fence_parent(fence); unsigned long flags; spin_lock_irqsave(fence->lock, flags); list_del(&fence->child_list); if (WARN_ON_ONCE(!list_empty(&fence->active_list))) list_del(&fence->active_list); spin_unlock_irqrestore(fence->lock, flags); sync_timeline_put(parent); fence_free(fence); }

Contributors

PersonTokensPropCommitsCommitProp
gustavo padovangustavo padovan5971.08%120.00%
erik gillingerik gilling1416.87%360.00%
maarten lankhorstmaarten lankhorst1012.05%120.00%
Total83100.00%5100.00%


static bool android_fence_signaled(struct fence *fence) { struct sync_timeline *parent = fence_parent(fence); int ret; ret = parent->ops->has_signaled(fence); if (ret < 0) fence->status = ret; return ret; }

Contributors

PersonTokensPropCommitsCommitProp
gustavo padovangustavo padovan2958.00%133.33%
maarten lankhorstmaarten lankhorst1122.00%133.33%
erik gillingerik gilling1020.00%133.33%
Total50100.00%3100.00%


static bool android_fence_enable_signaling(struct fence *fence) { struct sync_timeline *parent = fence_parent(fence); if (android_fence_signaled(fence)) return false; list_add_tail(&fence->active_list, &parent->active_list_head); return true; }

Contributors

PersonTokensPropCommitsCommitProp
gustavo padovangustavo padovan2348.94%233.33%
maarten lankhorstmaarten lankhorst1225.53%233.33%
erik gillingerik gilling1225.53%233.33%
Total47100.00%6100.00%


static void android_fence_value_str(struct fence *fence, char *str, int size) { struct sync_timeline *parent = fence_parent(fence); if (!parent->ops->fence_value_str) { if (size) *str = 0; return; } parent->ops->fence_value_str(fence, str, size); }

Contributors

PersonTokensPropCommitsCommitProp
gustavo padovangustavo padovan3861.29%233.33%
erik gillingerik gilling1625.81%233.33%
maarten lankhorstmaarten lankhorst711.29%116.67%
rebecca schultz zavinrebecca schultz zavin11.61%116.67%
Total62100.00%6100.00%


static void android_fence_timeline_value_str(struct fence *fence, char *str, int size) { struct sync_timeline *parent = fence_parent(fence); if (!parent->ops->timeline_value_str) { if (size) *str = 0; return; } parent->ops->timeline_value_str(parent, str, size); }

Contributors

PersonTokensPropCommitsCommitProp
gustavo padovangustavo padovan4267.74%133.33%
erik gillingerik gilling1219.35%133.33%
maarten lankhorstmaarten lankhorst812.90%133.33%
Total62100.00%3100.00%

static const struct fence_ops android_fence_ops = { .get_driver_name = android_fence_get_driver_name, .get_timeline_name = android_fence_get_timeline_name, .enable_signaling = android_fence_enable_signaling, .signaled = android_fence_signaled, .wait = fence_default_wait, .release = android_fence_release, .fence_value_str = android_fence_value_str, .timeline_value_str = android_fence_timeline_value_str, };

Overall Contributors

PersonTokensPropCommitsCommitProp
erik gillingerik gilling41245.93%637.50%
gustavo padovangustavo padovan28331.55%318.75%
maarten lankhorstmaarten lankhorst19421.63%212.50%
prakash kamliyaprakash kamliya30.33%16.25%
ioana ciorneiioana ciornei20.22%16.25%
niv yehezkelniv yehezkel10.11%16.25%
rebecca schultz zavinrebecca schultz zavin10.11%16.25%
alistair strachanalistair strachan10.11%16.25%
Total897100.00%16100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
{% endraw %}