projects/linux·commit 3eac2e95

gru: support contexts with zero dsrs or cbrs

3eac2e95 · Jack Steiner <[email protected]> · 2009-06-17 16:28:23 -07:00

Support alocation of GRU contexts that contain zero DSR or CBR resources.
Some instructions do not require DSR resources.  Contexts without CBR
resources are useful for diagnostics.

Signed-off-by: Jack Steiner <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Commit
3eac2e95d7bb92222e185e445eca1fe3f695050f
Parents
836ce679

Changes

2 files changed · +4 −6

FileStatusAddDelContent
drivers/misc/sgi-gru/grufile.cmodified+2−4View file
drivers/misc/sgi-gru/grumain.cmodified+2−2View file

drivers/misc/sgi-gru/grufile.c

View file
diff --git a/drivers/misc/sgi-gru/grufile.c b/drivers/misc/sgi-gru/grufile.c
index 9e6da46..b1567ce 100644
--- a/drivers/misc/sgi-gru/grufile.c
+++ b/drivers/misc/sgi-gru/grufile.c
@@ -135,11 +135,9 @@ static int gru_create_new_context(unsigned long arg)
if (copy_from_user(&req, (void __user *)arg, sizeof(req)))
return -EFAULT;
- if (req.data_segment_bytes == 0 ||
- req.data_segment_bytes > max_user_dsr_bytes)
+ if (req.data_segment_bytes > max_user_dsr_bytes)
return -EINVAL;
- if (!req.control_blocks || !req.maximum_thread_count ||
- req.control_blocks > max_user_cbrs)
+ if (req.control_blocks > max_user_cbrs || !req.maximum_thread_count)
return -EINVAL;
if (!(req.options & GRU_OPT_MISS_MASK))

drivers/misc/sgi-gru/grumain.c

View file
diff --git a/drivers/misc/sgi-gru/grumain.c b/drivers/misc/sgi-gru/grumain.c
index 3398e54..4e6e8c3 100644
--- a/drivers/misc/sgi-gru/grumain.c
+++ b/drivers/misc/sgi-gru/grumain.c
@@ -150,7 +150,7 @@ static unsigned long reserve_resources(unsigned long *p, int n, int mmax,
unsigned long bits = 0;
int i;
- do {
+ while (n--) {
i = find_first_bit(p, mmax);
if (i == mmax)
BUG();
@@ -158,7 +158,7 @@ static unsigned long reserve_resources(unsigned long *p, int n, int mmax,
__set_bit(i, &bits);
if (idx)
*idx++ = i;
- } while (--n);
+ }
return bits;
}