Linux 2.6.31.6
[linux/fpc-iii.git] / arch / powerpc / platforms / cell / spu_notify.c
blob34d156959f39943c4984a4d9fc2c4775340a81e4
1 /*
2 * Move OProfile dependencies from spufs module to the kernel so it
3 * can run on non-cell PPC.
5 * Copyright (C) IBM 2005
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #undef DEBUG
24 #include <linux/module.h>
25 #include <asm/spu.h>
26 #include "spufs/spufs.h"
28 static BLOCKING_NOTIFIER_HEAD(spu_switch_notifier);
30 void spu_switch_notify(struct spu *spu, struct spu_context *ctx)
32 blocking_notifier_call_chain(&spu_switch_notifier,
33 ctx ? ctx->object_id : 0, spu);
35 EXPORT_SYMBOL_GPL(spu_switch_notify);
37 int spu_switch_event_register(struct notifier_block *n)
39 int ret;
40 ret = blocking_notifier_chain_register(&spu_switch_notifier, n);
41 if (!ret)
42 notify_spus_active();
43 return ret;
45 EXPORT_SYMBOL_GPL(spu_switch_event_register);
47 int spu_switch_event_unregister(struct notifier_block *n)
49 return blocking_notifier_chain_unregister(&spu_switch_notifier, n);
51 EXPORT_SYMBOL_GPL(spu_switch_event_unregister);
53 void spu_set_profile_private_kref(struct spu_context *ctx,
54 struct kref *prof_info_kref,
55 void (* prof_info_release) (struct kref *kref))
57 ctx->prof_priv_kref = prof_info_kref;
58 ctx->prof_priv_release = prof_info_release;
60 EXPORT_SYMBOL_GPL(spu_set_profile_private_kref);
62 void *spu_get_profile_private_kref(struct spu_context *ctx)
64 return ctx->prof_priv_kref;
66 EXPORT_SYMBOL_GPL(spu_get_profile_private_kref);