summaryrefslogtreecommitdiff
path: root/drivers/misc/sgi-gru/grukservices.c
diff options
context:
space:
mode:
authorJack Steiner <steiner@sgi.com>2009-12-15 16:48:02 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-16 07:20:14 -0800
commit091f1a10614db89a108cda980425799730d73d8a (patch)
tree1564f5eec330225cc652c9c89209d84898a7c653 /drivers/misc/sgi-gru/grukservices.c
parent827f02febfcdfb03bc056bf479a13b5bcb35dfd7 (diff)
gru: add comments raised in previous code reviews
Add comments from previous code reviews. The comments help explain some of the more esoteric aspects of the driver. Move a free() to the other side of an unlock. Signed-off-by: Jack Steiner <steiner@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/misc/sgi-gru/grukservices.c')
-rw-r--r--drivers/misc/sgi-gru/grukservices.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/misc/sgi-gru/grukservices.c b/drivers/misc/sgi-gru/grukservices.c
index d2b149facda1..306855cc80fe 100644
--- a/drivers/misc/sgi-gru/grukservices.c
+++ b/drivers/misc/sgi-gru/grukservices.c
@@ -200,13 +200,15 @@ static int gru_free_kernel_contexts(void)
bs = gru_base[bid];
if (!bs)
continue;
+
+ /* Ignore busy contexts. Don't want to block here. */
if (down_write_trylock(&bs->bs_kgts_sema)) {
kgts = bs->bs_kgts;
if (kgts && kgts->ts_gru)
gru_unload_context(kgts, 0);
- kfree(kgts);
bs->bs_kgts = NULL;
up_write(&bs->bs_kgts_sema);
+ kfree(kgts);
} else {
ret++;
}