All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <oss@buserror.net>
To: Corentin Labbe <clabbe@baylibre.com>,
	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,
	paulus@samba.org, peppe.cavallaro@st.com, tj@kernel.org,
	vitb@kernel.crashing.org, wens@csie.org
Cc: cocci@systeme.lip6.fr, linux-amlogic@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, linux-ide@vger.kernel.org,
	linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	netdev@vger.kernel.org, linux-sunxi@googlegroups.com
Subject: Re: [PATCH 2/5] include: add setbits32/clrbits32/clrsetbits32/setbits64/clrbits64/clrsetbits64 in linux/setbits.h
Date: Fri, 07 Sep 2018 15:00:40 -0500	[thread overview]
Message-ID: <8bfa1740800ca494028350addd7c874a8b4804bb.camel@buserror.net> (raw)
In-Reply-To: <1536349307-20714-3-git-send-email-clabbe@baylibre.com>

On Fri, 2018-09-07 at 19:41 +0000, Corentin Labbe wrote:
> This patch adds setbits32/clrbits32/clrsetbits32 and
> setbits64/clrbits64/clrsetbits64 in linux/setbits.h header.
> 
> Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
> ---
>  include/linux/setbits.h | 55
> +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 55 insertions(+)
>  create mode 100644 include/linux/setbits.h
> 
> diff --git a/include/linux/setbits.h b/include/linux/setbits.h
> new file mode 100644
> index 000000000000..3e1e273551bb
> --- /dev/null
> +++ b/include/linux/setbits.h
> @@ -0,0 +1,55 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef __LINUX_SETBITS_H
> +#define __LINUX_SETBITS_H
> +
> +#include <linux/io.h>
> +
> +#define __setbits(readfunction, writefunction, addr, set) \
> +	writefunction((readfunction(addr) | (set)), addr)
> +#define __clrbits(readfunction, writefunction, addr, mask) \
> +	writefunction((readfunction(addr) & ~(mask)), addr)
> +#define __clrsetbits(readfunction, writefunction, addr, mask, set) \
> +	writefunction(((readfunction(addr) & ~(mask)) | (set)), addr)
> +#define __setclrbits(readfunction, writefunction, addr, mask, set) \
> +	writefunction(((readfunction(addr) | (seti)) & ~(mask)), addr)
> +
> +#define setbits32(addr, set) __setbits(readl, writel, addr, set)
> +#define setbits32_relaxed(addr, set) __setbits(readl_relaxed,
> writel_relaxed, \
> +					       addr, set)
> +
> +#define clrbits32(addr, mask) __clrbits(readl, writel, addr, mask)
> +#define clrbits32_relaxed(addr, mask) __clrbits(readl_relaxed,
> writel_relaxed, \
> +						addr, mask)

So now setbits32/clrbits32 is implicitly little-endian?  Introducing new
implicit-endian accessors is probably a bad thing in general, but doing it
with a name that until this patchset was implicitly big-endian (at least on
powerpc) seems worse.  Why not setbits32_le()?


> +
> +#define clrsetbits32(addr, mask, set) __clrsetbits(readl, writel, addr,
> mask, set)
> +#define clrsetbits32_relaxed(addr, mask, set) __clrsetbits(readl_relaxed, \
> +							   writel_relaxed,
> \
> +							   addr, mask, set)
> +
> +#define setclrbits32(addr, mask, set) __setclrbits(readl, writel, addr,
> mask, set)
> +#define setclrbits32_relaxed(addr, mask, set) __setclrbits(readl_relaxed, \
> +							   writel_relaxed,
> \
> +							   addr, mask, set)

What's the use case for setclrbits?  I don't see it used anywhere in this
patchset (not even in the coccinelle patterns), it doesn't seem like it would
be a common pattern, and it could easily get confused with clrsetbits.

-Scott

WARNING: multiple messages have this Message-ID (diff)
From: oss@buserror.net (Scott Wood)
To: cocci@systeme.lip6.fr
Subject: [Cocci] [PATCH 2/5] include: add setbits32/clrbits32/clrsetbits32/setbits64/clrbits64/clrsetbits64 in linux/setbits.h
Date: Fri, 07 Sep 2018 15:00:40 -0500	[thread overview]
Message-ID: <8bfa1740800ca494028350addd7c874a8b4804bb.camel@buserror.net> (raw)
In-Reply-To: <1536349307-20714-3-git-send-email-clabbe@baylibre.com>

On Fri, 2018-09-07 at 19:41 +0000, Corentin Labbe wrote:
> This patch adds setbits32/clrbits32/clrsetbits32 and
> setbits64/clrbits64/clrsetbits64 in linux/setbits.h header.
> 
> Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
> ---
>  include/linux/setbits.h | 55
> +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 55 insertions(+)
>  create mode 100644 include/linux/setbits.h
> 
> diff --git a/include/linux/setbits.h b/include/linux/setbits.h
> new file mode 100644
> index 000000000000..3e1e273551bb
> --- /dev/null
> +++ b/include/linux/setbits.h
> @@ -0,0 +1,55 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef __LINUX_SETBITS_H
> +#define __LINUX_SETBITS_H
> +
> +#include <linux/io.h>
> +
> +#define __setbits(readfunction, writefunction, addr, set) \
> +	writefunction((readfunction(addr) | (set)), addr)
> +#define __clrbits(readfunction, writefunction, addr, mask) \
> +	writefunction((readfunction(addr) & ~(mask)), addr)
> +#define __clrsetbits(readfunction, writefunction, addr, mask, set) \
> +	writefunction(((readfunction(addr) & ~(mask)) | (set)), addr)
> +#define __setclrbits(readfunction, writefunction, addr, mask, set) \
> +	writefunction(((readfunction(addr) | (seti)) & ~(mask)), addr)
> +
> +#define setbits32(addr, set) __setbits(readl, writel, addr, set)
> +#define setbits32_relaxed(addr, set) __setbits(readl_relaxed,
> writel_relaxed, \
> +					       addr, set)
> +
> +#define clrbits32(addr, mask) __clrbits(readl, writel, addr, mask)
> +#define clrbits32_relaxed(addr, mask) __clrbits(readl_relaxed,
> writel_relaxed, \
> +						addr, mask)

So now setbits32/clrbits32 is implicitly little-endian?  Introducing new
implicit-endian accessors is probably a bad thing in general, but doing it
with a name that until this patchset was implicitly big-endian (at least on
powerpc) seems worse.  Why not setbits32_le()?


> +
> +#define clrsetbits32(addr, mask, set) __clrsetbits(readl, writel, addr,
> mask, set)
> +#define clrsetbits32_relaxed(addr, mask, set) __clrsetbits(readl_relaxed, \
> +							   writel_relaxed,
> \
> +							   addr, mask, set)
> +
> +#define setclrbits32(addr, mask, set) __setclrbits(readl, writel, addr,
> mask, set)
> +#define setclrbits32_relaxed(addr, mask, set) __setclrbits(readl_relaxed, \
> +							   writel_relaxed,
> \
> +							   addr, mask, set)

What's the use case for setclrbits?  I don't see it used anywhere in this
patchset (not even in the coccinelle patterns), it doesn't seem like it would
be a common pattern, and it could easily get confused with clrsetbits.

-Scott

WARNING: multiple messages have this Message-ID (diff)
From: oss@buserror.net (Scott Wood)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/5] include: add setbits32/clrbits32/clrsetbits32/setbits64/clrbits64/clrsetbits64 in linux/setbits.h
Date: Fri, 07 Sep 2018 15:00:40 -0500	[thread overview]
Message-ID: <8bfa1740800ca494028350addd7c874a8b4804bb.camel@buserror.net> (raw)
In-Reply-To: <1536349307-20714-3-git-send-email-clabbe@baylibre.com>

On Fri, 2018-09-07 at 19:41 +0000, Corentin Labbe wrote:
> This patch adds setbits32/clrbits32/clrsetbits32 and
> setbits64/clrbits64/clrsetbits64 in linux/setbits.h header.
> 
> Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
> ---
>  include/linux/setbits.h | 55
> +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 55 insertions(+)
>  create mode 100644 include/linux/setbits.h
> 
> diff --git a/include/linux/setbits.h b/include/linux/setbits.h
> new file mode 100644
> index 000000000000..3e1e273551bb
> --- /dev/null
> +++ b/include/linux/setbits.h
> @@ -0,0 +1,55 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef __LINUX_SETBITS_H
> +#define __LINUX_SETBITS_H
> +
> +#include <linux/io.h>
> +
> +#define __setbits(readfunction, writefunction, addr, set) \
> +	writefunction((readfunction(addr) | (set)), addr)
> +#define __clrbits(readfunction, writefunction, addr, mask) \
> +	writefunction((readfunction(addr) & ~(mask)), addr)
> +#define __clrsetbits(readfunction, writefunction, addr, mask, set) \
> +	writefunction(((readfunction(addr) & ~(mask)) | (set)), addr)
> +#define __setclrbits(readfunction, writefunction, addr, mask, set) \
> +	writefunction(((readfunction(addr) | (seti)) & ~(mask)), addr)
> +
> +#define setbits32(addr, set) __setbits(readl, writel, addr, set)
> +#define setbits32_relaxed(addr, set) __setbits(readl_relaxed,
> writel_relaxed, \
> +					       addr, set)
> +
> +#define clrbits32(addr, mask) __clrbits(readl, writel, addr, mask)
> +#define clrbits32_relaxed(addr, mask) __clrbits(readl_relaxed,
> writel_relaxed, \
> +						addr, mask)

So now setbits32/clrbits32 is implicitly little-endian?  Introducing new
implicit-endian accessors is probably a bad thing in general, but doing it
with a name that until this patchset was implicitly big-endian (at least on
powerpc) seems worse.  Why not setbits32_le()?


> +
> +#define clrsetbits32(addr, mask, set) __clrsetbits(readl, writel, addr,
> mask, set)
> +#define clrsetbits32_relaxed(addr, mask, set) __clrsetbits(readl_relaxed, \
> +							   writel_relaxed,
> \
> +							   addr, mask, set)
> +
> +#define setclrbits32(addr, mask, set) __setclrbits(readl, writel, addr,
> mask, set)
> +#define setclrbits32_relaxed(addr, mask, set) __setclrbits(readl_relaxed, \
> +							   writel_relaxed,
> \
> +							   addr, mask, set)

What's the use case for setclrbits?  I don't see it used anywhere in this
patchset (not even in the coccinelle patterns), it doesn't seem like it would
be a common pattern, and it could easily get confused with clrsetbits.

-Scott

WARNING: multiple messages have this Message-ID (diff)
From: oss@buserror.net (Scott Wood)
To: linus-amlogic@lists.infradead.org
Subject: [PATCH 2/5] include: add setbits32/clrbits32/clrsetbits32/setbits64/clrbits64/clrsetbits64 in linux/setbits.h
Date: Fri, 07 Sep 2018 15:00:40 -0500	[thread overview]
Message-ID: <8bfa1740800ca494028350addd7c874a8b4804bb.camel@buserror.net> (raw)
In-Reply-To: <1536349307-20714-3-git-send-email-clabbe@baylibre.com>

On Fri, 2018-09-07 at 19:41 +0000, Corentin Labbe wrote:
> This patch adds setbits32/clrbits32/clrsetbits32 and
> setbits64/clrbits64/clrsetbits64 in linux/setbits.h header.
> 
> Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
> ---
>  include/linux/setbits.h | 55
> +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 55 insertions(+)
>  create mode 100644 include/linux/setbits.h
> 
> diff --git a/include/linux/setbits.h b/include/linux/setbits.h
> new file mode 100644
> index 000000000000..3e1e273551bb
> --- /dev/null
> +++ b/include/linux/setbits.h
> @@ -0,0 +1,55 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef __LINUX_SETBITS_H
> +#define __LINUX_SETBITS_H
> +
> +#include <linux/io.h>
> +
> +#define __setbits(readfunction, writefunction, addr, set) \
> +	writefunction((readfunction(addr) | (set)), addr)
> +#define __clrbits(readfunction, writefunction, addr, mask) \
> +	writefunction((readfunction(addr) & ~(mask)), addr)
> +#define __clrsetbits(readfunction, writefunction, addr, mask, set) \
> +	writefunction(((readfunction(addr) & ~(mask)) | (set)), addr)
> +#define __setclrbits(readfunction, writefunction, addr, mask, set) \
> +	writefunction(((readfunction(addr) | (seti)) & ~(mask)), addr)
> +
> +#define setbits32(addr, set) __setbits(readl, writel, addr, set)
> +#define setbits32_relaxed(addr, set) __setbits(readl_relaxed,
> writel_relaxed, \
> +					       addr, set)
> +
> +#define clrbits32(addr, mask) __clrbits(readl, writel, addr, mask)
> +#define clrbits32_relaxed(addr, mask) __clrbits(readl_relaxed,
> writel_relaxed, \
> +						addr, mask)

So now setbits32/clrbits32 is implicitly little-endian?  Introducing new
implicit-endian accessors is probably a bad thing in general, but doing it
with a name that until this patchset was implicitly big-endian (at least on
powerpc) seems worse.  Why not setbits32_le()?


> +
> +#define clrsetbits32(addr, mask, set) __clrsetbits(readl, writel, addr,
> mask, set)
> +#define clrsetbits32_relaxed(addr, mask, set) __clrsetbits(readl_relaxed, \
> +							   writel_relaxed,
> \
> +							   addr, mask, set)
> +
> +#define setclrbits32(addr, mask, set) __setclrbits(readl, writel, addr,
> mask, set)
> +#define setclrbits32_relaxed(addr, mask, set) __setclrbits(readl_relaxed, \
> +							   writel_relaxed,
> \
> +							   addr, mask, set)

What's the use case for setclrbits?  I don't see it used anywhere in this
patchset (not even in the coccinelle patterns), it doesn't seem like it would
be a common pattern, and it could easily get confused with clrsetbits.

-Scott

  reply	other threads:[~2018-09-07 20:00 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-07 19:41 [PATCH 0/5] introduce setbits32/clrbits32/clrsetbits32/setbits64/clrbits64/clrsetbits64 functions Corentin Labbe
2018-09-07 19:41 ` Corentin Labbe
2018-09-07 19:41 ` Corentin Labbe
2018-09-07 19:41 ` [Cocci] " Corentin Labbe
2018-09-07 19:41 ` [PATCH 1/5] powerpc: rename setbits32/clrbits32 to setbits32_be/clrbits32_be Corentin Labbe
2018-09-07 19:41   ` Corentin Labbe
2018-09-07 19:41   ` Corentin Labbe
2018-09-07 19:41   ` [Cocci] " Corentin Labbe
2018-09-10  5:16   ` Christophe LEROY
2018-09-10  5:16     ` Christophe LEROY
2018-09-10  5:16     ` Christophe LEROY
2018-09-10  5:16     ` [Cocci] " Christophe LEROY
2018-09-10 18:50     ` LABBE Corentin
2018-09-10 18:50       ` LABBE Corentin
2018-09-10 18:50       ` LABBE Corentin
2018-09-10 18:50       ` [Cocci] " LABBE Corentin
2018-09-07 19:41 ` [PATCH 2/5] include: add setbits32/clrbits32/clrsetbits32/setbits64/clrbits64/clrsetbits64 in linux/setbits.h Corentin Labbe
2018-09-07 19:41   ` Corentin Labbe
2018-09-07 19:41   ` Corentin Labbe
2018-09-07 19:41   ` [Cocci] " Corentin Labbe
2018-09-07 20:00   ` Scott Wood [this message]
2018-09-07 20:00     ` Scott Wood
2018-09-07 20:00     ` Scott Wood
2018-09-07 20:00     ` [Cocci] " Scott Wood
2018-09-07 20:00     ` Scott Wood
2018-09-10 18:49     ` LABBE Corentin
2018-09-10 18:49       ` LABBE Corentin
2018-09-10 18:49       ` LABBE Corentin
2018-09-10 18:49       ` [Cocci] " LABBE Corentin
2018-09-10  5:22   ` Christophe LEROY
2018-09-10  5:22     ` Christophe LEROY
2018-09-10  5:22     ` Christophe LEROY
2018-09-10  5:22     ` [Cocci] " Christophe LEROY
2018-09-10 18:53     ` LABBE Corentin
2018-09-10 18:53       ` LABBE Corentin
2018-09-10 18:53       ` LABBE Corentin
2018-09-10 18:53       ` [Cocci] " LABBE Corentin
2018-09-07 19:41 ` [PATCH RFC 3/5] coccinelle: add xxxsetbitsXX converting spatch Corentin Labbe
2018-09-07 19:41   ` Corentin Labbe
2018-09-07 19:41   ` Corentin Labbe
2018-09-07 19:41   ` [Cocci] " Corentin Labbe
2018-09-09 11:13   ` SF Markus Elfring
2018-09-09 11:13     ` SF Markus Elfring
2018-09-09 11:13     ` SF Markus Elfring
2018-09-09 11:13     ` SF Markus Elfring
2018-09-09 11:13     ` SF Markus Elfring
2018-09-09 11:13     ` SF Markus Elfring
2018-09-07 19:41 ` [PATCH 4/5] net: ethernet: stmmac: use xxxsetbits32 Corentin Labbe
2018-09-07 19:41   ` Corentin Labbe
2018-09-07 19:41   ` Corentin Labbe
2018-09-07 19:41   ` [Cocci] " Corentin Labbe
2018-09-07 19:41 ` [PATCH 5/5] ata: ahci_sunxi: use xxxsetbits32 functions Corentin Labbe
2018-09-07 19:41   ` Corentin Labbe
2018-09-07 19:41   ` Corentin Labbe
2018-09-07 19:41   ` [Cocci] " Corentin Labbe
2018-09-07 21:57 ` [PATCH 0/5] introduce setbits32/clrbits32/clrsetbits32/setbits64/clrbits64/clrsetbits64 functions David Miller
2018-09-07 21:57   ` David Miller
2018-09-07 21:57   ` David Miller
2018-09-07 21:57   ` [Cocci] " David Miller
2018-09-10  5:24 ` Christophe LEROY
2018-09-10  5:24   ` Christophe LEROY
2018-09-10  5:24   ` Christophe LEROY
2018-09-10  5:24   ` [Cocci] " Christophe LEROY

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=8bfa1740800ca494028350addd7c874a8b4804bb.camel@buserror.net \
    --to=oss@buserror.net \
    --cc=Gilles.Muller@lip6.fr \
    --cc=Julia.Lawall@lip6.fr \
    --cc=agust@denx.de \
    --cc=alexandre.torgue@st.com \
    --cc=alistair@popple.id.au \
    --cc=benh@kernel.crashing.org \
    --cc=carlo@caione.org \
    --cc=clabbe@baylibre.com \
    --cc=cocci@systeme.lip6.fr \
    --cc=davem@davemloft.net \
    --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-sunxi@googlegroups.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maxime.ripard@bootlin.com \
    --cc=michal.lkml@markovi.net \
    --cc=mpe@ellerman.id.au \
    --cc=mporter@kernel.crashing.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.palix@imag.fr \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.