Message ID | 1595761112-11003-1-git-send-email-Julia.Lawall@inria.fr (mailing list archive) |
---|---|
Headers |
Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from <linux-media-owner@vger.kernel.org>) id 1jzew9-00DxBc-QT; Sun, 26 Jul 2020 11:35:26 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726956AbgGZLjv (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Sun, 26 Jul 2020 07:39:51 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:32814 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725794AbgGZLju (ORCPT <rfc822;linux-media@vger.kernel.org>); Sun, 26 Jul 2020 07:39:50 -0400 X-IronPort-AV: E=Sophos;i="5.75,398,1589234400"; d="scan'208";a="355309542" Received: from palace.rsr.lip6.fr (HELO palace.lip6.fr) ([132.227.105.202]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/AES256-SHA256; 26 Jul 2020 13:39:47 +0200 From: Julia Lawall <Julia.Lawall@inria.fr> To: linux-rdma@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, linux-media@vger.kernel.org, linux-wireless@vger.kernel.org Subject: [PATCH 0/7] drop unnecessary list_empty Date: Sun, 26 Jul 2020 12:58:25 +0200 Message-Id: <1595761112-11003-1-git-send-email-Julia.Lawall@inria.fr> X-Mailer: git-send-email 1.9.1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.4 (--) X-LSpam-Report: No, score=-2.4 required=5.0 tests=BAYES_00=-1.9,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1 autolearn=ham autolearn_force=no |
Series |
drop unnecessary list_empty
|
|
Message
Julia Lawall
July 26, 2020, 10:58 a.m. UTC
The various list iterators are able to handle an empty list. The only effect of avoiding the loop is not initializing some index variables. Drop list_empty tests in cases where these variables are not used. The semantic patch that makes these changes is as follows: (http://coccinelle.lip6.fr/) <smpl> @@ expression x,e; iterator name list_for_each_entry; statement S; identifier i; @@ -if (!(list_empty(x))) { list_for_each_entry(i,x,...) S - } ... when != i ? i = e @@ expression x,e; iterator name list_for_each_entry_safe; statement S; identifier i,j; @@ -if (!(list_empty(x))) { list_for_each_entry_safe(i,j,x,...) S - } ... when != i when != j ( i = e; | ? j = e; ) @@ expression x,e; iterator name list_for_each; statement S; identifier i; @@ -if (!(list_empty(x))) { list_for_each(i,x) S - } ... when != i ? i = e @@ expression x,e; iterator name list_for_each_safe; statement S; identifier i,j; @@ -if (!(list_empty(x))) { list_for_each_safe(i,j,x) S - } ... when != i when != j ( i = e; | ? j = e; ) // ------------------- @@ expression x,e; statement S; identifier i; @@ -if (!(list_empty(x))) list_for_each_entry(i,x,...) S ... when != i ? i = e @@ expression x,e; statement S; identifier i,j; @@ -if (!(list_empty(x))) list_for_each_entry_safe(i,j,x,...) S ... when != i when != j ( i = e; | ? j = e; ) @@ expression x,e; statement S; identifier i; @@ -if (!(list_empty(x))) list_for_each(i,x) S ... when != i ? i = e @@ expression x,e; statement S; identifier i,j; @@ -if (!(list_empty(x))) list_for_each_safe(i,j,x) S ... when != i when != j ( i = e; | ? j = e; ) </smpl> --- drivers/media/pci/saa7134/saa7134-core.c | 14 ++--- drivers/media/usb/cx231xx/cx231xx-core.c | 16 ++---- drivers/media/usb/tm6000/tm6000-core.c | 24 +++------- drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c | 13 ++--- drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c | 5 -- drivers/net/ethernet/sfc/ptp.c | 20 +++----- drivers/net/wireless/ath/dfs_pattern_detector.c | 15 ++---- sound/soc/intel/atom/sst/sst_loader.c | 10 +--- sound/soc/intel/skylake/skl-pcm.c | 8 +-- sound/soc/intel/skylake/skl-topology.c | 5 -- 10 files changed, 53 insertions(+), 77 deletions(-)
Comments
On Sun, 26 Jul 2020 12:58:25 +0200, Julia Lawall wrote: > The various list iterators are able to handle an empty list. > The only effect of avoiding the loop is not initializing some > index variables. > Drop list_empty tests in cases where these variables are not > used. > > The semantic patch that makes these changes is as follows: > (http://coccinelle.lip6.fr/) > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next Thanks! [1/1] ASoC: Intel: drop unnecessary list_empty commit: a383308e50244a28fe927b9c1acbe0a963bf186b All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark