Re: [PATCH] arm: omap1: nokia770 semaphore to mutex

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Thu, 17 Jan 2008 21:50:36 -0800, Daniel Walker <dwalker@xxxxxxxxxx>
wrote:
> The audio_pwr_sem conforms to the new mutex API. This patch converts
> the semaphore to the new API along with all the locking locations.
> 
> I also changed the name to reflect the new type.
> 
> Signed-off-by: Daniel Walker <dwalker@xxxxxxxxxx>
> 
> ---
>  arch/arm/mach-omap1/board-nokia770.c |   17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> Index: linux-2.6.23/arch/arm/mach-omap1/board-nokia770.c
> ===================================================================
> --- linux-2.6.23.orig/arch/arm/mach-omap1/board-nokia770.c
> +++ linux-2.6.23/arch/arm/mach-omap1/board-nokia770.c
> @@ -18,6 +18,7 @@
>  #include <linux/spi/ads7846.h>
>  #include <linux/workqueue.h>
>  #include <linux/delay.h>
> +#include <linux/mutex.h>
> 
>  #include <asm/hardware.h>
>  #include <asm/mach-types.h>
> @@ -204,7 +205,7 @@ static struct omap_board_config_kernel n
>  #define	AMPLIFIER_CTRL_GPIO	58
> 
>  static struct clk *dspxor_ck;
> -static DECLARE_MUTEX(audio_pwr_sem);
> +static DEFINE_MUTEX(audio_pwr_mutex);
>  /*
>   * audio_pwr_state
>   *
+--+-------------------------+---------------------------------------+
> @@ -220,7 +221,7 @@ static DECLARE_MUTEX(audio_pwr_sem);
>  static int audio_pwr_state = -1;
> 
>  /*
> - * audio_pwr_up / down should be called under audio_pwr_sem
> + * audio_pwr_up / down should be called under audio_pwr_mutex

stupid comment but it's not down anylonger, it's mutex_unlock.

>   */
>  static void nokia770_audio_pwr_up(void)
>  {
> @@ -239,11 +240,11 @@ static void nokia770_audio_pwr_up(void)
> 
>  static void codec_delayed_power_down(struct work_struct *work)
>  {
> -	down(&audio_pwr_sem);
> +	mutex_lock(&audio_pwr_mutex);
>  	if (audio_pwr_state == -1)
>  		aic23_power_down();
>  	clk_disable(dspxor_ck);
> -	up(&audio_pwr_sem);
> +	mutex_unlock(&audio_pwr_mutex);
>  }
> 
>  static DECLARE_DELAYED_WORK(codec_power_down_work,
> codec_delayed_power_down);
> @@ -260,19 +261,19 @@ static void nokia770_audio_pwr_down(void
>  static int
>  nokia770_audio_pwr_up_request(struct dsp_kfunc_device *kdev, int stage)
>  {
> -	down(&audio_pwr_sem);
> +	mutex_lock(&audio_pwr_mutex);
>  	if (audio_pwr_state == -1)
>  		nokia770_audio_pwr_up();
>  	/* force audio_pwr_state = 0, even if it was 1. */
>  	audio_pwr_state = 0;
> -	up(&audio_pwr_sem);
> +	mutex_unlock(&audio_pwr_mutex);
>  	return 0;
>  }
> 
>  static int
>  nokia770_audio_pwr_down_request(struct dsp_kfunc_device *kdev, int
stage)
>  {
> -	down(&audio_pwr_sem);
> +	mutex_lock(&audio_pwr_mutex);
>  	switch (stage) {
>  	case 1:
>  		if (audio_pwr_state == 0)
> @@ -285,7 +286,7 @@ nokia770_audio_pwr_down_request(struct d
>  		}
>  		break;
>  	}
> -	up(&audio_pwr_sem);
> +	mutex_unlock(&audio_pwr_mutex);
>  	return 0;
>  }
> 
> --
> 
> --
> -
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
Best Regards,

Felipe Balbi
http://felipebalbi.com
me@xxxxxxxxxxxxxxx

-
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux