All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sound/core/seq: remove dead code
@ 2020-11-02  7:11 Yu Hao
  2020-11-03 12:03   ` [kbuild] " Dan Carpenter
  2020-11-03 13:09   ` Takashi Iwai
  0 siblings, 2 replies; 11+ messages in thread
From: Yu Hao @ 2020-11-02  7:11 UTC (permalink / raw)
  To: perex, tiwai, alsa-devel; +Cc: yuhaobehappy, linux-kernel

The function snd_seq_queue_client_termination() is only called from
function seq_free_client1(). The seq_free_client1() calls function
snd_seq_queue_client_leave(), which deletes all objects whose owner
equals to client->number in global array queue_list, before the function
snd_seq_queue_client_termination(), which checks whether there are
any objects in global array queue_list whose owner equals to
client->number, with the same argument client->number. So
the checking code in function snd_seq_queue_client_termination() is
dead code. Remove those dead code.

Signed-off-by: Yu Hao <yuhaobehappy@gmail.com>
---
 sound/core/seq/seq_queue.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c
index 71a6ea62c3be..91b3f3295d0b 100644
--- a/sound/core/seq/seq_queue.c
+++ b/sound/core/seq/seq_queue.c
@@ -545,21 +545,10 @@ void snd_seq_queue_client_termination(int client)
 	unsigned long flags;
 	int i;
 	struct snd_seq_queue *q;
-	bool matched;
 
 	for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
 		if ((q = queueptr(i)) == NULL)
 			continue;
-		spin_lock_irqsave(&q->owner_lock, flags);
-		matched = (q->owner == client);
-		if (matched)
-			q->klocked = 1;
-		spin_unlock_irqrestore(&q->owner_lock, flags);
-		if (matched) {
-			if (q->timer->running)
-				snd_seq_timer_stop(q->timer);
-			snd_seq_timer_reset(q->timer);
-		}
 		queuefree(q);
 	}
 }
-- 
2.17.1


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

* [kbuild] Re: [PATCH] sound/core/seq: remove dead code
  2020-11-02  7:11 [PATCH] sound/core/seq: remove dead code Yu Hao
  2020-11-03 12:03   ` [kbuild] " Dan Carpenter
  2020-11-03 13:09   ` Takashi Iwai
@ 2020-11-03 12:03   ` Dan Carpenter
  1 sibling, 0 replies; 11+ messages in thread
From: Dan Carpenter @ 2020-11-03 12:03 UTC (permalink / raw)
  To: kbuild, Yu Hao, perex, tiwai, alsa-devel
  Cc: lkp, kbuild-all, yuhaobehappy, linux-kernel

Hi Yu,

url:    https://github.com/0day-ci/linux/commits/Yu-Hao/sound-core-seq-remove-dead-code/20201102-152326 
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git  for-next
compiler: sparc64-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> sound/core/seq/seq_queue.c:545:16: warning: Unused variable: flags [unusedVariable]
    unsigned long flags;
                  ^

vim +545 sound/core/seq/seq_queue.c

^1da177e4c3f415 Linus Torvalds 2005-04-16  543  void snd_seq_queue_client_termination(int client)
^1da177e4c3f415 Linus Torvalds 2005-04-16  544  {
^1da177e4c3f415 Linus Torvalds 2005-04-16 @545  	unsigned long flags;
                                                        ^^^^^^^^^^^^^^^^^^^
Unused.

^1da177e4c3f415 Linus Torvalds 2005-04-16  546  	int i;
c7e0b5bf9fff1b7 Takashi Iwai   2005-11-17  547  	struct snd_seq_queue *q;
^1da177e4c3f415 Linus Torvalds 2005-04-16  548  
^1da177e4c3f415 Linus Torvalds 2005-04-16  549  	for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
^1da177e4c3f415 Linus Torvalds 2005-04-16  550  		if ((q = queueptr(i)) == NULL)
^1da177e4c3f415 Linus Torvalds 2005-04-16  551  			continue;
^1da177e4c3f415 Linus Torvalds 2005-04-16  552  		queuefree(q);
^1da177e4c3f415 Linus Torvalds 2005-04-16  553  	}
^1da177e4c3f415 Linus Torvalds 2005-04-16  554  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org 
_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org

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

* [kbuild] Re: [PATCH] sound/core/seq: remove dead code
@ 2020-11-03 12:03   ` Dan Carpenter
  0 siblings, 0 replies; 11+ messages in thread
From: Dan Carpenter @ 2020-11-03 12:03 UTC (permalink / raw)
  To: kbuild, Yu Hao, perex, tiwai, alsa-devel
  Cc: yuhaobehappy, kbuild-all, lkp, linux-kernel

Hi Yu,

url:    https://github.com/0day-ci/linux/commits/Yu-Hao/sound-core-seq-remove-dead-code/20201102-152326 
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git  for-next
compiler: sparc64-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> sound/core/seq/seq_queue.c:545:16: warning: Unused variable: flags [unusedVariable]
    unsigned long flags;
                  ^

vim +545 sound/core/seq/seq_queue.c

^1da177e4c3f415 Linus Torvalds 2005-04-16  543  void snd_seq_queue_client_termination(int client)
^1da177e4c3f415 Linus Torvalds 2005-04-16  544  {
^1da177e4c3f415 Linus Torvalds 2005-04-16 @545  	unsigned long flags;
                                                        ^^^^^^^^^^^^^^^^^^^
Unused.

^1da177e4c3f415 Linus Torvalds 2005-04-16  546  	int i;
c7e0b5bf9fff1b7 Takashi Iwai   2005-11-17  547  	struct snd_seq_queue *q;
^1da177e4c3f415 Linus Torvalds 2005-04-16  548  
^1da177e4c3f415 Linus Torvalds 2005-04-16  549  	for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
^1da177e4c3f415 Linus Torvalds 2005-04-16  550  		if ((q = queueptr(i)) == NULL)
^1da177e4c3f415 Linus Torvalds 2005-04-16  551  			continue;
^1da177e4c3f415 Linus Torvalds 2005-04-16  552  		queuefree(q);
^1da177e4c3f415 Linus Torvalds 2005-04-16  553  	}
^1da177e4c3f415 Linus Torvalds 2005-04-16  554  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org 
_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org

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

* Re: [PATCH] sound/core/seq: remove dead code
@ 2020-11-03 12:03   ` Dan Carpenter
  0 siblings, 0 replies; 11+ messages in thread
From: Dan Carpenter @ 2020-11-03 12:03 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1782 bytes --]

Hi Yu,

url:    https://github.com/0day-ci/linux/commits/Yu-Hao/sound-core-seq-remove-dead-code/20201102-152326 
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git  for-next
compiler: sparc64-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> sound/core/seq/seq_queue.c:545:16: warning: Unused variable: flags [unusedVariable]
    unsigned long flags;
                  ^

vim +545 sound/core/seq/seq_queue.c

^1da177e4c3f415 Linus Torvalds 2005-04-16  543  void snd_seq_queue_client_termination(int client)
^1da177e4c3f415 Linus Torvalds 2005-04-16  544  {
^1da177e4c3f415 Linus Torvalds 2005-04-16 @545  	unsigned long flags;
                                                        ^^^^^^^^^^^^^^^^^^^
Unused.

^1da177e4c3f415 Linus Torvalds 2005-04-16  546  	int i;
c7e0b5bf9fff1b7 Takashi Iwai   2005-11-17  547  	struct snd_seq_queue *q;
^1da177e4c3f415 Linus Torvalds 2005-04-16  548  
^1da177e4c3f415 Linus Torvalds 2005-04-16  549  	for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
^1da177e4c3f415 Linus Torvalds 2005-04-16  550  		if ((q = queueptr(i)) == NULL)
^1da177e4c3f415 Linus Torvalds 2005-04-16  551  			continue;
^1da177e4c3f415 Linus Torvalds 2005-04-16  552  		queuefree(q);
^1da177e4c3f415 Linus Torvalds 2005-04-16  553  	}
^1da177e4c3f415 Linus Torvalds 2005-04-16  554  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org 
_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org

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

* [kbuild] Re: [PATCH] sound/core/seq: remove dead code
@ 2020-11-03 12:03   ` Dan Carpenter
  0 siblings, 0 replies; 11+ messages in thread
From: Dan Carpenter @ 2020-11-03 12:03 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1782 bytes --]

Hi Yu,

url:    https://github.com/0day-ci/linux/commits/Yu-Hao/sound-core-seq-remove-dead-code/20201102-152326 
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git  for-next
compiler: sparc64-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> sound/core/seq/seq_queue.c:545:16: warning: Unused variable: flags [unusedVariable]
    unsigned long flags;
                  ^

vim +545 sound/core/seq/seq_queue.c

^1da177e4c3f415 Linus Torvalds 2005-04-16  543  void snd_seq_queue_client_termination(int client)
^1da177e4c3f415 Linus Torvalds 2005-04-16  544  {
^1da177e4c3f415 Linus Torvalds 2005-04-16 @545  	unsigned long flags;
                                                        ^^^^^^^^^^^^^^^^^^^
Unused.

^1da177e4c3f415 Linus Torvalds 2005-04-16  546  	int i;
c7e0b5bf9fff1b7 Takashi Iwai   2005-11-17  547  	struct snd_seq_queue *q;
^1da177e4c3f415 Linus Torvalds 2005-04-16  548  
^1da177e4c3f415 Linus Torvalds 2005-04-16  549  	for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
^1da177e4c3f415 Linus Torvalds 2005-04-16  550  		if ((q = queueptr(i)) == NULL)
^1da177e4c3f415 Linus Torvalds 2005-04-16  551  			continue;
^1da177e4c3f415 Linus Torvalds 2005-04-16  552  		queuefree(q);
^1da177e4c3f415 Linus Torvalds 2005-04-16  553  	}
^1da177e4c3f415 Linus Torvalds 2005-04-16  554  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org 
_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org

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

* Re: [PATCH] sound/core/seq: remove dead code
  2020-11-02  7:11 [PATCH] sound/core/seq: remove dead code Yu Hao
@ 2020-11-03 13:09   ` Takashi Iwai
  2020-11-03 13:09   ` Takashi Iwai
  1 sibling, 0 replies; 11+ messages in thread
From: Takashi Iwai @ 2020-11-03 13:09 UTC (permalink / raw)
  To: Yu Hao; +Cc: perex, tiwai, alsa-devel, linux-kernel

On Mon, 02 Nov 2020 08:11:54 +0100,
Yu Hao wrote:
> 
> The function snd_seq_queue_client_termination() is only called from
> function seq_free_client1(). The seq_free_client1() calls function
> snd_seq_queue_client_leave(), which deletes all objects whose owner
> equals to client->number in global array queue_list, before the function
> snd_seq_queue_client_termination(), which checks whether there are
> any objects in global array queue_list whose owner equals to
> client->number, with the same argument client->number. So
> the checking code in function snd_seq_queue_client_termination() is
> dead code. Remove those dead code.
> 
> Signed-off-by: Yu Hao <yuhaobehappy@gmail.com>

Actually the whole function snd_seq_queue_client_termination() can be
removed.  It's a quite old code and I don't remember clearly, but I
guess the intention was to call this before the actual queue
deletion.  OTOH, it doesn't make any sense to change that order any
longer, as the snd_seq_queue_client_leave() already takes similar
procedure anyway, so let's rather wipe off the useless function.

Could you resubmit with that change?


thanks,

Takashi

> ---
>  sound/core/seq/seq_queue.c | 11 -----------
>  1 file changed, 11 deletions(-)
> 
> diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c
> index 71a6ea62c3be..91b3f3295d0b 100644
> --- a/sound/core/seq/seq_queue.c
> +++ b/sound/core/seq/seq_queue.c
> @@ -545,21 +545,10 @@ void snd_seq_queue_client_termination(int client)
>  	unsigned long flags;
>  	int i;
>  	struct snd_seq_queue *q;
> -	bool matched;
>  
>  	for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
>  		if ((q = queueptr(i)) == NULL)
>  			continue;
> -		spin_lock_irqsave(&q->owner_lock, flags);
> -		matched = (q->owner == client);
> -		if (matched)
> -			q->klocked = 1;
> -		spin_unlock_irqrestore(&q->owner_lock, flags);
> -		if (matched) {
> -			if (q->timer->running)
> -				snd_seq_timer_stop(q->timer);
> -			snd_seq_timer_reset(q->timer);
> -		}
>  		queuefree(q);
>  	}
>  }
> -- 
> 2.17.1
> 

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

* Re: [PATCH] sound/core/seq: remove dead code
@ 2020-11-03 13:09   ` Takashi Iwai
  0 siblings, 0 replies; 11+ messages in thread
From: Takashi Iwai @ 2020-11-03 13:09 UTC (permalink / raw)
  To: Yu Hao; +Cc: linux-kernel, alsa-devel, tiwai

On Mon, 02 Nov 2020 08:11:54 +0100,
Yu Hao wrote:
> 
> The function snd_seq_queue_client_termination() is only called from
> function seq_free_client1(). The seq_free_client1() calls function
> snd_seq_queue_client_leave(), which deletes all objects whose owner
> equals to client->number in global array queue_list, before the function
> snd_seq_queue_client_termination(), which checks whether there are
> any objects in global array queue_list whose owner equals to
> client->number, with the same argument client->number. So
> the checking code in function snd_seq_queue_client_termination() is
> dead code. Remove those dead code.
> 
> Signed-off-by: Yu Hao <yuhaobehappy@gmail.com>

Actually the whole function snd_seq_queue_client_termination() can be
removed.  It's a quite old code and I don't remember clearly, but I
guess the intention was to call this before the actual queue
deletion.  OTOH, it doesn't make any sense to change that order any
longer, as the snd_seq_queue_client_leave() already takes similar
procedure anyway, so let's rather wipe off the useless function.

Could you resubmit with that change?


thanks,

Takashi

> ---
>  sound/core/seq/seq_queue.c | 11 -----------
>  1 file changed, 11 deletions(-)
> 
> diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c
> index 71a6ea62c3be..91b3f3295d0b 100644
> --- a/sound/core/seq/seq_queue.c
> +++ b/sound/core/seq/seq_queue.c
> @@ -545,21 +545,10 @@ void snd_seq_queue_client_termination(int client)
>  	unsigned long flags;
>  	int i;
>  	struct snd_seq_queue *q;
> -	bool matched;
>  
>  	for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
>  		if ((q = queueptr(i)) == NULL)
>  			continue;
> -		spin_lock_irqsave(&q->owner_lock, flags);
> -		matched = (q->owner == client);
> -		if (matched)
> -			q->klocked = 1;
> -		spin_unlock_irqrestore(&q->owner_lock, flags);
> -		if (matched) {
> -			if (q->timer->running)
> -				snd_seq_timer_stop(q->timer);
> -			snd_seq_timer_reset(q->timer);
> -		}
>  		queuefree(q);
>  	}
>  }
> -- 
> 2.17.1
> 

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

* Re: [PATCH] sound/core/seq: remove dead code
  2020-11-03 13:09   ` Takashi Iwai
  (?)
@ 2020-11-03 18:43   ` Yu Hao
  2020-11-03 20:17       ` Takashi Iwai
  -1 siblings, 1 reply; 11+ messages in thread
From: Yu Hao @ 2020-11-03 18:43 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: linux-kernel, alsa-devel, tiwai

Yes, I can do that.

And a quick question, to resubmit with that change means that I should
create a new submission and this one ends, right?

Thanks.

On Tue, Nov 3, 2020 at 5:09 AM Takashi Iwai <tiwai@suse.de> wrote:

> On Mon, 02 Nov 2020 08:11:54 +0100,
> Yu Hao wrote:
> >
> > The function snd_seq_queue_client_termination() is only called from
> > function seq_free_client1(). The seq_free_client1() calls function
> > snd_seq_queue_client_leave(), which deletes all objects whose owner
> > equals to client->number in global array queue_list, before the function
> > snd_seq_queue_client_termination(), which checks whether there are
> > any objects in global array queue_list whose owner equals to
> > client->number, with the same argument client->number. So
> > the checking code in function snd_seq_queue_client_termination() is
> > dead code. Remove those dead code.
> >
> > Signed-off-by: Yu Hao <yuhaobehappy@gmail.com>
>
> Actually the whole function snd_seq_queue_client_termination() can be
> removed.  It's a quite old code and I don't remember clearly, but I
> guess the intention was to call this before the actual queue
> deletion.  OTOH, it doesn't make any sense to change that order any
> longer, as the snd_seq_queue_client_leave() already takes similar
> procedure anyway, so let's rather wipe off the useless function.
>
> Could you resubmit with that change?
>
>
> thanks,
>
> Takashi
>
> > ---
> >  sound/core/seq/seq_queue.c | 11 -----------
> >  1 file changed, 11 deletions(-)
> >
> > diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c
> > index 71a6ea62c3be..91b3f3295d0b 100644
> > --- a/sound/core/seq/seq_queue.c
> > +++ b/sound/core/seq/seq_queue.c
> > @@ -545,21 +545,10 @@ void snd_seq_queue_client_termination(int client)
> >       unsigned long flags;
> >       int i;
> >       struct snd_seq_queue *q;
> > -     bool matched;
> >
> >       for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
> >               if ((q = queueptr(i)) == NULL)
> >                       continue;
> > -             spin_lock_irqsave(&q->owner_lock, flags);
> > -             matched = (q->owner == client);
> > -             if (matched)
> > -                     q->klocked = 1;
> > -             spin_unlock_irqrestore(&q->owner_lock, flags);
> > -             if (matched) {
> > -                     if (q->timer->running)
> > -                             snd_seq_timer_stop(q->timer);
> > -                     snd_seq_timer_reset(q->timer);
> > -             }
> >               queuefree(q);
> >       }
> >  }
> > --
> > 2.17.1
> >
>

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

* Re: [PATCH] sound/core/seq: remove dead code
  2020-11-03 18:43   ` Yu Hao
@ 2020-11-03 20:17       ` Takashi Iwai
  0 siblings, 0 replies; 11+ messages in thread
From: Takashi Iwai @ 2020-11-03 20:17 UTC (permalink / raw)
  To: Yu Hao; +Cc: perex, tiwai, alsa-devel, linux-kernel

On Tue, 03 Nov 2020 19:43:55 +0100,
Yu Hao wrote:
> 
> Yes, I can do that.
> 
> And a quick question, to resubmit with that change means that I should create
> a new submission and this one ends, right?

Yes, just submit a fresh patch.


thanks,

Takashi

> 
> Thanks.
> 
> On Tue, Nov 3, 2020 at 5:09 AM Takashi Iwai <tiwai@suse.de> wrote:
> 
>     On Mon, 02 Nov 2020 08:11:54 +0100,
>     Yu Hao wrote:
>     >
>     > The function snd_seq_queue_client_termination() is only called from
>     > function seq_free_client1(). The seq_free_client1() calls function
>     > snd_seq_queue_client_leave(), which deletes all objects whose owner
>     > equals to client->number in global array queue_list, before the function
>     > snd_seq_queue_client_termination(), which checks whether there are
>     > any objects in global array queue_list whose owner equals to
>     > client->number, with the same argument client->number. So
>     > the checking code in function snd_seq_queue_client_termination() is
>     > dead code. Remove those dead code.
>     >
>     > Signed-off-by: Yu Hao <yuhaobehappy@gmail.com>
>    
>     Actually the whole function snd_seq_queue_client_termination() can be
>     removed.  It's a quite old code and I don't remember clearly, but I
>     guess the intention was to call this before the actual queue
>     deletion.  OTOH, it doesn't make any sense to change that order any
>     longer, as the snd_seq_queue_client_leave() already takes similar
>     procedure anyway, so let's rather wipe off the useless function.
>    
>     Could you resubmit with that change?
> 
>     thanks,
>    
>     Takashi
>    
>     > ---
>     >  sound/core/seq/seq_queue.c | 11 -----------
>     >  1 file changed, 11 deletions(-)
>     >
>     > diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c
>     > index 71a6ea62c3be..91b3f3295d0b 100644
>     > --- a/sound/core/seq/seq_queue.c
>     > +++ b/sound/core/seq/seq_queue.c
>     > @@ -545,21 +545,10 @@ void snd_seq_queue_client_termination(int client)
>     >       unsigned long flags;
>     >       int i;
>     >       struct snd_seq_queue *q;
>     > -     bool matched;
>     > 
>     >       for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
>     >               if ((q = queueptr(i)) == NULL)
>     >                       continue;
>     > -             spin_lock_irqsave(&q->owner_lock, flags);
>     > -             matched = (q->owner == client);
>     > -             if (matched)
>     > -                     q->klocked = 1;
>     > -             spin_unlock_irqrestore(&q->owner_lock, flags);
>     > -             if (matched) {
>     > -                     if (q->timer->running)
>     > -                             snd_seq_timer_stop(q->timer);
>     > -                     snd_seq_timer_reset(q->timer);
>     > -             }
>     >               queuefree(q);
>     >       }
>     >  }
>     > --
>     > 2.17.1
>     >
> 
> 

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

* Re: [PATCH] sound/core/seq: remove dead code
@ 2020-11-03 20:17       ` Takashi Iwai
  0 siblings, 0 replies; 11+ messages in thread
From: Takashi Iwai @ 2020-11-03 20:17 UTC (permalink / raw)
  To: Yu Hao; +Cc: linux-kernel, alsa-devel, tiwai

On Tue, 03 Nov 2020 19:43:55 +0100,
Yu Hao wrote:
> 
> Yes, I can do that.
> 
> And a quick question, to resubmit with that change means that I should create
> a new submission and this one ends, right?

Yes, just submit a fresh patch.


thanks,

Takashi

> 
> Thanks.
> 
> On Tue, Nov 3, 2020 at 5:09 AM Takashi Iwai <tiwai@suse.de> wrote:
> 
>     On Mon, 02 Nov 2020 08:11:54 +0100,
>     Yu Hao wrote:
>     >
>     > The function snd_seq_queue_client_termination() is only called from
>     > function seq_free_client1(). The seq_free_client1() calls function
>     > snd_seq_queue_client_leave(), which deletes all objects whose owner
>     > equals to client->number in global array queue_list, before the function
>     > snd_seq_queue_client_termination(), which checks whether there are
>     > any objects in global array queue_list whose owner equals to
>     > client->number, with the same argument client->number. So
>     > the checking code in function snd_seq_queue_client_termination() is
>     > dead code. Remove those dead code.
>     >
>     > Signed-off-by: Yu Hao <yuhaobehappy@gmail.com>
>    
>     Actually the whole function snd_seq_queue_client_termination() can be
>     removed.  It's a quite old code and I don't remember clearly, but I
>     guess the intention was to call this before the actual queue
>     deletion.  OTOH, it doesn't make any sense to change that order any
>     longer, as the snd_seq_queue_client_leave() already takes similar
>     procedure anyway, so let's rather wipe off the useless function.
>    
>     Could you resubmit with that change?
> 
>     thanks,
>    
>     Takashi
>    
>     > ---
>     >  sound/core/seq/seq_queue.c | 11 -----------
>     >  1 file changed, 11 deletions(-)
>     >
>     > diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c
>     > index 71a6ea62c3be..91b3f3295d0b 100644
>     > --- a/sound/core/seq/seq_queue.c
>     > +++ b/sound/core/seq/seq_queue.c
>     > @@ -545,21 +545,10 @@ void snd_seq_queue_client_termination(int client)
>     >       unsigned long flags;
>     >       int i;
>     >       struct snd_seq_queue *q;
>     > -     bool matched;
>     > 
>     >       for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
>     >               if ((q = queueptr(i)) == NULL)
>     >                       continue;
>     > -             spin_lock_irqsave(&q->owner_lock, flags);
>     > -             matched = (q->owner == client);
>     > -             if (matched)
>     > -                     q->klocked = 1;
>     > -             spin_unlock_irqrestore(&q->owner_lock, flags);
>     > -             if (matched) {
>     > -                     if (q->timer->running)
>     > -                             snd_seq_timer_stop(q->timer);
>     > -                     snd_seq_timer_reset(q->timer);
>     > -             }
>     >               queuefree(q);
>     >       }
>     >  }
>     > --
>     > 2.17.1
>     >
> 
> 

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

* Re: [PATCH] sound/core/seq: remove dead code
@ 2020-11-03 11:15 kernel test robot
  0 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2020-11-03 11:15 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 2645 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20201102071154.23563-1-yuhaobehappy@gmail.com>
References: <20201102071154.23563-1-yuhaobehappy@gmail.com>
TO: Yu Hao <yuhaobehappy@gmail.com>
TO: perex(a)perex.cz
TO: tiwai(a)suse.com
TO: alsa-devel(a)alsa-project.org
CC: yuhaobehappy(a)gmail.com
CC: linux-kernel(a)vger.kernel.org

Hi Yu,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on sound/for-next]
[also build test WARNING on v5.10-rc2 next-20201103]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Yu-Hao/sound-core-seq-remove-dead-code/20201102-152326
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
:::::: branch date: 28 hours ago
:::::: commit date: 28 hours ago
compiler: sparc64-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> sound/core/seq/seq_queue.c:545:16: warning: Unused variable: flags [unusedVariable]
    unsigned long flags;
                  ^

vim +545 sound/core/seq/seq_queue.c

^1da177e4c3f415 Linus Torvalds 2005-04-16  539  
^1da177e4c3f415 Linus Torvalds 2005-04-16  540  /* notification that client has left the system -
^1da177e4c3f415 Linus Torvalds 2005-04-16  541   * stop the timer on all queues owned by this client
^1da177e4c3f415 Linus Torvalds 2005-04-16  542   */
^1da177e4c3f415 Linus Torvalds 2005-04-16  543  void snd_seq_queue_client_termination(int client)
^1da177e4c3f415 Linus Torvalds 2005-04-16  544  {
^1da177e4c3f415 Linus Torvalds 2005-04-16 @545  	unsigned long flags;
^1da177e4c3f415 Linus Torvalds 2005-04-16  546  	int i;
c7e0b5bf9fff1b7 Takashi Iwai   2005-11-17  547  	struct snd_seq_queue *q;
^1da177e4c3f415 Linus Torvalds 2005-04-16  548  
^1da177e4c3f415 Linus Torvalds 2005-04-16  549  	for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
^1da177e4c3f415 Linus Torvalds 2005-04-16  550  		if ((q = queueptr(i)) == NULL)
^1da177e4c3f415 Linus Torvalds 2005-04-16  551  			continue;
^1da177e4c3f415 Linus Torvalds 2005-04-16  552  		queuefree(q);
^1da177e4c3f415 Linus Torvalds 2005-04-16  553  	}
^1da177e4c3f415 Linus Torvalds 2005-04-16  554  }
^1da177e4c3f415 Linus Torvalds 2005-04-16  555  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

end of thread, other threads:[~2020-11-03 20:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-02  7:11 [PATCH] sound/core/seq: remove dead code Yu Hao
2020-11-03 12:03 ` [kbuild] " Dan Carpenter
2020-11-03 12:03   ` Dan Carpenter
2020-11-03 12:03   ` Dan Carpenter
2020-11-03 12:03   ` [kbuild] " Dan Carpenter
2020-11-03 13:09 ` Takashi Iwai
2020-11-03 13:09   ` Takashi Iwai
2020-11-03 18:43   ` Yu Hao
2020-11-03 20:17     ` Takashi Iwai
2020-11-03 20:17       ` Takashi Iwai
2020-11-03 11:15 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.