public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] sound: sys_timer: indent poll_def_tmr() correctly
@ 2015-02-25 13:27 Dan Carpenter
  2015-02-25 19:09 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-02-25 13:27 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: Takashi Iwai, alsa-devel, kernel-janitors

The indenting here was really whacky and not consistent from one line to
the next.  I also reverse the "if (opened)" and "if (tmr_running)" tests
so that I could remove two indent levels.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/oss/sys_timer.c b/sound/oss/sys_timer.c
index 9f03983..2226dda 100644
--- a/sound/oss/sys_timer.c
+++ b/sound/oss/sys_timer.c
@@ -50,29 +50,24 @@ tmr2ticks(int tmr_value)
 static void
 poll_def_tmr(unsigned long dummy)
 {
+	if (!opened)
+		return;
+	def_tmr.expires = (1) + jiffies;
+	add_timer(&def_tmr);
 
-	if (opened)
-	  {
+	if (!tmr_running)
+		return;
 
-		  {
-			  def_tmr.expires = (1) + jiffies;
-			  add_timer(&def_tmr);
-		  }
+	spin_lock(&lock);
+	tmr_ctr++;
+	curr_ticks = ticks_offs + tmr2ticks(tmr_ctr);
 
-		  if (tmr_running)
-		    {
-				spin_lock(&lock);
-			    tmr_ctr++;
-			    curr_ticks = ticks_offs + tmr2ticks(tmr_ctr);
-
-			    if (curr_ticks >= next_event_time)
-			      {
-				      next_event_time = (unsigned long) -1;
-				      sequencer_timer(0);
-			      }
-				spin_unlock(&lock);
-		    }
-	  }
+	if (curr_ticks >= next_event_time) {
+		next_event_time = (unsigned long) -1;
+		sequencer_timer(0);
+	}
+
+	spin_unlock(&lock);
 }
 
 static void

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] sound: sys_timer: indent poll_def_tmr() correctly
  2015-02-25 13:27 [patch] sound: sys_timer: indent poll_def_tmr() correctly Dan Carpenter
@ 2015-02-25 19:09 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2015-02-25 19:09 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Jaroslav Kysela, alsa-devel, kernel-janitors

At Wed, 25 Feb 2015 16:27:10 +0300,
Dan Carpenter wrote:
> 
> The indenting here was really whacky and not consistent from one line to
> the next.  I also reverse the "if (opened)" and "if (tmr_running)" tests
> so that I could remove two indent levels.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks.


Takashi

> 
> diff --git a/sound/oss/sys_timer.c b/sound/oss/sys_timer.c
> index 9f03983..2226dda 100644
> --- a/sound/oss/sys_timer.c
> +++ b/sound/oss/sys_timer.c
> @@ -50,29 +50,24 @@ tmr2ticks(int tmr_value)
>  static void
>  poll_def_tmr(unsigned long dummy)
>  {
> +	if (!opened)
> +		return;
> +	def_tmr.expires = (1) + jiffies;
> +	add_timer(&def_tmr);
>  
> -	if (opened)
> -	  {
> +	if (!tmr_running)
> +		return;
>  
> -		  {
> -			  def_tmr.expires = (1) + jiffies;
> -			  add_timer(&def_tmr);
> -		  }
> +	spin_lock(&lock);
> +	tmr_ctr++;
> +	curr_ticks = ticks_offs + tmr2ticks(tmr_ctr);
>  
> -		  if (tmr_running)
> -		    {
> -				spin_lock(&lock);
> -			    tmr_ctr++;
> -			    curr_ticks = ticks_offs + tmr2ticks(tmr_ctr);
> -
> -			    if (curr_ticks >= next_event_time)
> -			      {
> -				      next_event_time = (unsigned long) -1;
> -				      sequencer_timer(0);
> -			      }
> -				spin_unlock(&lock);
> -		    }
> -	  }
> +	if (curr_ticks >= next_event_time) {
> +		next_event_time = (unsigned long) -1;
> +		sequencer_timer(0);
> +	}
> +
> +	spin_unlock(&lock);
>  }
>  
>  static void
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-25 19:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-25 13:27 [patch] sound: sys_timer: indent poll_def_tmr() correctly Dan Carpenter
2015-02-25 19:09 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox