From patchwork Mon Sep 24 19:04:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 10612787 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 30C6E6CB for ; Mon, 24 Sep 2018 19:06:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22912285E5 for ; Mon, 24 Sep 2018 19:06:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1528E297AF; Mon, 24 Sep 2018 19:06:24 +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 E6518285E5 for ; Mon, 24 Sep 2018 19:06:22 +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=/tQRbAJ9bRHRFOsTI4c71Iyn3evxZfY4QU8sI9p2q80=; b=cSA HJ93r5etKzxxaEniHFQd9TeCqWb9rZBZm3vq90diGlxJHZMQrkkvkeJ5sKRwQlMkDBFFreV1H+F82 Cfu7Xw2rE/pUQDwT2HQTcICb4DlwI/g9mSW8jL2/qNjRmA4ymAulHvBmq2aBQS72x+NYRdGjDy1GZ WH3u4EJVVGaqP0Ip4nBODGGHxKfhmY8vIqKAnqtuGVLVTdbtsgmcjtlphOmEuob1MvMl2sPUvH9Fi /plTtMnYWKsUUFk9EuixIBvEAA/DT4MiCZd2v4BxF7JXiuJZ/Nzk8GiVZmjTq9fVymK3EknTE6MT1 2/Chq5Hru2/jRGh0N+GH1WuNZikjvUg==; 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 1g4WBZ-0002F2-DL; Mon, 24 Sep 2018 19:06:21 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g4WAE-0000gv-F3 for linux-amlogic@lists.infradead.org; Mon, 24 Sep 2018 19:05:02 +0000 Received: by mail-wr1-x444.google.com with SMTP id n11-v6so9581241wro.0 for ; Mon, 24 Sep 2018 12:04:27 -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=CXzqLYDJT5LdMFeEVSUl94tAA+pEPy0TinYRdbAL5OE=; b=cF/lbiPGCIm7zb0NVTJvQjrQ9jblElUxUkPR4HtQI/bDqOKaRR9z7UkXu3p73+r8KZ 1Jc46oQNZgXVmFFfoS40heI0CzECi/qlA824Mf96eNp86XXpQ5rmvcnvN+JsH9hJy4Cp ASrRuZDJ3DASjxVbwhVJU4kA+F0humbTfWDWRBa7uFD7CJhJbIiX3c1Oi/u3WbHevqzT TNdv9eQslFnprUr0b6qo7471XaniQDeWda0IHjY5qF6ZEpyqlZtzG/N+clJnaS8jT067 rCl+COO5AWVGo1/YMxpnI/QmJugKzoOhSKPxE6eToiLPvNBr4bcQMelt/PU8CcBTFddJ NMPQ== 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=CXzqLYDJT5LdMFeEVSUl94tAA+pEPy0TinYRdbAL5OE=; b=jTJPIfz0+B5pu6HsN8vEUCJ130u3l87sPkIp72JqCqf15QixFkwsKikJB643fXtSS5 usuI63RBltwO4Bh9y8kN4gJHdsvLYG+AjXE++G+Cov1ho769RSoL78+NVWQzWZnYOgHf J75grBOleOslaXesCflRbhONQasAEbe00ulzGZ9NcAQzhWErbwVe+S0vs9rJzJIOub95 31dTc9pLVxp/DpmOIN8gVwmbEbxHrgYPgr+QWaixMOVc4zCmIeeW3xEn3AuaQ+ExvO0V 0qUi78xD9XV0Ja1tTreOuBRQAS4DLaJtEONe+bv4CMaJNTntfxkp14Nh4rC5tX8Y/DaO 3wFg== X-Gm-Message-State: ABuFfohFtL0K/4iMNFH62tk4/zJ131XASZm7gtG9GGHfxU2gPuVuT3qJ LzD21gMf2S1vtP5J5Cboxe9nxg== X-Google-Smtp-Source: ACcGV60KCy6nkmSpa7hOv1wUwZrswRGOY6XMgZUvZa+g+cjcwIWEpGy5m62J0o/pDoqgzJxexJDMmQ== X-Received: by 2002:adf:ae01:: with SMTP id x1-v6mr140270wrc.45.1537815866454; Mon, 24 Sep 2018 12:04:26 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id e141-v6sm27721433wmd.32.2018.09.24.12.04.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Sep 2018 12:04:25 -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, 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 v2 0/7] include: add setbits32/clrbits32/clrsetbits32/setbits64/clrbits64/clrsetbits64 Date: Mon, 24 Sep 2018 19:04:09 +0000 Message-Id: <1537815856-31728-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-20180924_120458_580876_4FD2856C X-CRM114-Status: GOOD ( 15.26 ) 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, dri-devel@lists.freedesktop.org, linux-ide@vger.kernel.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-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 and the powerpc arch already have thoses pattern them as functions. (like ahci_sunxi.c or dwmac-meson8b) The first patch rename some powerpc funtions 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 convertion. 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. Regards Changes since v1: - renamed LE functions to _leXX - updated coccinnelle patch with JLawall's comments Corentin Labbe (7): 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 ata: ahci_sunxi: use xxxsetbits32 functions net: ethernet: stmmac: dwmac-sun8i: use xxxsetbits32 drm: meson: use xxxsetbits32 net: stmmac: dwmac-meson8b: use xxxsetbits32 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 +-- 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 +- .../net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 56 +-- drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 62 +-- include/linux/setbits.h | 88 ++++ scripts/add_new_include_in_source.py | 61 +++ scripts/coccinelle/misc/setbits32.cocci | 487 +++++++++++++++++++++ scripts/coccinelle/misc/setbits32_relaxed.cocci | 487 +++++++++++++++++++++ scripts/coccinelle/misc/setbits64.cocci | 487 +++++++++++++++++++++ scripts/coccinelle/misc/setbits_dev.cocci | 235 ++++++++++ 58 files changed, 2159 insertions(+), 377 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