Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 946DBECAAD3 for ; Sat, 17 Sep 2022 12:24:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229564AbiIQMY4 (ORCPT ); Sat, 17 Sep 2022 08:24:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229507AbiIQMYv (ORCPT ); Sat, 17 Sep 2022 08:24:51 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7303167FC for ; Sat, 17 Sep 2022 05:24:49 -0700 (PDT) Received: from dggpemm500021.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4MV95B326yz14QQM; Sat, 17 Sep 2022 20:20:46 +0800 (CST) Received: from dggpemm500007.china.huawei.com (7.185.36.183) by dggpemm500021.china.huawei.com (7.185.36.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Sat, 17 Sep 2022 20:24:48 +0800 Received: from huawei.com (10.175.103.91) by dggpemm500007.china.huawei.com (7.185.36.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Sat, 17 Sep 2022 20:24:47 +0800 From: Yang Yingliang To: , CC: , Subject: [PATCH -next 2/2] ALSA: mtpav: Switch to use list_for_each_entry() helper Date: Sat, 17 Sep 2022 20:31:55 +0800 Message-ID: <20220917123155.1899689-2-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220917123155.1899689-1-yangyingliang@huawei.com> References: <20220917123155.1899689-1-yangyingliang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500007.china.huawei.com (7.185.36.183) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use list_for_each_entry() helper instead of list_for_each() and list_entry() to simplify code a bit. No functional change. Signed-off-by: Yang Yingliang --- sound/drivers/mtpav.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c index f212f233ea61..717577e2a609 100644 --- a/sound/drivers/mtpav.c +++ b/sound/drivers/mtpav.c @@ -623,7 +623,6 @@ static int snd_mtpav_get_RAWMIDI(struct mtpav *mcard) int rval; struct snd_rawmidi *rawmidi; struct snd_rawmidi_substream *substream; - struct list_head *list; if (hwports < 1) hwports = 1; @@ -640,13 +639,15 @@ static int snd_mtpav_get_RAWMIDI(struct mtpav *mcard) rawmidi = mcard->rmidi; rawmidi->private_data = mcard; - list_for_each(list, &rawmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams) { - substream = list_entry(list, struct snd_rawmidi_substream, list); + list_for_each_entry(substream, + &rawmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams, + list) { snd_mtpav_set_name(mcard, substream); substream->ops = &snd_mtpav_input; } - list_for_each(list, &rawmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams) { - substream = list_entry(list, struct snd_rawmidi_substream, list); + list_for_each_entry(substream, + &rawmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams, + list) { snd_mtpav_set_name(mcard, substream); substream->ops = &snd_mtpav_output; mcard->ports[substream->number].hwport = translate_subdevice_to_hwport(mcard, substream->number); -- 2.25.1