From patchwork Wed Oct 24 07:35:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 10654303 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9130B14BB for ; Wed, 24 Oct 2018 07:38:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77E5D29DCC for ; Wed, 24 Oct 2018 07:38:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A4AF29DEE; Wed, 24 Oct 2018 07:38:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AC35729DCC for ; Wed, 24 Oct 2018 07:38:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=lSqDE/wrv8Du33CpXCMNj501g7hQo9w4NYv5l5JQhCQ=; b=LGc l6zFAQhGC9bgh5ZozmsfhqT0Wwt2BOy9CMB4+aJt35hBgkV8fF+bEV+kz7xZdPodLA+xQ/noXLZ7A IHRfLzptDiYNuvTVNSjvVMC3TdjjbX7kBc1Zl2/AaYjuxklEFQfmgBR/ivn83rl33swZ0hoXEsTi3 p+f54Viz9bf4PaHx4TypcgqGrxK6hKlrqqmdG7hHCa904rO9D2lCDBdj2XhWlV3eA/in0HQF7UnYf j6+LxU9r08aJ1BSh5MlL2dS6AKINrkVtPCW8Upxt4ANYE9qt36tIrayGmUkKas/qOUUTuA0wfh6lL 4LGG/ci8hYBvGYCx5j/TzswF+El2Cng==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gFDkC-00037i-SN; Wed, 24 Oct 2018 07:38:20 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gFDi9-0002Bj-Th for linux-arm-kernel@lists.infradead.org; Wed, 24 Oct 2018 07:38:14 +0000 Received: by mail-wm1-x343.google.com with SMTP id 189-v6so4254505wmw.2 for ; Wed, 24 Oct 2018 00:36:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=++AfYWWrLqJTxzNSR1D5w/4MmESVT6V4dLevIoAsDqs=; b=eTQKXXemhvSI/pK7zTKaD+mADiv2JMTOOJqMt7IrXJHBUl/Vvj15p9uAg/h2aa1PyA 8IjvpCq3NO2p/AVJieeA/Yb+uQt/jajn+Z9VCbq4KPFFOQ9wFBqfENpV8Wv7UlJ6AiWn +shG771dN4vpxm5glqVE6w6O9PeuBgHsKK1lFg/M/sqLW+5gb7FsnJDYVkNJXSvuJmnC ryPCDjm9m095pSV7Do4eXUYVFjCO+jLtSJ6se2KZvZxhuN+zb0g7KxWFnd/UgrD2ityy Tqr15Iezn0e8AliCFw3xvV9TfdiWAvEZq7HBsMoh/hCkC5lOS9uloU8eK0asYLeSLgU+ tbYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=++AfYWWrLqJTxzNSR1D5w/4MmESVT6V4dLevIoAsDqs=; b=QXkLOj9iBJJ+j7YHQQN722m6BdNhpPE6sTn3CV9qlBfqVk3rTn9PyVM7T/JvKmLctd oIlto6yj7PvM5laZfY6u5xe0P+K/KGQ9hcY7V9lgIVWUFWZ2yvr4FGeu1Ipb1uYef0Ow /OciUtJgxbb+EbJGJWH2b9NSUfscN9FCCNTv0HsEnLm1oWcKymaL7UYBUhWmX9MU71Bp 4OFSfVJAF3g3L4xbQ9g9XVwP+CPn5ZnIy4hLTC7MJQ9gTRHBY29UsH+zdGzwDzrTlSTd 9HSVZZ0eaY2ZnxFGvg6f9P8boCJ1FfiUIMEhw08G65s9ga54xHVyIRsq4wgFbMkoxGmD s5gw== X-Gm-Message-State: AGRZ1gKMcSdKXfe1vgp1P7eSm2J+tMs1Ng7TTl+g31kMMSuKTrwqZts+ LDlxiEUykxd2Up46wLuoVhb8tA== X-Google-Smtp-Source: AJdET5ecwasJrJmZYl29u6UbjMcKiY18v+XaQw7sjr2pJnkPVWhVoZuN/SqjF1g+GlxU+ZeQz1BkxQ== X-Received: by 2002:a1c:a345:: with SMTP id m66-v6mr1497386wme.104.1540366561516; Wed, 24 Oct 2018 00:36:01 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id b139-v6sm6254351wmd.36.2018.10.24.00.36.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Oct 2018 00:36:00 -0700 (PDT) From: Corentin Labbe To: Gilles.Muller@lip6.fr, Julia.Lawall@lip6.fr, agust@denx.de, airlied@linux.ie, alexandre.torgue@st.com, alistair@popple.id.au, benh@kernel.crashing.org, carlo@caione.org, davem@davemloft.net, galak@kernel.crashing.org, joabreu@synopsys.com, khilman@baylibre.com, matthias.bgg@gmail.com, maxime.ripard@bootlin.com, michal.lkml@markovi.net, mpe@ellerman.id.au, mporter@kernel.crashing.org, narmstrong@baylibre.com, nicolas.palix@imag.fr, oss@buserror.net, paulus@samba.org, peppe.cavallaro@st.com, tj@kernel.org, vitb@kernel.crashing.org, wens@csie.org Subject: [PATCH v3 0/7] include: add setbits32/clrbits32/clrsetbits32/setbits64/clrbits64/clrsetbits64 Date: Wed, 24 Oct 2018 07:35:46 +0000 Message-Id: <1540366553-18541-1-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181024_003614_073526_B750ABF1 X-CRM114-Status: GOOD ( 17.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-ide@vger.kernel.org, linux-sunxi@googlegroups.com, linux-mediatek@lists.infradead.org, Corentin Labbe , linux-amlogic@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, cocci@systeme.lip6.fr, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hello This patchset adds a new set of functions which are open-coded in lot of place. Basicly the pattern is always the same, "read, modify a bit, write" some driver and the powerpc arch already have thoses pattern them as functions. (like ahci_sunxi.c or dwmac-meson8b) The first patch rename some powerpc functions for being consistent with the new name convention. The second patch adds the header with all setbits functions. The third patch is a try to implement a coccinelle semantic patch to find all place where xxxbits function could be used. It should not be merged since it is un-finalized. For the moment, the "add setbits.h header" is not working and need a future coccinelle version. The four last patch are example of some drivers conversion. Thoses patchs give an example of the reduction of code won by using xxxbits32. I would like to thanks Julia Lawall for her help on the coccinelle patch. Note that I dont know which maintainer will take the linux/setbits.h include patch. Regards Changes since v2: - Fixed patch title - Fixed style problems - shorted macro arguments name Changes since v1: - renamed LE functions to _leXX - updated coccinnelle patch with JLawall's comments Corentin Labbe (7): powerpc: rename setbits32/clrbits32 to setbits_be32/clrbits_be32 include: add setbits_leXX/clrbits_leXX/clrsetbits_leXX in linux/setbits.h coccinelle: add xxxsetbits_leXX converting spatch ata: ahci_sunxi: use xxxsetbitsi_le32 functions net: ethernet: stmmac: dwmac-sun8i: use xxxsetbits_le32 drm: meson: use xxxsetbits_le32 net: stmmac: dwmac-meson8b: use xxxsetbits_le32 arch/powerpc/include/asm/fsl_lbc.h | 2 +- arch/powerpc/include/asm/io.h | 4 +- arch/powerpc/platforms/44x/canyonlands.c | 4 +- arch/powerpc/platforms/4xx/gpio.c | 28 +- arch/powerpc/platforms/512x/pdm360ng.c | 6 +- arch/powerpc/platforms/52xx/mpc52xx_common.c | 6 +- arch/powerpc/platforms/52xx/mpc52xx_gpt.c | 12 +- arch/powerpc/platforms/82xx/ep8248e.c | 2 +- arch/powerpc/platforms/82xx/km82xx.c | 6 +- arch/powerpc/platforms/82xx/mpc8272_ads.c | 10 +- arch/powerpc/platforms/82xx/pq2.c | 2 +- arch/powerpc/platforms/82xx/pq2ads-pci-pic.c | 4 +- arch/powerpc/platforms/82xx/pq2fads.c | 10 +- arch/powerpc/platforms/83xx/km83xx.c | 6 +- arch/powerpc/platforms/83xx/mpc836x_mds.c | 2 +- arch/powerpc/platforms/85xx/mpc85xx_mds.c | 2 +- arch/powerpc/platforms/85xx/mpc85xx_pm_ops.c | 4 +- arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 2 +- arch/powerpc/platforms/85xx/p1022_ds.c | 6 +- arch/powerpc/platforms/85xx/p1022_rdk.c | 6 +- arch/powerpc/platforms/85xx/t1042rdb_diu.c | 6 +- arch/powerpc/platforms/85xx/twr_p102x.c | 2 +- arch/powerpc/platforms/86xx/mpc8610_hpcd.c | 6 +- arch/powerpc/platforms/8xx/adder875.c | 2 +- arch/powerpc/platforms/8xx/m8xx_setup.c | 4 +- arch/powerpc/platforms/8xx/mpc86xads_setup.c | 4 +- arch/powerpc/platforms/8xx/mpc885ads_setup.c | 28 +- .../platforms/embedded6xx/flipper-pic.c | 6 +- arch/powerpc/platforms/embedded6xx/hlwd-pic.c | 8 +- arch/powerpc/platforms/embedded6xx/wii.c | 12 +- arch/powerpc/sysdev/cpm1.c | 26 +- arch/powerpc/sysdev/cpm2.c | 16 +- arch/powerpc/sysdev/cpm_common.c | 4 +- arch/powerpc/sysdev/fsl_85xx_l2ctlr.c | 16 +- arch/powerpc/sysdev/fsl_lbc.c | 2 +- arch/powerpc/sysdev/fsl_pci.c | 12 +- arch/powerpc/sysdev/fsl_pmc.c | 2 +- arch/powerpc/sysdev/fsl_rcpm.c | 74 +-- arch/powerpc/sysdev/fsl_rio.c | 4 +- arch/powerpc/sysdev/fsl_rmu.c | 9 +- arch/powerpc/sysdev/mpic_timer.c | 12 +- drivers/ata/ahci_sunxi.c | 62 +-- drivers/gpu/drm/meson/meson_crtc.c | 14 +- drivers/gpu/drm/meson/meson_dw_hdmi.c | 33 +- drivers/gpu/drm/meson/meson_plane.c | 13 +- drivers/gpu/drm/meson/meson_registers.h | 3 - drivers/gpu/drm/meson/meson_venc.c | 13 +- drivers/gpu/drm/meson/meson_venc_cvbs.c | 4 +- drivers/gpu/drm/meson/meson_viu.c | 65 +-- drivers/gpu/drm/meson/meson_vpp.c | 22 +- .../ethernet/stmicro/stmmac/dwmac-meson8b.c | 56 +- .../net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 62 +-- include/linux/setbits.h | 84 +++ scripts/add_new_include_in_source.py | 61 +++ scripts/coccinelle/misc/setbits32.cocci | 487 ++++++++++++++++++ .../coccinelle/misc/setbits32_relaxed.cocci | 487 ++++++++++++++++++ scripts/coccinelle/misc/setbits64.cocci | 487 ++++++++++++++++++ scripts/coccinelle/misc/setbits_dev.cocci | 235 +++++++++ 58 files changed, 2172 insertions(+), 395 deletions(-) create mode 100644 include/linux/setbits.h create mode 100755 scripts/add_new_include_in_source.py create mode 100644 scripts/coccinelle/misc/setbits32.cocci create mode 100644 scripts/coccinelle/misc/setbits32_relaxed.cocci create mode 100644 scripts/coccinelle/misc/setbits64.cocci create mode 100644 scripts/coccinelle/misc/setbits_dev.cocci