Skip to content

Commit

Permalink
powerpc: make of_device_ids const
Browse files Browse the repository at this point in the history
of_device_ids (i.e. compatible strings and the respective data) are not
supposed to change at runtime. All functions working with of_device_ids
provided by <linux/of.h> work with const of_device_ids. This allows to
mark all struct of_device_id const, too.

While touching these line also put the __init annotation at the right
position where necessary.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
  • Loading branch information
Uwe Kleine-König authored and Michael Ellerman committed Sep 25, 2014
1 parent d4fe096 commit ce6d73c
Show file tree
Hide file tree
Showing 58 changed files with 67 additions and 67 deletions.
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/ibmebus.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static struct device ibmebus_bus_device = { /* fake "parent" device */
struct bus_type ibmebus_bus_type;

/* These devices will automatically be added to the bus during init */
static struct of_device_id __initdata ibmebus_matches[] = {
static const struct of_device_id ibmebus_matches[] __initconst = {
{ .compatible = "IBM,lhca" },
{ .compatible = "IBM,lhea" },
{},
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/legacy_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static struct legacy_serial_info {
phys_addr_t taddr;
} legacy_serial_infos[MAX_LEGACY_SERIAL_PORTS];

static struct of_device_id legacy_serial_parents[] __initdata = {
static const struct of_device_id legacy_serial_parents[] __initconst = {
{.type = "soc",},
{.type = "tsi-bridge",},
{.type = "opb", },
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/of_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static int of_pci_phb_probe(struct platform_device *dev)
return 0;
}

static struct of_device_id of_pci_phb_ids[] = {
static const struct of_device_id of_pci_phb_ids[] = {
{ .type = "pci", },
{ .type = "pcix", },
{ .type = "pcie", },
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/40x/ep405.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static void __iomem *bcsr_regs;
/* there's more, can't be bothered typing them tho */


static __initdata struct of_device_id ep405_of_bus[] = {
static const struct of_device_id ep405_of_bus[] __initconst = {
{ .compatible = "ibm,plb3", },
{ .compatible = "ibm,opb", },
{ .compatible = "ibm,ebc", },
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/40x/ppc40x_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <linux/init.h>
#include <linux/of_platform.h>

static __initdata struct of_device_id ppc40x_of_bus[] = {
static const struct of_device_id ppc40x_of_bus[] __initconst = {
{ .compatible = "ibm,plb3", },
{ .compatible = "ibm,plb4", },
{ .compatible = "ibm,opb", },
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/40x/virtex.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <asm/xilinx_pci.h>
#include <asm/ppc4xx.h>

static struct of_device_id xilinx_of_bus_ids[] __initdata = {
static const struct of_device_id xilinx_of_bus_ids[] __initconst = {
{ .compatible = "xlnx,plb-v46-1.00.a", },
{ .compatible = "xlnx,plb-v34-1.01.a", },
{ .compatible = "xlnx,plb-v34-1.02.a", },
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/40x/walnut.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <asm/pci-bridge.h>
#include <asm/ppc4xx.h>

static __initdata struct of_device_id walnut_of_bus[] = {
static const struct of_device_id walnut_of_bus[] __initconst = {
{ .compatible = "ibm,plb3", },
{ .compatible = "ibm,opb", },
{ .compatible = "ibm,ebc", },
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/44x/canyonlands.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

#define BCSR_USB_EN 0x11

static __initdata struct of_device_id ppc460ex_of_bus[] = {
static const struct of_device_id ppc460ex_of_bus[] __initconst = {
{ .compatible = "ibm,plb4", },
{ .compatible = "ibm,opb", },
{ .compatible = "ibm,ebc", },
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/44x/ebony.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <asm/pci-bridge.h>
#include <asm/ppc4xx.h>

static __initdata struct of_device_id ebony_of_bus[] = {
static const struct of_device_id ebony_of_bus[] __initconst = {
{ .compatible = "ibm,plb4", },
{ .compatible = "ibm,opb", },
{ .compatible = "ibm,ebc", },
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/44x/iss4xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <asm/mpic.h>
#include <asm/mmu.h>

static __initdata struct of_device_id iss4xx_of_bus[] = {
static const struct of_device_id iss4xx_of_bus[] __initconst = {
{ .compatible = "ibm,plb4", },
{ .compatible = "ibm,plb6", },
{ .compatible = "ibm,opb", },
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/44x/ppc44x_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <linux/init.h>
#include <linux/of_platform.h>

static __initdata struct of_device_id ppc44x_of_bus[] = {
static const struct of_device_id ppc44x_of_bus[] __initconst = {
{ .compatible = "ibm,plb4", },
{ .compatible = "ibm,opb", },
{ .compatible = "ibm,ebc", },
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/44x/ppc476.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <linux/pci.h>
#include <linux/i2c.h>

static struct of_device_id ppc47x_of_bus[] __initdata = {
static const struct of_device_id ppc47x_of_bus[] __initconst = {
{ .compatible = "ibm,plb4", },
{ .compatible = "ibm,plb6", },
{ .compatible = "ibm,opb", },
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/44x/sam440ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <asm/ppc4xx.h>
#include <linux/i2c.h>

static __initdata struct of_device_id sam440ep_of_bus[] = {
static const struct of_device_id sam440ep_of_bus[] __initconst = {
{ .compatible = "ibm,plb4", },
{ .compatible = "ibm,opb", },
{ .compatible = "ibm,ebc", },
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/44x/virtex.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <asm/ppc4xx.h>
#include "44x.h"

static struct of_device_id xilinx_of_bus_ids[] __initdata = {
static const struct of_device_id xilinx_of_bus_ids[] __initconst = {
{ .compatible = "simple-bus", },
{ .compatible = "xlnx,plb-v46-1.00.a", },
{ .compatible = "xlnx,plb-v46-1.02.a", },
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/44x/warp.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <asm/dma.h>


static __initdata struct of_device_id warp_of_bus[] = {
static const struct of_device_id warp_of_bus[] __initconst = {
{ .compatible = "ibm,plb4", },
{ .compatible = "ibm,opb", },
{ .compatible = "ibm,ebc", },
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/512x/mpc512x_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ void __init mpc512x_init_IRQ(void)
/*
* Nodes to do bus probe on, soc and localbus
*/
static struct of_device_id __initdata of_bus_ids[] = {
static const struct of_device_id of_bus_ids[] __initconst = {
{ .compatible = "fsl,mpc5121-immr", },
{ .compatible = "fsl,mpc5121-localbus", },
{ .compatible = "fsl,mpc5121-mbx", },
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/52xx/lite5200.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
*/

/* mpc5200 device tree match tables */
static struct of_device_id mpc5200_cdm_ids[] __initdata = {
static const struct of_device_id mpc5200_cdm_ids[] __initconst = {
{ .compatible = "fsl,mpc5200-cdm", },
{ .compatible = "mpc5200-cdm", },
{}
};

static struct of_device_id mpc5200_gpio_ids[] __initdata = {
static const struct of_device_id mpc5200_gpio_ids[] __initconst = {
{ .compatible = "fsl,mpc5200-gpio", },
{ .compatible = "mpc5200-gpio", },
{}
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/52xx/media5200.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <asm/machdep.h>
#include <asm/mpc52xx.h>

static struct of_device_id mpc5200_gpio_ids[] __initdata = {
static const struct of_device_id mpc5200_gpio_ids[] __initconst = {
{ .compatible = "fsl,mpc5200-gpio", },
{ .compatible = "mpc5200-gpio", },
{}
Expand Down
12 changes: 6 additions & 6 deletions arch/powerpc/platforms/52xx/mpc52xx_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
#include <asm/mpc52xx.h>

/* MPC5200 device tree match tables */
static struct of_device_id mpc52xx_xlb_ids[] __initdata = {
static const struct of_device_id mpc52xx_xlb_ids[] __initconst = {
{ .compatible = "fsl,mpc5200-xlb", },
{ .compatible = "mpc5200-xlb", },
{}
};
static struct of_device_id mpc52xx_bus_ids[] __initdata = {
static const struct of_device_id mpc52xx_bus_ids[] __initconst = {
{ .compatible = "fsl,mpc5200-immr", },
{ .compatible = "fsl,mpc5200b-immr", },
{ .compatible = "simple-bus", },
Expand Down Expand Up @@ -108,21 +108,21 @@ void __init mpc52xx_declare_of_platform_devices(void)
/*
* match tables used by mpc52xx_map_common_devices()
*/
static struct of_device_id mpc52xx_gpt_ids[] __initdata = {
static const struct of_device_id mpc52xx_gpt_ids[] __initconst = {
{ .compatible = "fsl,mpc5200-gpt", },
{ .compatible = "mpc5200-gpt", }, /* old */
{}
};
static struct of_device_id mpc52xx_cdm_ids[] __initdata = {
static const struct of_device_id mpc52xx_cdm_ids[] __initconst = {
{ .compatible = "fsl,mpc5200-cdm", },
{ .compatible = "mpc5200-cdm", }, /* old */
{}
};
static const struct of_device_id mpc52xx_gpio_simple[] = {
static const struct of_device_id mpc52xx_gpio_simple[] __initconst = {
{ .compatible = "fsl,mpc5200-gpio", },
{}
};
static const struct of_device_id mpc52xx_gpio_wkup[] = {
static const struct of_device_id mpc52xx_gpio_wkup[] __initconst = {
{ .compatible = "fsl,mpc5200-gpio-wkup", },
{}
};
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ static int mpc52xx_lpbfifo_remove(struct platform_device *op)
return 0;
}

static struct of_device_id mpc52xx_lpbfifo_match[] = {
static const struct of_device_id mpc52xx_lpbfifo_match[] = {
{ .compatible = "fsl,mpc5200-lpbfifo", },
{},
};
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/52xx/mpc52xx_pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@


/* MPC5200 device tree match tables */
static struct of_device_id mpc52xx_pic_ids[] __initdata = {
static const struct of_device_id mpc52xx_pic_ids[] __initconst = {
{ .compatible = "fsl,mpc5200-pic", },
{ .compatible = "mpc5200-pic", },
{}
};
static struct of_device_id mpc52xx_sdma_ids[] __initdata = {
static const struct of_device_id mpc52xx_sdma_ids[] __initconst = {
{ .compatible = "fsl,mpc5200-bestcomm", },
{ .compatible = "mpc5200-bestcomm", },
{}
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/82xx/ep8248e.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ static void __init ep8248e_setup_arch(void)
ppc_md.progress("ep8248e_setup_arch(), finish", 0);
}

static __initdata struct of_device_id of_bus_ids[] = {
static const struct of_device_id of_bus_ids[] __initconst = {
{ .compatible = "simple-bus", },
{ .compatible = "fsl,ep8248e-bcsr", },
{},
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/82xx/km82xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ static void __init km82xx_setup_arch(void)
ppc_md.progress("km82xx_setup_arch(), finish", 0);
}

static __initdata struct of_device_id of_bus_ids[] = {
static const struct of_device_id of_bus_ids[] __initconst = {
{ .compatible = "simple-bus", },
{},
};
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/82xx/mpc8272_ads.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ static void __init mpc8272_ads_setup_arch(void)
ppc_md.progress("mpc8272_ads_setup_arch(), finish", 0);
}

static struct of_device_id __initdata of_bus_ids[] = {
static const struct of_device_id of_bus_ids[] __initconst = {
{ .name = "soc", },
{ .name = "cpm", },
{ .name = "localbus", },
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/82xx/pq2fads.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ static int __init pq2fads_probe(void)
return of_flat_dt_is_compatible(root, "fsl,pq2fads");
}

static struct of_device_id __initdata of_bus_ids[] = {
static const struct of_device_id of_bus_ids[] __initconst = {
{ .name = "soc", },
{ .name = "cpm", },
{ .name = "localbus", },
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ static const struct i2c_device_id mcu_ids[] = {
};
MODULE_DEVICE_TABLE(i2c, mcu_ids);

static struct of_device_id mcu_of_match_table[] = {
static const struct of_device_id mcu_of_match_table[] = {
{ .compatible = "fsl,mcu-mpc8349emitx", },
{ },
};
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/83xx/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void __init mpc83xx_ipic_and_qe_init_IRQ(void)
}
#endif /* CONFIG_QUICC_ENGINE */

static struct of_device_id __initdata of_bus_ids[] = {
static const struct of_device_id of_bus_ids[] __initconst = {
{ .type = "soc", },
{ .compatible = "soc", },
{ .compatible = "simple-bus" },
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/83xx/mpc834x_itx.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

#include "mpc83xx.h"

static struct of_device_id __initdata mpc834x_itx_ids[] = {
static const struct of_device_id mpc834x_itx_ids[] __initconst = {
{ .compatible = "fsl,pq2pro-localbus", },
{},
};
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/83xx/suspend.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ static const struct platform_suspend_ops mpc83xx_suspend_ops = {
.end = mpc83xx_suspend_end,
};

static struct of_device_id pmc_match[];
static const struct of_device_id pmc_match[];
static int pmc_probe(struct platform_device *ofdev)
{
const struct of_device_id *match;
Expand Down Expand Up @@ -420,7 +420,7 @@ static struct pmc_type pmc_types[] = {
}
};

static struct of_device_id pmc_match[] = {
static const struct of_device_id pmc_match[] = {
{
.compatible = "fsl,mpc8313-pmc",
.data = &pmc_types[0],
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/85xx/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include "mpc85xx.h"

static struct of_device_id __initdata mpc85xx_common_ids[] = {
static const struct of_device_id mpc85xx_common_ids[] __initconst = {
{ .type = "soc", },
{ .compatible = "soc", },
{ .compatible = "simple-bus", },
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/85xx/ppa8548.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static void ppa8548_show_cpuinfo(struct seq_file *m)
seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
}

static struct of_device_id __initdata of_bus_ids[] = {
static const struct of_device_id of_bus_ids[] __initconst = {
{ .name = "soc", },
{ .type = "soc", },
{ .compatible = "simple-bus", },
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/85xx/sgy_cts1000.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

static struct device_node *halt_node;

static struct of_device_id child_match[] = {
static const struct of_device_id child_match[] = {
{
.compatible = "sgy,gpio-halt",
},
Expand Down Expand Up @@ -147,7 +147,7 @@ static int gpio_halt_remove(struct platform_device *pdev)
return 0;
}

static struct of_device_id gpio_halt_match[] = {
static const struct of_device_id gpio_halt_match[] = {
/* We match on the gpio bus itself and scan the children since they
* wont be matched against us. We know the bus wont match until it
* has been registered too. */
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/86xx/gef_ppc9a.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ static long __init mpc86xx_time_init(void)
return 0;
}

static __initdata struct of_device_id of_bus_ids[] = {
static const struct of_device_id of_bus_ids[] __initconst = {
{ .compatible = "simple-bus", },
{ .compatible = "gianfar", },
{ .compatible = "fsl,mpc8641-pcie", },
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/86xx/gef_sbc310.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ static long __init mpc86xx_time_init(void)
return 0;
}

static __initdata struct of_device_id of_bus_ids[] = {
static const struct of_device_id of_bus_ids[] __initconst = {
{ .compatible = "simple-bus", },
{ .compatible = "gianfar", },
{ .compatible = "fsl,mpc8641-pcie", },
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/86xx/gef_sbc610.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ static long __init mpc86xx_time_init(void)
return 0;
}

static __initdata struct of_device_id of_bus_ids[] = {
static const struct of_device_id of_bus_ids[] __initconst = {
{ .compatible = "simple-bus", },
{ .compatible = "gianfar", },
{ .compatible = "fsl,mpc8641-pcie", },
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/86xx/mpc8610_hpcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static void __init mpc8610_suspend_init(void)
static inline void mpc8610_suspend_init(void) { }
#endif /* CONFIG_SUSPEND */

static struct of_device_id __initdata mpc8610_ids[] = {
static const struct of_device_id mpc8610_ids[] __initconst = {
{ .compatible = "fsl,mpc8610-immr", },
{ .compatible = "fsl,mpc8610-guts", },
{ .compatible = "simple-bus", },
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ mpc86xx_time_init(void)
return 0;
}

static __initdata struct of_device_id of_bus_ids[] = {
static const struct of_device_id of_bus_ids[] __initconst = {
{ .compatible = "simple-bus", },
{ .compatible = "fsl,srio", },
{ .compatible = "gianfar", },
Expand Down
Loading

0 comments on commit ce6d73c

Please sign in to comment.