linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Corentin Labbe <clabbe@baylibre.com>
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
Cc: cocci@systeme.lip6.fr, dri-devel@lists.freedesktop.org,
	linux-amlogic@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, linux-ide@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org,
	linux-sunxi@googlegroups.com,
	Corentin Labbe <clabbe@baylibre.com>
Subject: [PATCH v3 0/7] include: add setbits32/clrbits32/clrsetbits32/setbits64/clrbits64/clrsetbits64
Date: Wed, 24 Oct 2018 07:35:46 +0000	[thread overview]
Message-ID: <1540366553-18541-1-git-send-email-clabbe@baylibre.com> (raw)

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

-- 
2.18.1


             reply	other threads:[~2018-10-24  7:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-24  7:35 Corentin Labbe [this message]
2018-10-24  7:35 ` [PATCH v3 1/7] powerpc: rename setbits32/clrbits32 to setbits_be32/clrbits_be32 Corentin Labbe
2018-10-24  7:35 ` [PATCH v3 2/7] include: add setbits_leXX/clrbits_leXX/clrsetbits_leXX in linux/setbits.h Corentin Labbe
2018-10-24 22:46   ` Jakub Kicinski
2018-10-24  7:35 ` [PATCH v3 3/7 DONOTMERGE] coccinelle: add xxxsetbits_leXX converting spatch Corentin Labbe
2018-10-24  7:35 ` [PATCH v3 4/7] ata: ahci_sunxi: use xxxsetbitsi_le32 functions Corentin Labbe
2018-10-24  7:57   ` Sergei Shtylyov
2018-10-24  7:35 ` [PATCH v3 5/7] net: ethernet: stmmac: dwmac-sun8i: use xxxsetbits_le32 Corentin Labbe
2018-10-24  7:35 ` [PATCH v3 6/7] drm: meson: " Corentin Labbe
2018-10-24  7:35 ` [PATCH v3 7/7] net: stmmac: dwmac-meson8b: " Corentin Labbe
2018-10-24  8:57 ` [PATCH v3 0/7] include: add setbits32/clrbits32/clrsetbits32/setbits64/clrbits64/clrsetbits64 Russell King - ARM Linux
2018-11-15  9:30   ` LABBE Corentin
2018-11-15  9:33     ` Russell King - ARM Linux
2018-11-15 12:24       ` LABBE Corentin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1540366553-18541-1-git-send-email-clabbe@baylibre.com \
    --to=clabbe@baylibre.com \
    --cc=Gilles.Muller@lip6.fr \
    --cc=Julia.Lawall@lip6.fr \
    --cc=agust@denx.de \
    --cc=airlied@linux.ie \
    --cc=alexandre.torgue@st.com \
    --cc=alistair@popple.id.au \
    --cc=benh@kernel.crashing.org \
    --cc=carlo@caione.org \
    --cc=cocci@systeme.lip6.fr \
    --cc=davem@davemloft.net \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=galak@kernel.crashing.org \
    --cc=joabreu@synopsys.com \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=matthias.bgg@gmail.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=michal.lkml@markovi.net \
    --cc=mpe@ellerman.id.au \
    --cc=mporter@kernel.crashing.org \
    --cc=narmstrong@baylibre.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.palix@imag.fr \
    --cc=oss@buserror.net \
    --cc=paulus@samba.org \
    --cc=peppe.cavallaro@st.com \
    --cc=tj@kernel.org \
    --cc=vitb@kernel.crashing.org \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).