aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ps3
diff options
context:
space:
mode:
authorGeert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>2007-05-02 08:48:33 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-04 20:59:08 -0400
commit5caf5db887b2bc87d74a78674d8e3e4774fa2a14 (patch)
tree4c718b1a7915df85fdeb2cbc47daddfbf66ab973 /drivers/ps3
parenteca28743b74736456bd75e0dabeb7d2df09fc03e (diff)
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 <Geert.Uytterhoeven@sonycom.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/ps3')
-rw-r--r--drivers/ps3/ps3av.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/drivers/ps3/ps3av.c b/drivers/ps3/ps3av.c
index d21e04ccb021..d318eabce3c3 100644
--- a/drivers/ps3/ps3av.c
+++ b/drivers/ps3/ps3av.c
@@ -440,7 +440,7 @@ static int ps3av_set_videomode(void)
440 ps3av_set_av_video_mute(PS3AV_CMD_MUTE_ON); 440 ps3av_set_av_video_mute(PS3AV_CMD_MUTE_ON);
441 441
442 /* wake up ps3avd to do the actual video mode setting */ 442 /* wake up ps3avd to do the actual video mode setting */
443 up(&ps3av.ping); 443 queue_work(ps3av.wq, &ps3av.work);
444 444
445 return 0; 445 return 0;
446} 446}
@@ -515,18 +515,10 @@ static void ps3av_set_videomode_cont(u32 id, u32 old_id)
515 ps3av_set_av_video_mute(PS3AV_CMD_MUTE_OFF); 515 ps3av_set_av_video_mute(PS3AV_CMD_MUTE_OFF);
516} 516}
517 517
518static int ps3avd(void *p) 518static void ps3avd(struct work_struct *work)
519{ 519{
520 struct ps3av *info = p; 520 ps3av_set_videomode_cont(ps3av.ps3av_mode, ps3av.ps3av_mode_old);
521 521 complete(&ps3av.done);
522 daemonize("ps3avd");
523 while (1) {
524 down(&info->ping);
525 ps3av_set_videomode_cont(info->ps3av_mode,
526 info->ps3av_mode_old);
527 up(&info->pong);
528 }
529 return 0;
530} 522}
531 523
532static int ps3av_vid2table_id(int vid) 524static int ps3av_vid2table_id(int vid)
@@ -725,7 +717,7 @@ int ps3av_set_video_mode(u32 id, int boot)
725 } 717 }
726 718
727 /* set videomode */ 719 /* set videomode */
728 down(&ps3av.pong); 720 wait_for_completion(&ps3av.done);
729 ps3av.ps3av_mode_old = ps3av.ps3av_mode; 721 ps3av.ps3av_mode_old = ps3av.ps3av_mode;
730 ps3av.ps3av_mode = id; 722 ps3av.ps3av_mode = id;
731 if (ps3av_set_videomode()) 723 if (ps3av_set_videomode())
@@ -881,12 +873,16 @@ static int ps3av_probe(struct ps3_vuart_port_device *dev)
881 memset(&ps3av, 0, sizeof(ps3av)); 873 memset(&ps3av, 0, sizeof(ps3av));
882 874
883 init_MUTEX(&ps3av.sem); 875 init_MUTEX(&ps3av.sem);
884 init_MUTEX_LOCKED(&ps3av.ping);
885 init_MUTEX(&ps3av.pong);
886 mutex_init(&ps3av.mutex); 876 mutex_init(&ps3av.mutex);
887 ps3av.ps3av_mode = 0; 877 ps3av.ps3av_mode = 0;
888 ps3av.dev = dev; 878 ps3av.dev = dev;
889 kernel_thread(ps3avd, &ps3av, CLONE_KERNEL); 879
880 INIT_WORK(&ps3av.work, ps3avd);
881 init_completion(&ps3av.done);
882 complete(&ps3av.done);
883 ps3av.wq = create_singlethread_workqueue("ps3avd");
884 if (!ps3av.wq)
885 return -ENOMEM;
890 886
891 ps3av.available = 1; 887 ps3av.available = 1;
892 switch (ps3_os_area_get_av_multi_out()) { 888 switch (ps3_os_area_get_av_multi_out()) {
@@ -926,6 +922,8 @@ static int ps3av_remove(struct ps3_vuart_port_device *dev)
926{ 922{
927 if (ps3av.available) { 923 if (ps3av.available) {
928 ps3av_cmd_fin(); 924 ps3av_cmd_fin();
925 if (ps3av.wq)
926 destroy_workqueue(ps3av.wq);
929 ps3av.available = 0; 927 ps3av.available = 0;
930 } 928 }
931 929