From: Takashi Iwai <tiwai@suse.de>
To: Yu Hao <yuhaobehappy@gmail.com>
Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org,
tiwai@suse.com
Subject: Re: [PATCH] sound/core/seq: remove dead code
Date: Tue, 03 Nov 2020 14:09:42 +0100 [thread overview]
Message-ID: <s5himamoacp.wl-tiwai@suse.de> (raw)
In-Reply-To: <20201102071154.23563-1-yuhaobehappy@gmail.com>
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
>
WARNING: multiple messages have this Message-ID (diff)
From: Takashi Iwai <tiwai@suse.de>
To: Yu Hao <yuhaobehappy@gmail.com>
Cc: perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sound/core/seq: remove dead code
Date: Tue, 03 Nov 2020 14:09:42 +0100 [thread overview]
Message-ID: <s5himamoacp.wl-tiwai@suse.de> (raw)
In-Reply-To: <20201102071154.23563-1-yuhaobehappy@gmail.com>
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
>
next prev parent reply other threads:[~2020-11-03 13:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Dan Carpenter
2020-11-03 13:09 ` Takashi Iwai [this message]
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
-- strict thread matches above, loose matches on Subject: below --
2020-11-03 11:15 kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5himamoacp.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tiwai@suse.com \
--cc=yuhaobehappy@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.