From: Komal Shah Date: Tue, 28 Mar 2006 15:00:26 +0000 (-0800) Subject: [PATCH] ARM: OMAP: OSS: sem2mutex conversion X-Git-Tag: v2.6.16-omap1~8 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=97c095d2e9b77bfa3862f103fdad6d1ebbc6f690;p=linux-2.6-omap-h63xx.git [PATCH] ARM: OMAP: OSS: sem2mutex conversion sem2mutex conversion Signed-off-by: Komal Shah Signed-off-by: Tony Lindgren --- diff --git a/sound/oss/omap-audio-tsc2101.c b/sound/oss/omap-audio-tsc2101.c index 13dc7aff1ab..f8e6dacf1ff 100644 --- a/sound/oss/omap-audio-tsc2101.c +++ b/sound/oss/omap-audio-tsc2101.c @@ -33,8 +33,8 @@ #include #include #include +#include -#include #include #include #include @@ -326,7 +326,7 @@ static audio_state_t tsc2101_state = { .hw_remove = omap_tsc2101_remove, .hw_suspend = omap_tsc2101_suspend, .hw_resume = omap_tsc2101_resume, - .sem = __SEMAPHORE_INIT(tsc2101_state.sem, 1), + .mutex = __MUTEX_INITIALIZER(tsc2101_state.mutex), }; /* This will be defined in the Audio.h */ diff --git a/sound/oss/omap-audio.c b/sound/oss/omap-audio.c index 38857007e70..cc1f14a2d29 100644 --- a/sound/oss/omap-audio.c +++ b/sound/oss/omap-audio.c @@ -46,11 +46,11 @@ #include #include #include +#include #include #include #include -#include #include "omap-audio-dma-intfc.h" #include "omap-audio.h" @@ -438,7 +438,7 @@ int audio_register_codec(audio_state_t * codec_state) } memcpy(&audio_state, codec_state, sizeof(audio_state_t)); - sema_init(&audio_state.sem, 1); + mutex_init(&audio_state.mutex); ret = platform_device_register(&omap_audio_device); if (ret != 0) { @@ -1024,7 +1024,7 @@ static int audio_open(struct inode *inode, struct file *file) return -ESTALE; } - down(&state->sem); + mutex_lock(&state->mutex); /* access control */ err = -ENODEV; @@ -1092,7 +1092,7 @@ static int audio_open(struct inode *inode, struct file *file) err = 0; out: - up(&state->sem); + mutex_unlock(&state->mutex); if (err) { module_put(state->owner); module_put(THIS_MODULE); @@ -1114,7 +1114,7 @@ static int audio_release(struct inode *inode, struct file *file) FN_IN; - down(&state->sem); + mutex_lock(&state->mutex); if (file->f_mode & FMODE_READ) { audio_discard_buf(is); @@ -1145,7 +1145,7 @@ static int audio_release(struct inode *inode, struct file *file) state->hw_shutdown(state->data); } - up(&state->sem); + mutex_unlock(&state->mutex); module_put(state->owner); module_put(THIS_MODULE); diff --git a/sound/oss/omap-audio.h b/sound/oss/omap-audio.h index 58eff3130c3..c039dee3b14 100644 --- a/sound/oss/omap-audio.h +++ b/sound/oss/omap-audio.h @@ -101,7 +101,7 @@ typedef struct { int (*hw_suspend) (void); int (*hw_resume) (void); struct pm_dev *pm_dev; - struct semaphore sem; /* to protect against races in attach() */ + struct mutex mutex; /* to protect against races in attach() */ } audio_state_t; #ifdef AUDIO_PM