Path: blob/master/arch/powerpc/platforms/cell/spu_notify.c
10818 views
/*1* Move OProfile dependencies from spufs module to the kernel so it2* can run on non-cell PPC.3*4* Copyright (C) IBM 20055*6* This program is free software; you can redistribute it and/or modify7* it under the terms of the GNU General Public License as published by8* the Free Software Foundation; either version 2, or (at your option)9* any later version.10*11* This program is distributed in the hope that it will be useful,12* but WITHOUT ANY WARRANTY; without even the implied warranty of13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14* GNU General Public License for more details.15*16* You should have received a copy of the GNU General Public License17* along with this program; if not, write to the Free Software18* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.19*/2021#undef DEBUG2223#include <linux/module.h>24#include <asm/spu.h>25#include "spufs/spufs.h"2627static BLOCKING_NOTIFIER_HEAD(spu_switch_notifier);2829void spu_switch_notify(struct spu *spu, struct spu_context *ctx)30{31blocking_notifier_call_chain(&spu_switch_notifier,32ctx ? ctx->object_id : 0, spu);33}34EXPORT_SYMBOL_GPL(spu_switch_notify);3536int spu_switch_event_register(struct notifier_block *n)37{38int ret;39ret = blocking_notifier_chain_register(&spu_switch_notifier, n);40if (!ret)41notify_spus_active();42return ret;43}44EXPORT_SYMBOL_GPL(spu_switch_event_register);4546int spu_switch_event_unregister(struct notifier_block *n)47{48return blocking_notifier_chain_unregister(&spu_switch_notifier, n);49}50EXPORT_SYMBOL_GPL(spu_switch_event_unregister);5152void spu_set_profile_private_kref(struct spu_context *ctx,53struct kref *prof_info_kref,54void (* prof_info_release) (struct kref *kref))55{56ctx->prof_priv_kref = prof_info_kref;57ctx->prof_priv_release = prof_info_release;58}59EXPORT_SYMBOL_GPL(spu_set_profile_private_kref);6061void *spu_get_profile_private_kref(struct spu_context *ctx)62{63return ctx->prof_priv_kref;64}65EXPORT_SYMBOL_GPL(spu_get_profile_private_kref);66676869