linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Christoph Hellwig <hch@lst.de>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] fix gcc4 warning in asm-ppc/time.h
Date: Wed, 3 Aug 2005 22:15:17 -0700	[thread overview]
Message-ID: <20050803221517.21b54d7e.akpm@osdl.org> (raw)
In-Reply-To: <20050802095509.GA32585@lst.de>

Christoph Hellwig <hch@lst.de> wrote:
>
> A function must not return a const value, instead use
> __attribute_const__.
> 
> 
> Index: linux-2.6/include/asm/time.h
> ===================================================================
> --- linux-2.6.orig/include/asm/time.h	2005-04-30 10:17:19.000000000 +0200
> +++ linux-2.6/include/asm/time.h	2005-08-01 11:57:12.000000000 +0200
> @@ -10,6 +10,7 @@
>  #define __ASM_TIME_H__
>  
>  #include <linux/config.h>
> +#include <linux/compiler.h>
>  #include <linux/types.h>
>  #include <linux/rtc.h>
>  #include <linux/threads.h>
> @@ -58,7 +59,7 @@
>  /* Accessor functions for the timebase (RTC on 601) registers. */
>  /* If one day CONFIG_POWER is added just define __USE_RTC as 1 */
>  #ifdef CONFIG_6xx
> -extern __inline__ int const __USE_RTC(void) {
> +extern __inline__ int __attribute_const__ __USE_RTC(void) {
>  	return (mfspr(SPRN_PVR)>>16) == 1;
>  }
>  #else

Do we really want to do this?  The above implies that mfspr(SPRN_PVR) will
return the same value across the entire uptime of the kernel.  Is that
true?

Why is this function paying with const anyway?

  reply	other threads:[~2005-08-04  5:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-02  9:55 [PATCH] fix gcc4 warning in asm-ppc/time.h Christoph Hellwig
2005-08-04  5:15 ` Andrew Morton [this message]
2005-08-04  5:54   ` Gabriel Paubert
2005-08-04  9:46     ` Benjamin Herrenschmidt
2005-08-04 10:19       ` Gabriel Paubert
2005-08-04 22:19   ` Paul Mackerras
2005-08-04  5:17 ` Andrew Morton

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=20050803221517.21b54d7e.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=hch@lst.de \
    --cc=linuxppc-dev@ozlabs.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).