Merge branch 'linux-2.6' into for-linus
[pandora-kernel.git] / arch / powerpc / platforms / cell / spufs / file.c
index 533e272..0ea2361 100644 (file)
@@ -1343,6 +1343,37 @@ static struct file_operations spufs_mfc_fops = {
        .mmap    = spufs_mfc_mmap,
 };
 
+
+static int spufs_recycle_open(struct inode *inode, struct file *file)
+{
+       file->private_data = SPUFS_I(inode)->i_ctx;
+       return nonseekable_open(inode, file);
+}
+
+static ssize_t spufs_recycle_write(struct file *file,
+               const char __user *buffer, size_t size, loff_t *pos)
+{
+       struct spu_context *ctx = file->private_data;
+       int ret;
+
+       if (!(ctx->flags & SPU_CREATE_ISOLATE))
+               return -EINVAL;
+
+       if (size < 1)
+               return -EINVAL;
+
+       ret = spu_recycle_isolated(ctx);
+
+       if (ret)
+               return ret;
+       return size;
+}
+
+static struct file_operations spufs_recycle_fops = {
+       .open    = spufs_recycle_open,
+       .write   = spufs_recycle_write,
+};
+
 static void spufs_npc_set(void *data, u64 val)
 {
        struct spu_context *ctx = data;
@@ -1531,3 +1562,26 @@ struct tree_descr spufs_dir_contents[] = {
        { "object-id", &spufs_object_id_ops, 0666, },
        {},
 };
+
+struct tree_descr spufs_dir_nosched_contents[] = {
+       { "mem",  &spufs_mem_fops,  0666, },
+       { "mbox", &spufs_mbox_fops, 0444, },
+       { "ibox", &spufs_ibox_fops, 0444, },
+       { "wbox", &spufs_wbox_fops, 0222, },
+       { "mbox_stat", &spufs_mbox_stat_fops, 0444, },
+       { "ibox_stat", &spufs_ibox_stat_fops, 0444, },
+       { "wbox_stat", &spufs_wbox_stat_fops, 0444, },
+       { "signal1", &spufs_signal1_fops, 0666, },
+       { "signal2", &spufs_signal2_fops, 0666, },
+       { "signal1_type", &spufs_signal1_type, 0666, },
+       { "signal2_type", &spufs_signal2_type, 0666, },
+       { "mss", &spufs_mss_fops, 0666, },
+       { "mfc", &spufs_mfc_fops, 0666, },
+       { "cntl", &spufs_cntl_fops,  0666, },
+       { "npc", &spufs_npc_ops, 0666, },
+       { "psmap", &spufs_psmap_fops, 0666, },
+       { "phys-id", &spufs_id_ops, 0666, },
+       { "object-id", &spufs_object_id_ops, 0666, },
+       { "recycle", &spufs_recycle_fops, 0222, },
+       {},
+};