Re: 2.6.28-rc5: unused variable in pagetable_init

From: Ingo Molnar
Date: Mon Nov 17 2008 - 03:25:42 EST



* Andrey Borzenkov <arvidjaar@xxxxxxx> wrote:

> CC arch/x86/mm/init_32.o
> /home/bor/src/linux-git/arch/x86/mm/init_32.c: In function âpagetable_initâ:
> /home/bor/src/linux-git/arch/x86/mm/init_32.c:515: warning: unused variable âpgd_baseâ
>
> Well, pagetable_init is noop unless HIGHMEM is defined so it could
> be as simple as that.
>
> Or is something else expected to go into pagetable_init for more
> general case?
>
> --- arch/x86/mm/init_32.c 2008-11-10 06:19:14.000000000 +0300
> +++ /tmp/init_32.c 2008-11-17 06:52:21.383685722 +0300
> @@ -435,9 +435,17 @@ static void __init set_highmem_pages_ini
> }
> #endif /* !CONFIG_NUMA */
>
> +static void __init pagetable_init(void)
> +{
> + pgd_t *pgd_base = swapper_pg_dir;
> +
> + permanent_kmaps_init(pgd_base);
> +}
> +
> #else
> # define permanent_kmaps_init(pgd_base) do { } while (0)
> # define set_highmem_pages_init() do { } while (0)
> +# define pagetable_init() do { } while (0)
> #endif /* CONFIG_HIGHMEM */
>
> void __init native_pagetable_setup_start(pgd_t *base)
> @@ -510,13 +518,6 @@ static void __init early_ioremap_page_ta
> early_ioremap_reset();
> }
>
> -static void __init pagetable_init(void)
> -{
> - pgd_t *pgd_base = swapper_pg_dir;
> -
> - permanent_kmaps_init(pgd_base);
> -}
> -
> #ifdef CONFIG_ACPI_SLEEP

The better fix would be to convert permanent_kmaps_init() from a macro
to an (empty) inline. That way CPP does not eat away the code and GCC
will known that the variable is indeed used.

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/