Re: volatile function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



kevin diggs <diggskevin38@xxxxxxxxx> writes:

> I may be wearing out my welcome, but:
>
> I tried to use (in a header file):
>
> /**
>  * get_PLL: - return current value of PLL register (HID1)
>  *
>  * This returns the current value of the PLL configuration register (HID1).
>  */
> static inline volatile unsigned int get_PLL(void)
> {
> unsigned int ret;
>
>         __asm__ __volatile__ ("mfspr %0,%1":
>                 "=r"(ret):
>                 "i"(SPRN_HID1)
>         );
>
>         return ret;
> }
>
> to make sure that this function did not get moved or optimized away.
> 4.1.2 generated a warning (Linux kernel compile:  warning -> error).
>
> cc1: warnings being treated as errors
> In file included from arch/powerpc/kernel/cpu/cpufreq/cf750gx.c:37:
> /mnt/mnt3/linux-2.6.36/arch/powerpc/include/asm/pll.h:84: warning:
> type qualifiers ignored on function return type

The warning is correct: volatile is ignored on a function return type.
To avoid the warning, write
    static inline unsigned int get_PLL(void)

If that does not answer your question, what are you trying to do?

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux