Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=aa45e2569ffe963dfbbbfddfdccd12afe69b2d65
Commit:     aa45e2569ffe963dfbbbfddfdccd12afe69b2d65
Parent:     fe8a29db5bce1b5bd1ceb85fd153fac52cdab7b2
Author:     Christoph Hellwig <[EMAIL PROTECTED]>
AuthorDate: Mon Apr 23 21:08:27 2007 +0200
Committer:  Arnd Bergmann <[EMAIL PROTECTED]>
CommitDate: Mon Apr 23 21:18:59 2007 +0200

    [POWERPC] spufs: various run.c cleanups
    
     - remove the spu_acquire_runnable from spu_run_init.  I need to
       opencode it in spufs_run_spu in the next patch
     - remove various inline attributes, we don't really want to inline
       long functions with multiple callsites
     - cleanup return values and runcntl_write calls in spu_run_init
     - use normal kernel codingstyle in spu_reacquire_runnable
    
    Signed-off-by: Christoph Hellwig <[EMAIL PROTECTED]>
    Signed-off-by: Arnd Bergmann <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/cell/spufs/run.c |   51 +++++++++++++++++++------------
 1 files changed, 31 insertions(+), 20 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/run.c 
b/arch/powerpc/platforms/cell/spufs/run.c
index b5e7bde..5762660 100644
--- a/arch/powerpc/platforms/cell/spufs/run.c
+++ b/arch/powerpc/platforms/cell/spufs/run.c
@@ -123,20 +123,15 @@ out:
        return ret;
 }
 
-static inline int spu_run_init(struct spu_context *ctx, u32 * npc)
+static int spu_run_init(struct spu_context *ctx, u32 * npc)
 {
-       int ret;
-       unsigned long runcntl = SPU_RUNCNTL_RUNNABLE;
-
-       ret = spu_acquire_runnable(ctx, 0);
-       if (ret)
-               return ret;
-
        if (ctx->flags & SPU_CREATE_ISOLATE) {
+               unsigned long runcntl;
+
                if (!(ctx->ops->status_read(ctx) & SPU_STATUS_ISOLATED_STATE)) {
-                       ret = spu_setup_isolated(ctx);
+                       int ret = spu_setup_isolated(ctx);
                        if (ret)
-                               spu_release(ctx);
+                               return ret;
                }
 
                /* if userspace has set the runcntrl register (eg, to issue an
@@ -145,16 +140,17 @@ static inline int spu_run_init(struct spu_context *ctx, 
u32 * npc)
                        (SPU_RUNCNTL_RUNNABLE | SPU_RUNCNTL_ISOLATE);
                if (runcntl == 0)
                        runcntl = SPU_RUNCNTL_RUNNABLE;
+               ctx->ops->runcntl_write(ctx, runcntl);
        } else {
                spu_start_tick(ctx);
                ctx->ops->npc_write(ctx, *npc);
+               ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_RUNNABLE);
        }
 
-       ctx->ops->runcntl_write(ctx, runcntl);
-       return ret;
+       return 0;
 }
 
-static inline int spu_run_fini(struct spu_context *ctx, u32 * npc,
+static int spu_run_fini(struct spu_context *ctx, u32 * npc,
                               u32 * status)
 {
        int ret = 0;
@@ -170,19 +166,27 @@ static inline int spu_run_fini(struct spu_context *ctx, 
u32 * npc,
        return ret;
 }
 
-static inline int spu_reacquire_runnable(struct spu_context *ctx, u32 *npc,
+static int spu_reacquire_runnable(struct spu_context *ctx, u32 *npc,
                                         u32 *status)
 {
        int ret;
 
-       if ((ret = spu_run_fini(ctx, npc, status)) != 0)
+       ret = spu_run_fini(ctx, npc, status);
+       if (ret)
                return ret;
-       if (*status & (SPU_STATUS_STOPPED_BY_STOP |
-                      SPU_STATUS_STOPPED_BY_HALT)) {
+
+       if (*status & (SPU_STATUS_STOPPED_BY_STOP | SPU_STATUS_STOPPED_BY_HALT))
                return *status;
-       }
-       if ((ret = spu_run_init(ctx, npc)) != 0)
+
+       ret = spu_acquire_runnable(ctx, 0);
+       if (ret)
                return ret;
+
+       ret = spu_run_init(ctx, npc);
+       if (ret) {
+               spu_release(ctx);
+               return ret;
+       }
        return 0;
 }
 
@@ -293,9 +297,16 @@ long spufs_run_spu(struct file *file, struct spu_context 
*ctx,
 
        ctx->ops->master_start(ctx);
        ctx->event_return = 0;
-       ret = spu_run_init(ctx, npc);
+
+       ret = spu_acquire_runnable(ctx, 0);
        if (ret)
+               return ret;
+
+       ret = spu_run_init(ctx, npc);
+       if (ret) {
+               spu_release(ctx);
                goto out;
+       }
 
        do {
                ret = spufs_wait(ctx->stop_wq, spu_stopped(ctx, &status));
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to