Commit 97c095d2 authored by Komal Shah's avatar Komal Shah Committed by Tony Lindgren

[PATCH] ARM: OMAP: OSS: sem2mutex conversion

sem2mutex conversion
Signed-off-by: default avatarKomal Shah <komal_shah802003@yahoo.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 9c926661
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/sound.h> #include <linux/sound.h>
#include <linux/soundcard.h> #include <linux/soundcard.h>
#include <linux/mutex.h>
#include <asm/semaphore.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/arch/dma.h> #include <asm/arch/dma.h>
...@@ -326,7 +326,7 @@ static audio_state_t tsc2101_state = { ...@@ -326,7 +326,7 @@ static audio_state_t tsc2101_state = {
.hw_remove = omap_tsc2101_remove, .hw_remove = omap_tsc2101_remove,
.hw_suspend = omap_tsc2101_suspend, .hw_suspend = omap_tsc2101_suspend,
.hw_resume = omap_tsc2101_resume, .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 */ /* This will be defined in the Audio.h */
......
...@@ -46,11 +46,11 @@ ...@@ -46,11 +46,11 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/mutex.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/semaphore.h>
#include "omap-audio-dma-intfc.h" #include "omap-audio-dma-intfc.h"
#include "omap-audio.h" #include "omap-audio.h"
...@@ -438,7 +438,7 @@ int audio_register_codec(audio_state_t * codec_state) ...@@ -438,7 +438,7 @@ int audio_register_codec(audio_state_t * codec_state)
} }
memcpy(&audio_state, codec_state, sizeof(audio_state_t)); 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); ret = platform_device_register(&omap_audio_device);
if (ret != 0) { if (ret != 0) {
...@@ -1024,7 +1024,7 @@ static int audio_open(struct inode *inode, struct file *file) ...@@ -1024,7 +1024,7 @@ static int audio_open(struct inode *inode, struct file *file)
return -ESTALE; return -ESTALE;
} }
down(&state->sem); mutex_lock(&state->mutex);
/* access control */ /* access control */
err = -ENODEV; err = -ENODEV;
...@@ -1092,7 +1092,7 @@ static int audio_open(struct inode *inode, struct file *file) ...@@ -1092,7 +1092,7 @@ static int audio_open(struct inode *inode, struct file *file)
err = 0; err = 0;
out: out:
up(&state->sem); mutex_unlock(&state->mutex);
if (err) { if (err) {
module_put(state->owner); module_put(state->owner);
module_put(THIS_MODULE); module_put(THIS_MODULE);
...@@ -1114,7 +1114,7 @@ static int audio_release(struct inode *inode, struct file *file) ...@@ -1114,7 +1114,7 @@ static int audio_release(struct inode *inode, struct file *file)
FN_IN; FN_IN;
down(&state->sem); mutex_lock(&state->mutex);
if (file->f_mode & FMODE_READ) { if (file->f_mode & FMODE_READ) {
audio_discard_buf(is); audio_discard_buf(is);
...@@ -1145,7 +1145,7 @@ static int audio_release(struct inode *inode, struct file *file) ...@@ -1145,7 +1145,7 @@ static int audio_release(struct inode *inode, struct file *file)
state->hw_shutdown(state->data); state->hw_shutdown(state->data);
} }
up(&state->sem); mutex_unlock(&state->mutex);
module_put(state->owner); module_put(state->owner);
module_put(THIS_MODULE); module_put(THIS_MODULE);
......
...@@ -101,7 +101,7 @@ typedef struct { ...@@ -101,7 +101,7 @@ typedef struct {
int (*hw_suspend) (void); int (*hw_suspend) (void);
int (*hw_resume) (void); int (*hw_resume) (void);
struct pm_dev *pm_dev; 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; } audio_state_t;
#ifdef AUDIO_PM #ifdef AUDIO_PM
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment