diff options
| author | Matthias Kaehlcke <matthias@kaehlcke.net> | 2008-06-09 19:24:08 -0400 |
|---|---|---|
| committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-07-03 11:39:56 -0400 |
| commit | d41d219e8154885105d631661e5a86ba6461fb81 (patch) | |
| tree | ed7bc6400ae2870143af9359ba6baa0b02e38711 | |
| parent | 3c093f9f182eef6a8dc535f2c62b36a0320d0db1 (diff) | |
[ARM] OMAP1: N770: Convert audio_pwr_sem in a mutex
ARM: OMAP1: N770: The semaphore audio_pwr_sem is used as a
mutex. Convert it to the mutex API
[akpm@linux-foundation.org: include mutex.h]
Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
Cc: Tony Lindgren <tony@atomide.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
| -rw-r--r-- | arch/arm/mach-omap1/board-nokia770.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c index bcb984f2300f..3f39e0e79c9f 100644 --- a/arch/arm/mach-omap1/board-nokia770.c +++ b/arch/arm/mach-omap1/board-nokia770.c | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
| 12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
| 13 | #include <linux/mutex.h> | ||
| 13 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
| 14 | #include <linux/input.h> | 15 | #include <linux/input.h> |
| 15 | #include <linux/clk.h> | 16 | #include <linux/clk.h> |
| @@ -202,7 +203,7 @@ static struct omap_board_config_kernel nokia770_config[] __initdata = { | |||
| 202 | #define AMPLIFIER_CTRL_GPIO 58 | 203 | #define AMPLIFIER_CTRL_GPIO 58 |
| 203 | 204 | ||
| 204 | static struct clk *dspxor_ck; | 205 | static struct clk *dspxor_ck; |
| 205 | static DECLARE_MUTEX(audio_pwr_sem); | 206 | static DEFINE_MUTEX(audio_pwr_lock); |
| 206 | /* | 207 | /* |
| 207 | * audio_pwr_state | 208 | * audio_pwr_state |
| 208 | * +--+-------------------------+---------------------------------------+ | 209 | * +--+-------------------------+---------------------------------------+ |
| @@ -218,7 +219,7 @@ static DECLARE_MUTEX(audio_pwr_sem); | |||
| 218 | static int audio_pwr_state = -1; | 219 | static int audio_pwr_state = -1; |
| 219 | 220 | ||
| 220 | /* | 221 | /* |
| 221 | * audio_pwr_up / down should be called under audio_pwr_sem | 222 | * audio_pwr_up / down should be called under audio_pwr_lock |
| 222 | */ | 223 | */ |
| 223 | static void nokia770_audio_pwr_up(void) | 224 | static void nokia770_audio_pwr_up(void) |
| 224 | { | 225 | { |
| @@ -237,11 +238,11 @@ static void nokia770_audio_pwr_up(void) | |||
| 237 | 238 | ||
| 238 | static void codec_delayed_power_down(struct work_struct *work) | 239 | static void codec_delayed_power_down(struct work_struct *work) |
| 239 | { | 240 | { |
| 240 | down(&audio_pwr_sem); | 241 | mutex_lock(&audio_pwr_lock); |
| 241 | if (audio_pwr_state == -1) | 242 | if (audio_pwr_state == -1) |
| 242 | aic23_power_down(); | 243 | aic23_power_down(); |
| 243 | clk_disable(dspxor_ck); | 244 | clk_disable(dspxor_ck); |
| 244 | up(&audio_pwr_sem); | 245 | mutex_unlock(&audio_pwr_lock); |
| 245 | } | 246 | } |
| 246 | 247 | ||
| 247 | static DECLARE_DELAYED_WORK(codec_power_down_work, codec_delayed_power_down); | 248 | static DECLARE_DELAYED_WORK(codec_power_down_work, codec_delayed_power_down); |
| @@ -258,19 +259,19 @@ static void nokia770_audio_pwr_down(void) | |||
| 258 | static int | 259 | static int |
| 259 | nokia770_audio_pwr_up_request(struct dsp_kfunc_device *kdev, int stage) | 260 | nokia770_audio_pwr_up_request(struct dsp_kfunc_device *kdev, int stage) |
| 260 | { | 261 | { |
| 261 | down(&audio_pwr_sem); | 262 | mutex_lock(&audio_pwr_lock); |
| 262 | if (audio_pwr_state == -1) | 263 | if (audio_pwr_state == -1) |
| 263 | nokia770_audio_pwr_up(); | 264 | nokia770_audio_pwr_up(); |
| 264 | /* force audio_pwr_state = 0, even if it was 1. */ | 265 | /* force audio_pwr_state = 0, even if it was 1. */ |
| 265 | audio_pwr_state = 0; | 266 | audio_pwr_state = 0; |
| 266 | up(&audio_pwr_sem); | 267 | mutex_unlock(&audio_pwr_lock); |
| 267 | return 0; | 268 | return 0; |
| 268 | } | 269 | } |
| 269 | 270 | ||
| 270 | static int | 271 | static int |
| 271 | nokia770_audio_pwr_down_request(struct dsp_kfunc_device *kdev, int stage) | 272 | nokia770_audio_pwr_down_request(struct dsp_kfunc_device *kdev, int stage) |
| 272 | { | 273 | { |
| 273 | down(&audio_pwr_sem); | 274 | mutex_lock(&audio_pwr_lock); |
| 274 | switch (stage) { | 275 | switch (stage) { |
| 275 | case 1: | 276 | case 1: |
| 276 | if (audio_pwr_state == 0) | 277 | if (audio_pwr_state == 0) |
| @@ -283,7 +284,7 @@ nokia770_audio_pwr_down_request(struct dsp_kfunc_device *kdev, int stage) | |||
| 283 | } | 284 | } |
| 284 | break; | 285 | break; |
| 285 | } | 286 | } |
| 286 | up(&audio_pwr_sem); | 287 | mutex_unlock(&audio_pwr_lock); |
| 287 | return 0; | 288 | return 0; |
| 288 | } | 289 | } |
| 289 | 290 | ||
