* [PATCH] alpha: Define pgprot_modify to silence tautological comparison warnings
@ 2026-04-03 15:01 Matt Turner
2026-04-12 8:49 ` Magnus Lindholm
0 siblings, 1 reply; 2+ messages in thread
From: Matt Turner @ 2026-04-03 15:01 UTC (permalink / raw)
To: Magnus Lindholm; +Cc: linux-alpha, linux-kernel, Matt Turner
Alpha's pgprot_noncached, pgprot_writecombine, and pgprot_device are
all identity macros, so the generic pgprot_modify() produces
tautological self-comparisons that GCC warns about:
include/linux/pgtable.h:1701:25: warning: self-comparison always
evaluates to true [-Wtautological-compare]
Since all caching attributes are no-ops on Alpha, define
pgprot_modify() to simply return newprot.
Assisted-by: Claude:claude-opus-4-6
Signed-off-by: Matt Turner <mattst88@gmail.com>
---
arch/alpha/include/asm/pgtable.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git ./arch/alpha/include/asm/pgtable.h ./arch/alpha/include/asm/pgtable.h
index e786f630de5c..849abe2a1f98 100644
--- ./arch/alpha/include/asm/pgtable.h
+++ ./arch/alpha/include/asm/pgtable.h
@@ -126,6 +126,17 @@ struct vm_area_struct;
*/
#define pgprot_noncached(prot) (prot)
+/*
+ * All caching attribute macros are identity on Alpha, so the generic
+ * pgprot_modify() degenerates to tautological self-comparisons.
+ * Override it to just return newprot directly.
+ */
+#define pgprot_modify pgprot_modify
+static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
+{
+ return newprot;
+}
+
/*
* ZERO_PAGE is a global shared page that is always zero: used
* for zero-mapped memory areas etc..
--
2.52.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] alpha: Define pgprot_modify to silence tautological comparison warnings
2026-04-03 15:01 [PATCH] alpha: Define pgprot_modify to silence tautological comparison warnings Matt Turner
@ 2026-04-12 8:49 ` Magnus Lindholm
0 siblings, 0 replies; 2+ messages in thread
From: Magnus Lindholm @ 2026-04-12 8:49 UTC (permalink / raw)
To: Matt Turner; +Cc: linux-alpha, linux-kernel
On Fri, Apr 3, 2026 at 5:01 PM Matt Turner <mattst88@gmail.com> wrote:
>
> Alpha's pgprot_noncached, pgprot_writecombine, and pgprot_device are
> all identity macros, so the generic pgprot_modify() produces
> tautological self-comparisons that GCC warns about:
>
> include/linux/pgtable.h:1701:25: warning: self-comparison always
> evaluates to true [-Wtautological-compare]
>
> Since all caching attributes are no-ops on Alpha, define
> pgprot_modify() to simply return newprot.
>
> Assisted-by: Claude:claude-opus-4-6
> Signed-off-by: Matt Turner <mattst88@gmail.com>
> ---
> arch/alpha/include/asm/pgtable.h | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git ./arch/alpha/include/asm/pgtable.h ./arch/alpha/include/asm/pgtable.h
> index e786f630de5c..849abe2a1f98 100644
> --- ./arch/alpha/include/asm/pgtable.h
> +++ ./arch/alpha/include/asm/pgtable.h
> @@ -126,6 +126,17 @@ struct vm_area_struct;
> */
> #define pgprot_noncached(prot) (prot)
>
> +/*
> + * All caching attribute macros are identity on Alpha, so the generic
> + * pgprot_modify() degenerates to tautological self-comparisons.
> + * Override it to just return newprot directly.
> + */
> +#define pgprot_modify pgprot_modify
> +static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
> +{
> + return newprot;
> +}
> +
> /*
> * ZERO_PAGE is a global shared page that is always zero: used
> * for zero-mapped memory areas etc..
> --
Looks good to me.
Reviewed-by: Magnus Lindholm <linmag7@gmail.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-12 8:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-03 15:01 [PATCH] alpha: Define pgprot_modify to silence tautological comparison warnings Matt Turner
2026-04-12 8:49 ` Magnus Lindholm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®