From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A734C2D0A3 for ; Tue, 3 Nov 2020 13:09:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C6CFA21534 for ; Tue, 3 Nov 2020 13:09:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729127AbgKCNJo (ORCPT ); Tue, 3 Nov 2020 08:09:44 -0500 Received: from mx2.suse.de ([195.135.220.15]:36392 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728918AbgKCNJo (ORCPT ); Tue, 3 Nov 2020 08:09:44 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 880B3AD18; Tue, 3 Nov 2020 13:09:42 +0000 (UTC) Date: Tue, 03 Nov 2020 14:09:42 +0100 Message-ID: From: Takashi Iwai To: Yu Hao 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 In-Reply-To: <20201102071154.23563-1-yuhaobehappy@gmail.com> References: <20201102071154.23563-1-yuhaobehappy@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 >