Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 232045
b: refs/heads/master
c: 63c3b9d
h: refs/heads/master
i:
  232043: d4ddd22
v: v3
  • Loading branch information
Akinobu Mita authored and Benjamin Herrenschmidt committed Jan 21, 2011
1 parent c7de862 commit db913ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 06ca2188eccbd7932636ac5bde2837297800480e
refs/heads/master: 63c3b9d71bb66f4b62059713201f066ad9415bb5
27 changes: 7 additions & 20 deletions trunk/arch/powerpc/platforms/cell/spufs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,24 +219,17 @@ spufs_mem_write(struct file *file, const char __user *buffer,
loff_t pos = *ppos;
int ret;

if (pos < 0)
return -EINVAL;
if (pos > LS_SIZE)
return -EFBIG;
if (size > LS_SIZE - pos)
size = LS_SIZE - pos;

ret = spu_acquire(ctx);
if (ret)
return ret;

local_store = ctx->ops->get_ls(ctx);
ret = copy_from_user(local_store + pos, buffer, size);
size = simple_write_to_buffer(local_store, LS_SIZE, ppos, buffer, size);
spu_release(ctx);

if (ret)
return -EFAULT;
*ppos = pos + size;
return size;
}

Expand Down Expand Up @@ -574,18 +567,15 @@ spufs_regs_write(struct file *file, const char __user *buffer,
if (*pos >= sizeof(lscsa->gprs))
return -EFBIG;

size = min_t(ssize_t, sizeof(lscsa->gprs) - *pos, size);
*pos += size;

ret = spu_acquire_saved(ctx);
if (ret)
return ret;

ret = copy_from_user((char *)lscsa->gprs + *pos - size,
buffer, size) ? -EFAULT : size;
size = simple_write_to_buffer(lscsa->gprs, sizeof(lscsa->gprs), pos,
buffer, size);

spu_release_saved(ctx);
return ret;
return size;
}

static const struct file_operations spufs_regs_fops = {
Expand Down Expand Up @@ -630,18 +620,15 @@ spufs_fpcr_write(struct file *file, const char __user * buffer,
if (*pos >= sizeof(lscsa->fpcr))
return -EFBIG;

size = min_t(ssize_t, sizeof(lscsa->fpcr) - *pos, size);

ret = spu_acquire_saved(ctx);
if (ret)
return ret;

*pos += size;
ret = copy_from_user((char *)&lscsa->fpcr + *pos - size,
buffer, size) ? -EFAULT : size;
size = simple_write_to_buffer(&lscsa->fpcr, sizeof(lscsa->fpcr), pos,
buffer, size);

spu_release_saved(ctx);
return ret;
return size;
}

static const struct file_operations spufs_fpcr_fops = {
Expand Down

0 comments on commit db913ae

Please sign in to comment.