forked from Minki/linux
b9754568ef
Doing some various "make randconfig", I came across an error when CONFIG_BUG was not set: arch/powerpc/kernel/module.c: In function 'module_find_bug': arch/powerpc/kernel/module.c:111: error: increment of pointer to unknown structure arch/powerpc/kernel/module.c:111: error: arithmetic on pointer to an incomplete type arch/powerpc/kernel/module.c:112: error: dereferencing pointer to incomplete type Looking further into this, I found that module_find_bug, defined in powerpc arch code, is not called anywhere, so this just removes it. There is a static module_find_bug in lib/bug.c but that is a separate issue. Signed-off-by: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
102 lines
2.7 KiB
C
102 lines
2.7 KiB
C
/* Kernel module help for powerpc.
|
|
Copyright (C) 2001, 2003 Rusty Russell IBM Corporation.
|
|
Copyright (C) 2008 Freescale Semiconductor, Inc.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
#include <linux/module.h>
|
|
#include <linux/elf.h>
|
|
#include <linux/moduleloader.h>
|
|
#include <linux/err.h>
|
|
#include <linux/vmalloc.h>
|
|
#include <linux/bug.h>
|
|
#include <asm/module.h>
|
|
#include <asm/uaccess.h>
|
|
#include <asm/firmware.h>
|
|
#include <linux/sort.h>
|
|
|
|
#include "setup.h"
|
|
|
|
LIST_HEAD(module_bug_list);
|
|
|
|
void *module_alloc(unsigned long size)
|
|
{
|
|
if (size == 0)
|
|
return NULL;
|
|
|
|
return vmalloc_exec(size);
|
|
}
|
|
|
|
/* Free memory returned from module_alloc */
|
|
void module_free(struct module *mod, void *module_region)
|
|
{
|
|
vfree(module_region);
|
|
/* FIXME: If module_region == mod->init_region, trim exception
|
|
table entries. */
|
|
}
|
|
|
|
static const Elf_Shdr *find_section(const Elf_Ehdr *hdr,
|
|
const Elf_Shdr *sechdrs,
|
|
const char *name)
|
|
{
|
|
char *secstrings;
|
|
unsigned int i;
|
|
|
|
secstrings = (char *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
|
|
for (i = 1; i < hdr->e_shnum; i++)
|
|
if (strcmp(secstrings+sechdrs[i].sh_name, name) == 0)
|
|
return &sechdrs[i];
|
|
return NULL;
|
|
}
|
|
|
|
int module_finalize(const Elf_Ehdr *hdr,
|
|
const Elf_Shdr *sechdrs, struct module *me)
|
|
{
|
|
const Elf_Shdr *sect;
|
|
int err;
|
|
|
|
err = module_bug_finalize(hdr, sechdrs, me);
|
|
if (err)
|
|
return err;
|
|
|
|
/* Apply feature fixups */
|
|
sect = find_section(hdr, sechdrs, "__ftr_fixup");
|
|
if (sect != NULL)
|
|
do_feature_fixups(cur_cpu_spec->cpu_features,
|
|
(void *)sect->sh_addr,
|
|
(void *)sect->sh_addr + sect->sh_size);
|
|
|
|
#ifdef CONFIG_PPC64
|
|
sect = find_section(hdr, sechdrs, "__fw_ftr_fixup");
|
|
if (sect != NULL)
|
|
do_feature_fixups(powerpc_firmware_features,
|
|
(void *)sect->sh_addr,
|
|
(void *)sect->sh_addr + sect->sh_size);
|
|
#endif
|
|
|
|
sect = find_section(hdr, sechdrs, "__lwsync_fixup");
|
|
if (sect != NULL)
|
|
do_lwsync_fixups(cur_cpu_spec->cpu_features,
|
|
(void *)sect->sh_addr,
|
|
(void *)sect->sh_addr + sect->sh_size);
|
|
|
|
return 0;
|
|
}
|
|
|
|
void module_arch_cleanup(struct module *mod)
|
|
{
|
|
module_bug_cleanup(mod);
|
|
}
|