cregit-Linux how code gets into the kernel

Release 4.14 arch/powerpc/platforms/cell/spufs/gang.c

/*
 * SPU file system
 *
 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
 *
 * Author: Arnd Bergmann <arndb@de.ibm.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * 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.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <linux/list.h>
#include <linux/slab.h>

#include "spufs.h"


struct spu_gang *alloc_spu_gang(void) { struct spu_gang *gang; gang = kzalloc(sizeof *gang, GFP_KERNEL); if (!gang) goto out; kref_init(&gang->kref); mutex_init(&gang->mutex); mutex_init(&gang->aff_mutex); INIT_LIST_HEAD(&gang->list); INIT_LIST_HEAD(&gang->aff_list_head); out: return gang; }

Contributors

PersonTokensPropCommitsCommitProp
Arnd Bergmann78100.00%2100.00%
Total78100.00%2100.00%


static void destroy_spu_gang(struct kref *kref) { struct spu_gang *gang; gang = container_of(kref, struct spu_gang, kref); WARN_ON(gang->contexts || !list_empty(&gang->list)); kfree(gang); }

Contributors

PersonTokensPropCommitsCommitProp
Arnd Bergmann49100.00%1100.00%
Total49100.00%1100.00%


struct spu_gang *get_spu_gang(struct spu_gang *gang) { kref_get(&gang->kref); return gang; }

Contributors

PersonTokensPropCommitsCommitProp
Arnd Bergmann23100.00%1100.00%
Total23100.00%1100.00%


int put_spu_gang(struct spu_gang *gang) { return kref_put(&gang->kref, &destroy_spu_gang); }

Contributors

PersonTokensPropCommitsCommitProp
Arnd Bergmann22100.00%1100.00%
Total22100.00%1100.00%


void spu_gang_add_ctx(struct spu_gang *gang, struct spu_context *ctx) { mutex_lock(&gang->mutex); ctx->gang = get_spu_gang(gang); list_add(&ctx->gang_list, &gang->list); gang->contexts++; mutex_unlock(&gang->mutex); }

Contributors

PersonTokensPropCommitsCommitProp
Arnd Bergmann58100.00%1100.00%
Total58100.00%1100.00%


void spu_gang_remove_ctx(struct spu_gang *gang, struct spu_context *ctx) { mutex_lock(&gang->mutex); WARN_ON(ctx->gang != gang); if (!list_empty(&ctx->aff_list)) { list_del_init(&ctx->aff_list); gang->aff_flags &= ~AFF_OFFSETS_SET; } list_del_init(&ctx->gang_list); gang->contexts--; mutex_unlock(&gang->mutex); put_spu_gang(gang); }

Contributors

PersonTokensPropCommitsCommitProp
Arnd Bergmann86100.00%3100.00%
Total86100.00%3100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
Arnd Bergmann326100.00%3100.00%
Total326100.00%3100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.