aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/cell/spufs/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs/file.c')
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 2a2dd6441010..c0cf9ee4d45f 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -723,19 +723,27 @@ static ssize_t spufs_signal1_read(struct file *file, char __user *buf,
723 size_t len, loff_t *pos) 723 size_t len, loff_t *pos)
724{ 724{
725 struct spu_context *ctx = file->private_data; 725 struct spu_context *ctx = file->private_data;
726 int ret = 0;
726 u32 data; 727 u32 data;
727 728
728 if (len < 4) 729 if (len < 4)
729 return -EINVAL; 730 return -EINVAL;
730 731
731 spu_acquire(ctx); 732 spu_acquire_saved(ctx);
732 data = ctx->ops->signal1_read(ctx); 733 if (ctx->csa.spu_chnlcnt_RW[3]) {
734 data = ctx->csa.spu_chnldata_RW[3];
735 ret = 4;
736 }
733 spu_release(ctx); 737 spu_release(ctx);
734 738
739 if (!ret)
740 goto out;
741
735 if (copy_to_user(buf, &data, 4)) 742 if (copy_to_user(buf, &data, 4))
736 return -EFAULT; 743 return -EFAULT;
737 744
738 return 4; 745out:
746 return ret;
739} 747}
740 748
741static ssize_t spufs_signal1_write(struct file *file, const char __user *buf, 749static ssize_t spufs_signal1_write(struct file *file, const char __user *buf,
@@ -811,21 +819,27 @@ static int spufs_signal2_open(struct inode *inode, struct file *file)
811static ssize_t spufs_signal2_read(struct file *file, char __user *buf, 819static ssize_t spufs_signal2_read(struct file *file, char __user *buf,
812 size_t len, loff_t *pos) 820 size_t len, loff_t *pos)
813{ 821{
814 struct spu_context *ctx; 822 struct spu_context *ctx = file->private_data;
823 int ret = 0;
815 u32 data; 824 u32 data;
816 825
817 ctx = file->private_data;
818
819 if (len < 4) 826 if (len < 4)
820 return -EINVAL; 827 return -EINVAL;
821 828
822 spu_acquire(ctx); 829 spu_acquire_saved(ctx);
823 data = ctx->ops->signal2_read(ctx); 830 if (ctx->csa.spu_chnlcnt_RW[4]) {
831 data = ctx->csa.spu_chnldata_RW[4];
832 ret = 4;
833 }
824 spu_release(ctx); 834 spu_release(ctx);
825 835
836 if (!ret)
837 goto out;
838
826 if (copy_to_user(buf, &data, 4)) 839 if (copy_to_user(buf, &data, 4))
827 return -EFAULT; 840 return -EFAULT;
828 841
842out:
829 return 4; 843 return 4;
830} 844}
831 845