Some fixes for "Section mismatch" errors.

From: Peter Teoh
Date: Sat Feb 02 2008 - 11:00:45 EST


Today, I pulled from linus tree, and compile with MANY section
mismatches errors, eg, some of which are like the following:

WARNING: sound/pci/rme9652/snd-hdsp.o(.text+0x1c9f): Section mismatch
in reference from the function hdsp_check_for_firmware() to the
function .devinit.text:hdsp_request_fw_loader()
WARNING: sound/pci/rme9652/snd-hdsp.o(.text+0x35bf): Section mismatch
in reference from the function snd_hdsp_proc_read() to the function
.devinit.text:hdsp_request_fw_loader()

I have attempted the fixes as shown in the attachment - I may be doing
a disservice to the many hours of hardwork put in by everyone - I
apologized for that :-(. Please comment - I am just correcting it
syntactically to overcome all the section mismatches errors I am
encountering. But logic-wise it may be wrong.

Thanks.

Signed-off-by: Peter Teoh <htmldeveloper@xxxxxxxxx>

--- arch/x86/kernel/cpuid.c.orig 2008-02-02 08:17:50.000000000 +0800
+++ arch/x86/kernel/cpuid.c 2008-02-02 19:27:18.000000000 +0800
@@ -134,7 +134,7 @@ static const struct file_operations cpui
.open = cpuid_open,
};

-static __cpuinit int cpuid_device_create(int cpu)
+static int cpuid_device_create(int cpu)
{
struct device *dev;

@@ -148,7 +148,7 @@ static void cpuid_device_destroy(int cpu
device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu));
}

-static int __cpuinit cpuid_class_cpu_callback(struct notifier_block *nfb,
+static int cpuid_class_cpu_callback(struct notifier_block *nfb,
unsigned long action,
void *hcpu)
{
@@ -170,12 +170,12 @@ static int __cpuinit cpuid_class_cpu_cal
return err ? NOTIFY_BAD : NOTIFY_OK;
}

-static struct notifier_block __refdata cpuid_class_cpu_notifier =
+static struct notifier_block cpuid_class_cpu_notifier =
{
.notifier_call = cpuid_class_cpu_callback,
};

-static int __init cpuid_init(void)
+static int __cpuinit cpuid_init(void)
{
int i, err = 0;
i = 0;
--- arch/x86/kernel/microcode.c.orig 2008-02-03 00:01:20.000000000 +0800
+++ arch/x86/kernel/microcode.c 2008-02-02 16:41:58.000000000 +0800
@@ -797,7 +797,7 @@ mc_cpu_callback(struct notifier_block *n
return NOTIFY_OK;
}

-static struct notifier_block __refdata mc_cpu_notifier = {
+static struct notifier_block mc_cpu_notifier __initdata = {
.notifier_call = mc_cpu_callback,
};

@@ -831,7 +831,7 @@ static int __init microcode_init (void)
return 0;
}

-static void __exit microcode_exit (void)
+static void __init microcode_exit (void)
{
microcode_dev_exit();

--- arch/x86/kernel/msr.c.orig 2008-02-03 00:04:42.000000000 +0800
+++ arch/x86/kernel/msr.c 2008-02-02 19:42:47.000000000 +0800
@@ -133,7 +133,7 @@ static const struct file_operations msr_
.open = msr_open,
};

-static int __cpuinit msr_device_create(int cpu)
+static int msr_device_create(int cpu)
{
struct device *dev;

@@ -147,7 +147,7 @@ static void msr_device_destroy(int cpu)
device_destroy(msr_class, MKDEV(MSR_MAJOR, cpu));
}

-static int __cpuinit msr_class_cpu_callback(struct notifier_block *nfb,
+static int msr_class_cpu_callback(struct notifier_block *nfb,
unsigned long action, void *hcpu)
{
unsigned int cpu = (unsigned long)hcpu;
@@ -168,7 +168,7 @@ static int __cpuinit msr_class_cpu_callb
return err ? NOTIFY_BAD : NOTIFY_OK;
}

-static struct notifier_block __refdata msr_class_cpu_notifier = {
+static struct notifier_block msr_class_cpu_notifier = {
.notifier_call = msr_class_cpu_callback,
};

--- drivers/ata/ata_piix.c.orig 2008-02-02 20:38:40.000000000 +0800
+++ drivers/ata/ata_piix.c 2008-02-02 20:41:59.000000000 +0800
@@ -1431,7 +1431,7 @@ static int piix_disable_ahci(struct pci_
* they are found return an error code so we can turn off DMA
*/

-static int __devinit piix_check_450nx_errata(struct pci_dev *ata_dev)
+static int piix_check_450nx_errata(struct pci_dev *ata_dev)
{
struct pci_dev *pdev = NULL;
u16 cfg;
@@ -1455,7 +1455,7 @@ static int __devinit piix_check_450nx_er
return no_piix_dma;
}

-static void __devinit piix_init_pcs(struct ata_host *host,
+static void piix_init_pcs(struct ata_host *host,
const struct piix_map_db *map_db)
{
struct pci_dev *pdev = to_pci_dev(host->dev);
@@ -1472,7 +1472,7 @@ static void __devinit piix_init_pcs(stru
}
}

-static const int *__devinit piix_init_sata_map(struct pci_dev *pdev,
+static const int *piix_init_sata_map(struct pci_dev *pdev,
struct ata_port_info *pinfo,
const struct piix_map_db *map_db)
{
@@ -1519,7 +1519,7 @@ static const int *__devinit piix_init_sa
return map;
}

-static void __devinit piix_init_sidpr(struct ata_host *host)
+static void piix_init_sidpr(struct ata_host *host)
{
struct pci_dev *pdev = to_pci_dev(host->dev);
struct piix_host_priv *hpriv = host->private_data;
--- drivers/char/tpm/tpm_infineon.c.orig 2008-02-02 19:50:34.000000000 +0800
+++ drivers/char/tpm/tpm_infineon.c 2008-02-02 19:57:27.000000000 +0800
@@ -415,7 +415,7 @@ static const struct pnp_device_id tpm_pn

MODULE_DEVICE_TABLE(pnp, tpm_pnp_tbl);

-static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev,
+static int tpm_inf_pnp_probe(struct pnp_dev *dev,
const struct pnp_device_id *dev_id)
{
int rc = 0;
@@ -594,7 +594,7 @@ err_last:
return rc;
}

-static __devexit void tpm_inf_pnp_remove(struct pnp_dev *dev)
+static void tpm_inf_pnp_remove(struct pnp_dev *dev)
{
struct tpm_chip *chip = pnp_get_drvdata(dev);

--- drivers/char/tpm/tpm_nsc.c.orig 2008-02-02 20:00:11.000000000 +0800
+++ drivers/char/tpm/tpm_nsc.c 2008-02-02 20:02:30.000000000 +0800
@@ -264,7 +264,7 @@ static const struct tpm_vendor_specific

static struct platform_device *pdev = NULL;

-static void __devexit tpm_nsc_remove(struct device *dev)
+static void tpm_nsc_remove(struct device *dev)
{
struct tpm_chip *chip = dev_get_drvdata(dev);
if ( chip ) {
--- drivers/cpufreq/cpufreq_stats.c.orig 2008-02-02 20:09:29.000000000 +0800
+++ drivers/cpufreq/cpufreq_stats.c 2008-02-02 20:18:22.000000000 +0800
@@ -304,7 +304,7 @@ cpufreq_stat_notifier_trans (struct noti
return 0;
}

-static int __cpuinit cpufreq_stat_cpu_callback(struct notifier_block *nfb,
+static int cpufreq_stat_cpu_callback(struct notifier_block *nfb,
unsigned long action,
void *hcpu)
{
@@ -323,7 +323,7 @@ static int __cpuinit cpufreq_stat_cpu_ca
return NOTIFY_OK;
}

-static struct notifier_block cpufreq_stat_cpu_notifier __cpuinitdata =
+static struct notifier_block cpufreq_stat_cpu_notifier =
{
.notifier_call = cpufreq_stat_cpu_callback,
};
--- drivers/hwmon/coretemp.c.orig 2008-02-02 20:20:05.000000000 +0800
+++ drivers/hwmon/coretemp.c 2008-02-02 20:22:40.000000000 +0800
@@ -273,7 +273,7 @@ struct pdev_entry {
static LIST_HEAD(pdev_list);
static DEFINE_MUTEX(pdev_list_mutex);

-static int __cpuinit coretemp_device_add(unsigned int cpu)
+static int coretemp_device_add(unsigned int cpu)
{
int err;
struct platform_device *pdev;
--- drivers/isdn/hisax/amd7930_fn.c.orig 2008-02-02 21:09:01.000000000 +0800
+++ drivers/isdn/hisax/amd7930_fn.c 2008-02-02 21:09:09.000000000 +0800
@@ -744,7 +744,7 @@ dbusy_timer_handler(struct IsdnCardState



-void __devinit
+void
Amd7930_init(struct IsdnCardState *cs)
{
WORD *ptr;
--- drivers/pcmcia/i82092.c.orig 2008-02-02 21:01:11.000000000 +0800
+++ drivers/pcmcia/i82092.c 2008-02-02 21:02:13.000000000 +0800
@@ -93,7 +93,7 @@ static struct socket_info sockets[MAX_SO
static int socket_count; /* shortcut */


-static int __devinit i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
+static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
unsigned char configbyte;
int i, ret;
@@ -187,7 +187,7 @@ err_out_disable:
return ret;
}

-static void __devexit i82092aa_pci_remove(struct pci_dev *dev)
+static void i82092aa_pci_remove(struct pci_dev *dev)
{
struct pcmcia_socket *socket = pci_get_drvdata(dev);

--- drivers/pcmcia/pd6729.c.orig 2008-02-02 20:58:52.000000000 +0800
+++ drivers/pcmcia/pd6729.c 2008-02-02 21:00:17.000000000 +0800
@@ -589,7 +589,7 @@ static int pd6729_check_irq(int irq)
return 0;
}

-static u_int __devinit pd6729_isa_scan(void)
+static u_int pd6729_isa_scan(void)
{
u_int mask0, mask = 0;
int i;
@@ -625,7 +625,7 @@ static u_int __devinit pd6729_isa_scan(v
return mask;
}

-static int __devinit pd6729_pci_probe(struct pci_dev *dev,
+static int pd6729_pci_probe(struct pci_dev *dev,
const struct pci_device_id *id)
{
int i, j, ret;
@@ -732,7 +732,7 @@ static int __devinit pd6729_pci_probe(st
return ret;
}

-static void __devexit pd6729_pci_remove(struct pci_dev *dev)
+static void pd6729_pci_remove(struct pci_dev *dev)
{
int i;
struct pd6729_socket *socket = pci_get_drvdata(dev);
--- drivers/scsi/aic94xx/aic94xx_init.c.orig 2008-02-02 21:13:45.000000000 +0800
+++ drivers/scsi/aic94xx/aic94xx_init.c 2008-02-02 21:17:32.000000000 +0800
@@ -224,7 +224,7 @@ static const char *asd_dev_rev[30] = {
[8] = "B0",
};

-static int __devinit asd_common_setup(struct asd_ha_struct *asd_ha)
+static int asd_common_setup(struct asd_ha_struct *asd_ha)
{
int err, i;

@@ -260,7 +260,7 @@ Err:
return err;
}

-static int __devinit asd_aic9410_setup(struct asd_ha_struct *asd_ha)
+static int asd_aic9410_setup(struct asd_ha_struct *asd_ha)
{
int err = asd_common_setup(asd_ha);

@@ -275,7 +275,7 @@ static int __devinit asd_aic9410_setup(s
return 0;
}

-static int __devinit asd_aic9405_setup(struct asd_ha_struct *asd_ha)
+static int asd_aic9405_setup(struct asd_ha_struct *asd_ha)
{
int err = asd_common_setup(asd_ha);

--- sound/pci/rme9652/hdsp.c.orig 2008-02-02 20:51:28.000000000 +0800
+++ sound/pci/rme9652/hdsp.c 2008-02-02 20:57:06.000000000 +0800
@@ -745,7 +745,7 @@ static int hdsp_get_iobox_version (struc


#ifdef HDSP_FW_LOADER
-static int __devinit hdsp_request_fw_loader(struct hdsp *hdsp);
+static int hdsp_request_fw_loader(struct hdsp *hdsp);
#endif

static int hdsp_check_for_firmware (struct hdsp *hdsp, int load_on_demand)
@@ -4688,7 +4688,7 @@ static struct snd_pcm_ops snd_hdsp_captu
.copy = snd_hdsp_capture_copy,
};

-static int __devinit snd_hdsp_create_hwdep(struct snd_card *card,
+static int snd_hdsp_create_hwdep(struct snd_card *card,
struct hdsp *hdsp)
{
struct snd_hwdep *hw;
@@ -4857,7 +4857,7 @@ static int snd_hdsp_create_alsa_devices(

#ifdef HDSP_FW_LOADER
/* load firmware via hotplug fw loader */
-static int __devinit hdsp_request_fw_loader(struct hdsp *hdsp)
+static int hdsp_request_fw_loader(struct hdsp *hdsp)
{
const char *fwfile;
const struct firmware *fw;