Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5caf5db887b2bc87d74a78674d8e3e4774fa2a14
Commit:     5caf5db887b2bc87d74a78674d8e3e4774fa2a14
Parent:     eca28743b74736456bd75e0dabeb7d2df09fc03e
Author:     Geert Uytterhoeven <[EMAIL PROTECTED]>
AuthorDate: Wed May 2 14:48:33 2007 +0200
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Fri May 4 17:59:08 2007 -0700

    ps3av: thread updates
    
    ps3av: Replace the kernel_thread and the ping pong semaphores by a 
singlethread
    workqueue and a completion.
    
    Signed-off-by: Geert Uytterhoeven <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/ps3/ps3av.c         |   30 ++++++++++++++----------------
 include/asm-powerpc/ps3av.h |    5 +++--
 2 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/drivers/ps3/ps3av.c b/drivers/ps3/ps3av.c
index d21e04c..d318eab 100644
--- a/drivers/ps3/ps3av.c
+++ b/drivers/ps3/ps3av.c
@@ -440,7 +440,7 @@ static int ps3av_set_videomode(void)
        ps3av_set_av_video_mute(PS3AV_CMD_MUTE_ON);
 
        /* wake up ps3avd to do the actual video mode setting */
-       up(&ps3av.ping);
+       queue_work(ps3av.wq, &ps3av.work);
 
        return 0;
 }
@@ -515,18 +515,10 @@ static void ps3av_set_videomode_cont(u32 id, u32 old_id)
        ps3av_set_av_video_mute(PS3AV_CMD_MUTE_OFF);
 }
 
-static int ps3avd(void *p)
+static void ps3avd(struct work_struct *work)
 {
-       struct ps3av *info = p;
-
-       daemonize("ps3avd");
-       while (1) {
-               down(&info->ping);
-               ps3av_set_videomode_cont(info->ps3av_mode,
-                                        info->ps3av_mode_old);
-               up(&info->pong);
-       }
-       return 0;
+       ps3av_set_videomode_cont(ps3av.ps3av_mode, ps3av.ps3av_mode_old);
+       complete(&ps3av.done);
 }
 
 static int ps3av_vid2table_id(int vid)
@@ -725,7 +717,7 @@ int ps3av_set_video_mode(u32 id, int boot)
        }
 
        /* set videomode */
-       down(&ps3av.pong);
+       wait_for_completion(&ps3av.done);
        ps3av.ps3av_mode_old = ps3av.ps3av_mode;
        ps3av.ps3av_mode = id;
        if (ps3av_set_videomode())
@@ -881,12 +873,16 @@ static int ps3av_probe(struct ps3_vuart_port_device *dev)
        memset(&ps3av, 0, sizeof(ps3av));
 
        init_MUTEX(&ps3av.sem);
-       init_MUTEX_LOCKED(&ps3av.ping);
-       init_MUTEX(&ps3av.pong);
        mutex_init(&ps3av.mutex);
        ps3av.ps3av_mode = 0;
        ps3av.dev = dev;
-       kernel_thread(ps3avd, &ps3av, CLONE_KERNEL);
+
+       INIT_WORK(&ps3av.work, ps3avd);
+       init_completion(&ps3av.done);
+       complete(&ps3av.done);
+       ps3av.wq = create_singlethread_workqueue("ps3avd");
+       if (!ps3av.wq)
+               return -ENOMEM;
 
        ps3av.available = 1;
        switch (ps3_os_area_get_av_multi_out()) {
@@ -926,6 +922,8 @@ static int ps3av_remove(struct ps3_vuart_port_device *dev)
 {
        if (ps3av.available) {
                ps3av_cmd_fin();
+               if (ps3av.wq)
+                       destroy_workqueue(ps3av.wq);
                ps3av.available = 0;
        }
 
diff --git a/include/asm-powerpc/ps3av.h b/include/asm-powerpc/ps3av.h
index 43e90ea..5c1b989 100644
--- a/include/asm-powerpc/ps3av.h
+++ b/include/asm-powerpc/ps3av.h
@@ -646,8 +646,9 @@ struct ps3av_pkt_avb_param {
 struct ps3av {
        int available;
        struct semaphore sem;
-       struct semaphore ping;
-       struct semaphore pong;
+       struct work_struct work;
+       struct completion done;
+       struct workqueue_struct *wq;
        struct mutex mutex;
        int open_count;
        struct ps3_vuart_port_device *dev;
-
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