From patchwork Fri Sep 7 19:41:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 10592495 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 3BD0D14E2 for ; Fri, 7 Sep 2018 19:43:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29F5C2ACCD for ; Fri, 7 Sep 2018 19:43:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1DC602ACD5; Fri, 7 Sep 2018 19:43:19 +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=unavailable 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 993082ACCD for ; Fri, 7 Sep 2018 19:43:18 +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=PejV31rgZPqGjepNfqmh+gOa2a5JCizbdZrUENjI6L4=; b=M28 gKmoSyhUbL2rqtUoM+tVpp/73YKBPCg7CD7iNGc/TUVqNp65DgQl9sn4nEh3tbbgp7SzSStyfnrAF G7k3D+tYeYxhtePaOHw28QH4591spkHXXYUq3xo100gzhEThI6z4oyp8zgKcWHAZaDaLpAh8A/azD P086mlRVh0awZ0gLjFQhI9XePViTIBorclIm0L91+u2MTBt6hdC0dmvGuppdzpzHrjrsuZB4PCTpF CHo9VdpNKWJNkX5/y3eUXF5LaviIed+8XygeAuXPJHYBzJR0wE+YOzgbYQtpKwbI+RREVIBvk7s3F hUGqi+fulWzZcVTlOKsTl8B6tROFKlg==; 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 1fyMew-0003XO-C1; Fri, 07 Sep 2018 19:43:14 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fyMeF-0003BH-PV for linux-amlogic@lists.infradead.org; Fri, 07 Sep 2018 19:42:34 +0000 Received: by mail-wm0-x241.google.com with SMTP id j192-v6so15733718wmj.1 for ; Fri, 07 Sep 2018 12:42:20 -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=vcze1pYGJmRre+gqBos2+YZh6l7eutC3oO5Gb+shdGM=; b=FL67JfrK0ODDs5HLs+TbZp0kZOogIDm2vrOwBcTGxeir06+H2YAgOomiWkbNtPMfda R695fjU7hU31QDiPJtjf0S5WXA7vkp6ngIEuS+E1ic612D8y1AwBehb27GDBQ94H9CVc /PAm5ukHC2kTwtO1oVHJ1itu8ID7ipNGaC95OdAQcUE69B/a0PfCkLvByHVmLZkIHJoS iPcqDQAK7cxN0KxPCMoKyWxXQdPwBXBPNTVcoMddzf+3wqGMLs5UWYquUZUFSmNyTyHC XD+kuscKC1886VCOQ6wCTsrP+p2KlavuKp+7/m92baFF30iO170WRaSD1/fxJSKR243S Q2VA== 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=vcze1pYGJmRre+gqBos2+YZh6l7eutC3oO5Gb+shdGM=; b=cjoijApUmOL8oalm/mQJg0p/HgBxWNuaNrv66uqFVjuJaCMk9HbmkLhvqfdsZaBscE v4biVMenp2NN+OLVTB/WxEqxdu+kd6zIKtT9zxhkvYhytON4q4mkgzFMhcbtqHRp09lZ oWOe4DWOz/eEhj/CvUlA1dgiDx/RuTFgj9D+DSpq5lvJz8qwutZInNQKmXkoNfWnj53a B0kn65NpS0a+Zllq2Oz4MTkQhdVMjiZjT6XgWaE+gQHhxMM+A13chSWSns6aOZ8dKmRX XgFH+vRx0WBRgBve2ZJB3TlU+kKTfxu+rip78hVQsq88KWqpqN2touMMAO6yVGC7r37p TLYQ== X-Gm-Message-State: APzg51BdBrAJ3onhWzG7wl21o8dQiF71Wf/4FSQ+RznhTkaztzyzk7HH 1f1LozZh92MQP7Mr2xgIuXII3g== X-Google-Smtp-Source: ANB0VdYdj+Cy5q69Wxlex6Hhpbp7EmucrJPP4seuhZfgTyJjyOoew3QOv2OKbYBGb5FzHRD+/swzjw== X-Received: by 2002:a1c:7015:: with SMTP id l21-v6mr5923035wmc.81.1536349339071; Fri, 07 Sep 2018 12:42:19 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id y17-v6sm11700133wrh.49.2018.09.07.12.42.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 07 Sep 2018 12:42:18 -0700 (PDT) From: Corentin Labbe To: Gilles.Muller@lip6.fr, Julia.Lawall@lip6.fr, agust@denx.de, 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, maxime.ripard@bootlin.com, michal.lkml@markovi.net, mpe@ellerman.id.au, mporter@kernel.crashing.org, 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 0/5] introduce setbits32/clrbits32/clrsetbits32/setbits64/clrbits64/clrsetbits64 functions Date: Fri, 7 Sep 2018 19:41:42 +0000 Message-Id: <1536349307-20714-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-20180907_124231_861258_EE9AA65E X-CRM114-Status: GOOD ( 12.91 ) X-BeenThere: linux-amlogic@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, linux-ide@vger.kernel.org, linux-sunxi@googlegroups.com, 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-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=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 already have thoses pattern them as functions. (like ahci_sunxi.c or dwmac-meson8b) The first patch rename some powerpc funtions which already use the same name (xxxbits32) but with only bigendian values. The second patch adds the header. The third patch is an ugly try to implement a coccinelle semantic patch to find all place where xxxbits function could be used. Probably this spatch could be better written and I didnt found an easy way to add the "linux/setbits" header. The two last patch are example of convertion of two drivers. Thoses patchs give an example of the reduction of code won by using xxxbits32. This patchset is tested with the ahci_sunxi and dwmac-sun8i drivers. Regards Corentin Labbe (5): powerpc: rename setbits32/clrbits32 to setbits32_be/clrbits32_be include: add setbits32/clrbits32/clrsetbits32/setbits64/clrbits64/clrsetbits64 in linux/setbits.h coccinelle: add xxxsetbitsXX converting spatch net: ethernet: stmmac: use xxxsetbits32 ata: ahci_sunxi: use xxxsetbits32 functions arch/powerpc/include/asm/fsl_lbc.h | 2 +- arch/powerpc/include/asm/io.h | 5 +- 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 | 10 +- 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 | 4 +- arch/powerpc/platforms/85xx/p1022_rdk.c | 4 +- arch/powerpc/platforms/85xx/t1042rdb_diu.c | 4 +- arch/powerpc/platforms/85xx/twr_p102x.c | 2 +- arch/powerpc/platforms/86xx/mpc8610_hpcd.c | 4 +- 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 +- arch/powerpc/platforms/embedded6xx/flipper-pic.c | 6 +- arch/powerpc/platforms/embedded6xx/hlwd-pic.c | 8 +- arch/powerpc/platforms/embedded6xx/wii.c | 10 +- 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 | 8 +- arch/powerpc/sysdev/fsl_lbc.c | 2 +- arch/powerpc/sysdev/fsl_pci.c | 8 +- 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 | 8 +- arch/powerpc/sysdev/mpic_timer.c | 12 +- drivers/ata/ahci_sunxi.c | 51 +-- .../net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 54 +-- drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 55 +-- .../net/ethernet/stmicro/stmmac/dwmac1000_core.c | 21 +- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 51 +-- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 13 +- drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 42 +- drivers/net/ethernet/stmicro/stmmac/dwmac5.c | 11 +- drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c | 17 +- .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 30 +- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 69 +--- .../net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 11 +- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 7 +- include/linux/setbits.h | 55 +++ scripts/coccinelle/misc/setbits.cocci | 423 +++++++++++++++++++++ 56 files changed, 776 insertions(+), 489 deletions(-) create mode 100644 include/linux/setbits.h create mode 100644 scripts/coccinelle/misc/setbits.cocci