From: Geert.Uytterhoeven@sonycom.com
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>,
linuxppc-dev@ozlabs.org, linux-fbdev-devel@lists.sourceforge.net
Subject: [patch 2/4] ps3av: thread updates
Date: Thu, 15 Feb 2007 16:23:03 +0100 [thread overview]
Message-ID: <20070215152432.363210000@sonycom.com> (raw)
In-Reply-To: 20070215152301.573853000@sonycom.com
[-- Attachment #1: ps3-wip/ps3av-workqueue.diff --]
[-- Type: text/plain, Size: 3233 bytes --]
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>
---
drivers/ps3/ps3av.c | 30 ++++++++++++++----------------
include/asm-powerpc/ps3av.h | 5 +++--
2 files changed, 17 insertions(+), 18 deletions(-)
--- ps3-linux-2.6.20.orig/drivers/ps3/ps3av.c
+++ ps3-linux-2.6.20/drivers/ps3/ps3av.c
@@ -438,7 +438,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;
}
@@ -513,18 +513,10 @@ static void ps3av_set_videomode_cont(u32
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)
@@ -723,7 +715,7 @@ int ps3av_set_video_mode(u32 id, int boo
}
/* 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())
@@ -879,12 +871,16 @@ static int ps3av_probe(struct ps3_vuart_
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()) {
@@ -924,6 +920,8 @@ static int ps3av_remove(struct ps3_vuart
{
if (ps3av.available) {
ps3av_cmd_fin();
+ if (ps3av.wq)
+ destroy_workqueue(ps3av.wq);
ps3av.available = 0;
}
--- ps3-linux-2.6.20.orig/include/asm-powerpc/ps3av.h
+++ ps3-linux-2.6.20/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;
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- Sony Network and Software Technology Center Europe (NSCE)
Geert.Uytterhoeven@sonycom.com ------- The Corporate Village, Da Vincilaan 7-D1
Voice +32-2-7008453 Fax +32-2-7008622 ---------------- B-1935 Zaventem, Belgium
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
next prev parent reply other threads:[~2007-02-15 15:26 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-15 15:23 [patch 0/4] PS3 AV/FB updates Geert.Uytterhoeven
2007-02-15 15:23 ` [patch 1/4] ps3fb: thread updates Geert.Uytterhoeven
2007-02-15 17:50 ` Christoph Hellwig
2007-02-15 21:43 ` Benjamin Herrenschmidt
2007-02-16 0:59 ` Andrew Morton
2007-02-16 15:58 ` Geert Uytterhoeven
2007-02-16 16:00 ` [PATCH 1/4 (updated)] " Geert Uytterhoeven
2007-02-16 16:38 ` Christoph Hellwig
2007-02-16 17:33 ` Geert Uytterhoeven
2007-02-19 14:07 ` [Linux-fbdev-devel] " Geert Uytterhoeven
2007-02-20 10:33 ` Geert Uytterhoeven
2007-02-20 10:42 ` [PATCH 1/4 (final?)] " Geert Uytterhoeven
2007-02-21 23:20 ` Andrew Morton
2007-02-22 8:21 ` Geert Uytterhoeven
2007-02-22 12:16 ` Geert Uytterhoeven
2007-02-22 12:17 ` [PATCH 1/4 (final)] " Geert Uytterhoeven
2007-02-16 16:03 ` [PATCH extra] ps3fb: atomic fixes Geert Uytterhoeven
2007-02-16 16:36 ` [patch 1/4] ps3fb: thread updates Christoph Hellwig
2007-02-15 15:23 ` Geert.Uytterhoeven [this message]
2007-02-15 15:23 ` [patch 3/4] ps3fb: kill superfluous zero initializations Geert.Uytterhoeven
2007-02-15 15:23 ` [patch 4/4] ps3av: misc updates Geert.Uytterhoeven
2007-02-15 15:48 ` [patch 0/4] PS3 AV/FB updates James Simmons
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070215152432.363210000@sonycom.com \
--to=geert.uytterhoeven@sonycom.com \
--cc=akpm@linux-foundation.org \
--cc=linux-fbdev-devel@lists.sourceforge.net \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).