mirror of https://gitee.com/openkylin/linux.git
Merge branch 'ofdeviceiddata' of git://git.pengutronix.de/git/ukl/linux into next/fixes-non-critical
From "Uwe Kleine-Knig" <u.kleine-koenig@pengutronix.de>:
this is the 2nd version of this series whose goal is to make struct
of_device_id.data const. Conceptually a driver must not modify the data
contained there so making it const is the right thing.
v1 of this series was sent with Message-id:
1342182734-321-1-git-send-email-y. Changes since then are:
- powerpc fixes
- several new consts that were found by Arnd that are possible after
patch 19.
Arnd suggested to take this series via arm-soc late for 3.6 in one go
because patch 19 depends on the former patches but is a precondition to
the latter and it fixes a few warnings. So getting it in via the
respective maintainer trees would need a much bigger coordination
effort. That means I prefer getting Acks over you taking the patch.
Vinod Koul already took
dmaengine: at_hdmac: add a few const qualifiers
that is in next-20120723 as 7fd63ccdad
now. Vinod, I don't follow your
pull requests, but assuming you didn't let it already pull for 3.6 I
suggest you drop it from your queue and I just take your Ack.
This series was build tested for arm (all defconfigs) and powerpc (all
defconfigs and an allyesconfig) and grep didn't find more issues. As
before it introduces a warning in drivers/regulator/twl-regulator.c.
This driver does modify its .of_match_table when a device is bound which
doesn't fits the concept of independant devices. Arnd noticed another
new warning in drivers/scsi/qlogicpti.c that isn't that easy to resolve,
because the pointer to (now) const data is passed as first argument to
scsi_host_alloc. To fix that properly struct Scsi_Host.hostt needs to
get a const, too. Alternatively I could introduce a cast removing the
const, but I don't like that.
* 'ofdeviceiddata' of git://git.pengutronix.de/git/ukl/linux: (25 commits)
dma: tegra: make data used as *of_device_id.data const
can: mpc5xxx_can: make data used as *of_device_id.data const
macintosh/mediabay: make data used as *of_device_id.data const
i2c/mpc: make data used as *of_device_id.data const
mfd/da9052: make i2c_device_id array const
powerpc/fsl_msi: drop unneeded cast to non-const pointer
gpio/gpio-omap: make platformdata used as *of_device_id.data const
of: add const to struct *of_device_id.data
dma: tegra: make tegra_dma.chip_data a pointer to const data
watchdog/mpc8xxx: add a const qualifier
powerpc/celleb_pci: add a const qualifier
powerpc/fsl_msi: add a const qualifier
powerpc/83xx: add a const qualifier
macintosh/mediabay: add a const qualifier
mmc/omap_hsmmc: add a const qualifier
i2c/mpc: add a const qualifier
i2c/i2c-omap: add a const qualifier
gpio/mpc8xxx: add a const qualifier
gpio/gpio-omap.c: add a const qualifier
misc/atmel_tc: make atmel_tc.tcb_config member point to const data
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
[olof: repulled a v3 version of the branch that rebased to add some more
acked-bys and added one more patch on top for tegra]
Signed-off-by: Olof Johansson <olof@lixom.net>
This commit is contained in:
commit
1a87676206
|
@ -554,7 +554,7 @@ static const struct of_device_id l2x0_ids[] __initconst = {
|
|||
int __init l2x0_of_init(u32 aux_val, u32 aux_mask)
|
||||
{
|
||||
struct device_node *np;
|
||||
struct l2x0_of_data *data;
|
||||
const struct l2x0_of_data *data;
|
||||
struct resource res;
|
||||
|
||||
np = of_find_matching_node(NULL, l2x0_ids);
|
||||
|
|
|
@ -326,7 +326,7 @@ static int pmc_probe(struct platform_device *ofdev)
|
|||
const struct of_device_id *match;
|
||||
struct device_node *np = ofdev->dev.of_node;
|
||||
struct resource res;
|
||||
struct pmc_type *type;
|
||||
const struct pmc_type *type;
|
||||
int ret = 0;
|
||||
|
||||
match = of_match_device(pmc_match, &ofdev->dev);
|
||||
|
|
|
@ -472,7 +472,7 @@ int __init celleb_setup_phb(struct pci_controller *phb)
|
|||
{
|
||||
struct device_node *dev = phb->dn;
|
||||
const struct of_device_id *match;
|
||||
struct celleb_phb_spec *phb_spec;
|
||||
const struct celleb_phb_spec *phb_spec;
|
||||
int rc;
|
||||
|
||||
match = of_match_node(celleb_phb_match, dev);
|
||||
|
|
|
@ -368,7 +368,7 @@ static int __devinit fsl_of_msi_probe(struct platform_device *dev)
|
|||
int err, i, j, irq_index, count;
|
||||
int rc;
|
||||
const u32 *p;
|
||||
struct fsl_msi_feature *features;
|
||||
const struct fsl_msi_feature *features;
|
||||
int len;
|
||||
u32 offset;
|
||||
static const u32 all_avail[] = { 0, NR_MSI_IRQS };
|
||||
|
@ -502,15 +502,15 @@ static const struct fsl_msi_feature vmpic_msi_feature = {
|
|||
static const struct of_device_id fsl_of_msi_ids[] = {
|
||||
{
|
||||
.compatible = "fsl,mpic-msi",
|
||||
.data = (void *)&mpic_msi_feature,
|
||||
.data = &mpic_msi_feature,
|
||||
},
|
||||
{
|
||||
.compatible = "fsl,ipic-msi",
|
||||
.data = (void *)&ipic_msi_feature,
|
||||
.data = &ipic_msi_feature,
|
||||
},
|
||||
{
|
||||
.compatible = "fsl,vmpic-msi",
|
||||
.data = (void *)&vmpic_msi_feature,
|
||||
.data = &vmpic_msi_feature,
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
|
|
@ -201,7 +201,7 @@ struct tegra_dma {
|
|||
struct clk *dma_clk;
|
||||
spinlock_t global_lock;
|
||||
void __iomem *base_addr;
|
||||
struct tegra_dma_chip_data *chip_data;
|
||||
const struct tegra_dma_chip_data *chip_data;
|
||||
|
||||
/* Some register need to be cache before suspend */
|
||||
u32 reg_gen;
|
||||
|
@ -1173,14 +1173,14 @@ static void tegra_dma_free_chan_resources(struct dma_chan *dc)
|
|||
}
|
||||
|
||||
/* Tegra20 specific DMA controller information */
|
||||
static struct tegra_dma_chip_data tegra20_dma_chip_data = {
|
||||
static const struct tegra_dma_chip_data tegra20_dma_chip_data = {
|
||||
.nr_channels = 16,
|
||||
.max_dma_count = 1024UL * 64,
|
||||
};
|
||||
|
||||
#if defined(CONFIG_OF)
|
||||
/* Tegra30 specific DMA controller information */
|
||||
static struct tegra_dma_chip_data tegra30_dma_chip_data = {
|
||||
static const struct tegra_dma_chip_data tegra30_dma_chip_data = {
|
||||
.nr_channels = 32,
|
||||
.max_dma_count = 1024UL * 64,
|
||||
};
|
||||
|
@ -1204,7 +1204,7 @@ static int __devinit tegra_dma_probe(struct platform_device *pdev)
|
|||
struct tegra_dma *tdma;
|
||||
int ret;
|
||||
int i;
|
||||
struct tegra_dma_chip_data *cdata = NULL;
|
||||
const struct tegra_dma_chip_data *cdata = NULL;
|
||||
|
||||
if (pdev->dev.of_node) {
|
||||
const struct of_device_id *match;
|
||||
|
|
|
@ -38,7 +38,7 @@ struct mpc8xxx_gpio_chip {
|
|||
*/
|
||||
u32 data;
|
||||
struct irq_domain *irq;
|
||||
void *of_dev_id_data;
|
||||
const void *of_dev_id_data;
|
||||
};
|
||||
|
||||
static inline u32 mpc8xxx_gpio2mask(unsigned int gpio)
|
||||
|
|
|
@ -1058,7 +1058,7 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)
|
|||
struct device *dev = &pdev->dev;
|
||||
struct device_node *node = dev->of_node;
|
||||
const struct of_device_id *match;
|
||||
struct omap_gpio_platform_data *pdata;
|
||||
const struct omap_gpio_platform_data *pdata;
|
||||
struct resource *res;
|
||||
struct gpio_bank *bank;
|
||||
int ret = 0;
|
||||
|
@ -1440,19 +1440,19 @@ static struct omap_gpio_reg_offs omap4_gpio_regs = {
|
|||
.fallingdetect = OMAP4_GPIO_FALLINGDETECT,
|
||||
};
|
||||
|
||||
static struct omap_gpio_platform_data omap2_pdata = {
|
||||
const static struct omap_gpio_platform_data omap2_pdata = {
|
||||
.regs = &omap2_gpio_regs,
|
||||
.bank_width = 32,
|
||||
.dbck_flag = false,
|
||||
};
|
||||
|
||||
static struct omap_gpio_platform_data omap3_pdata = {
|
||||
const static struct omap_gpio_platform_data omap3_pdata = {
|
||||
.regs = &omap2_gpio_regs,
|
||||
.bank_width = 32,
|
||||
.dbck_flag = true,
|
||||
};
|
||||
|
||||
static struct omap_gpio_platform_data omap4_pdata = {
|
||||
const static struct omap_gpio_platform_data omap4_pdata = {
|
||||
.regs = &omap4_gpio_regs,
|
||||
.bank_width = 32,
|
||||
.dbck_flag = true,
|
||||
|
|
|
@ -647,7 +647,7 @@ static int __devinit fsl_i2c_probe(struct platform_device *op)
|
|||
}
|
||||
|
||||
if (match->data) {
|
||||
struct mpc_i2c_data *data = match->data;
|
||||
const struct mpc_i2c_data *data = match->data;
|
||||
data->setup(op->dev.of_node, i2c, clock, data->prescaler);
|
||||
} else {
|
||||
/* Backwards compatibility */
|
||||
|
@ -730,24 +730,24 @@ static int mpc_i2c_resume(struct device *dev)
|
|||
SIMPLE_DEV_PM_OPS(mpc_i2c_pm_ops, mpc_i2c_suspend, mpc_i2c_resume);
|
||||
#endif
|
||||
|
||||
static struct mpc_i2c_data mpc_i2c_data_512x __devinitdata = {
|
||||
static const struct mpc_i2c_data mpc_i2c_data_512x __devinitdata = {
|
||||
.setup = mpc_i2c_setup_512x,
|
||||
};
|
||||
|
||||
static struct mpc_i2c_data mpc_i2c_data_52xx __devinitdata = {
|
||||
static const struct mpc_i2c_data mpc_i2c_data_52xx __devinitdata = {
|
||||
.setup = mpc_i2c_setup_52xx,
|
||||
};
|
||||
|
||||
static struct mpc_i2c_data mpc_i2c_data_8313 __devinitdata = {
|
||||
static const struct mpc_i2c_data mpc_i2c_data_8313 __devinitdata = {
|
||||
.setup = mpc_i2c_setup_8xxx,
|
||||
};
|
||||
|
||||
static struct mpc_i2c_data mpc_i2c_data_8543 __devinitdata = {
|
||||
static const struct mpc_i2c_data mpc_i2c_data_8543 __devinitdata = {
|
||||
.setup = mpc_i2c_setup_8xxx,
|
||||
.prescaler = 2,
|
||||
};
|
||||
|
||||
static struct mpc_i2c_data mpc_i2c_data_8544 __devinitdata = {
|
||||
static const struct mpc_i2c_data mpc_i2c_data_8544 __devinitdata = {
|
||||
.setup = mpc_i2c_setup_8xxx,
|
||||
.prescaler = 3,
|
||||
};
|
||||
|
|
|
@ -944,7 +944,8 @@ omap_i2c_probe(struct platform_device *pdev)
|
|||
struct omap_i2c_dev *dev;
|
||||
struct i2c_adapter *adap;
|
||||
struct resource *mem, *irq, *ioarea;
|
||||
struct omap_i2c_bus_platform_data *pdata = pdev->dev.platform_data;
|
||||
const struct omap_i2c_bus_platform_data *pdata =
|
||||
pdev->dev.platform_data;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
const struct of_device_id *match;
|
||||
irq_handler_t isr;
|
||||
|
|
|
@ -63,7 +63,7 @@ struct media_bay_info {
|
|||
int value_count;
|
||||
int timer;
|
||||
struct macio_dev *mdev;
|
||||
struct mb_ops* ops;
|
||||
const struct mb_ops* ops;
|
||||
int index;
|
||||
int cached_gpio;
|
||||
int sleeping;
|
||||
|
@ -669,7 +669,7 @@ static int media_bay_resume(struct macio_dev *mdev)
|
|||
|
||||
/* Definitions of "ops" structures.
|
||||
*/
|
||||
static struct mb_ops ohare_mb_ops = {
|
||||
static const struct mb_ops ohare_mb_ops = {
|
||||
.name = "Ohare",
|
||||
.content = ohare_mb_content,
|
||||
.power = ohare_mb_power,
|
||||
|
@ -678,7 +678,7 @@ static struct mb_ops ohare_mb_ops = {
|
|||
.un_reset_ide = ohare_mb_un_reset_ide,
|
||||
};
|
||||
|
||||
static struct mb_ops heathrow_mb_ops = {
|
||||
static const struct mb_ops heathrow_mb_ops = {
|
||||
.name = "Heathrow",
|
||||
.content = heathrow_mb_content,
|
||||
.power = heathrow_mb_power,
|
||||
|
@ -687,7 +687,7 @@ static struct mb_ops heathrow_mb_ops = {
|
|||
.un_reset_ide = heathrow_mb_un_reset_ide,
|
||||
};
|
||||
|
||||
static struct mb_ops keylargo_mb_ops = {
|
||||
static const struct mb_ops keylargo_mb_ops = {
|
||||
.name = "KeyLargo",
|
||||
.init = keylargo_mb_init,
|
||||
.content = keylargo_mb_content,
|
||||
|
|
|
@ -46,7 +46,7 @@ static int da9052_i2c_enable_multiwrite(struct da9052 *da9052)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct i2c_device_id da9052_i2c_id[] = {
|
||||
static const struct i2c_device_id da9052_i2c_id[] = {
|
||||
{"da9052", DA9052},
|
||||
{"da9053-aa", DA9053_AA},
|
||||
{"da9053-ba", DA9053_BA},
|
||||
|
@ -104,7 +104,7 @@ static int __devinit da9052_i2c_probe(struct i2c_client *client,
|
|||
const struct of_device_id *deviceid;
|
||||
|
||||
deviceid = of_match_node(dialog_dt_ids, np);
|
||||
id = (const struct i2c_device_id *)deviceid->data;
|
||||
id = deviceid->data;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1782,7 +1782,7 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
|
|||
if (match) {
|
||||
pdata = of_get_hsmmc_pdata(&pdev->dev);
|
||||
if (match->data) {
|
||||
u16 *offsetp = match->data;
|
||||
const u16 *offsetp = match->data;
|
||||
pdata->reg_offset = *offsetp;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -380,12 +380,12 @@ static int mpc5xxx_can_resume(struct platform_device *ofdev)
|
|||
}
|
||||
#endif
|
||||
|
||||
static struct mpc5xxx_can_data __devinitdata mpc5200_can_data = {
|
||||
static const struct mpc5xxx_can_data __devinitdata mpc5200_can_data = {
|
||||
.type = MSCAN_TYPE_MPC5200,
|
||||
.get_clock = mpc52xx_can_get_clock,
|
||||
};
|
||||
|
||||
static struct mpc5xxx_can_data __devinitdata mpc5121_can_data = {
|
||||
static const struct mpc5xxx_can_data __devinitdata mpc5121_can_data = {
|
||||
.type = MSCAN_TYPE_MPC5121,
|
||||
.get_clock = mpc512x_can_get_clock,
|
||||
};
|
||||
|
|
|
@ -97,7 +97,7 @@ struct spi_imx_data {
|
|||
const void *tx_buf;
|
||||
unsigned int txfifo; /* number of words pushed in tx FIFO */
|
||||
|
||||
struct spi_imx_devtype_data *devtype_data;
|
||||
const struct spi_imx_devtype_data *devtype_data;
|
||||
int chipselect[0];
|
||||
};
|
||||
|
||||
|
|
|
@ -1116,7 +1116,7 @@ MODULE_DEVICE_TABLE(of, omap_mcspi_of_match);
|
|||
static int __devinit omap2_mcspi_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct spi_master *master;
|
||||
struct omap2_mcspi_platform_config *pdata;
|
||||
const struct omap2_mcspi_platform_config *pdata;
|
||||
struct omap2_mcspi *mcspi;
|
||||
struct resource *r;
|
||||
int status = 0, i;
|
||||
|
|
|
@ -206,7 +206,7 @@ struct imx_port {
|
|||
unsigned short trcv_delay; /* transceiver delay */
|
||||
struct clk *clk_ipg;
|
||||
struct clk *clk_per;
|
||||
struct imx_uart_data *devdata;
|
||||
const struct imx_uart_data *devdata;
|
||||
};
|
||||
|
||||
struct imx_port_ucrs {
|
||||
|
|
|
@ -598,7 +598,7 @@ static struct psc_ops mpc512x_psc_ops = {
|
|||
};
|
||||
#endif
|
||||
|
||||
static struct psc_ops *psc_ops;
|
||||
static const struct psc_ops *psc_ops;
|
||||
|
||||
/* ======================================================================== */
|
||||
/* UART operations */
|
||||
|
|
|
@ -193,7 +193,7 @@ static int __devinit mpc8xxx_wdt_probe(struct platform_device *ofdev)
|
|||
int ret;
|
||||
const struct of_device_id *match;
|
||||
struct device_node *np = ofdev->dev.of_node;
|
||||
struct mpc8xxx_wdt_type *wdt_type;
|
||||
const struct mpc8xxx_wdt_type *wdt_type;
|
||||
u32 freq = fsl_get_sys_freq();
|
||||
bool enabled;
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ struct atmel_tc {
|
|||
struct platform_device *pdev;
|
||||
struct resource *iomem;
|
||||
void __iomem *regs;
|
||||
struct atmel_tcb_config *tcb_config;
|
||||
const struct atmel_tcb_config *tcb_config;
|
||||
int irq[3];
|
||||
struct clk *clk[3];
|
||||
struct list_head node;
|
||||
|
|
|
@ -232,7 +232,7 @@ struct of_device_id
|
|||
char type[32];
|
||||
char compatible[128];
|
||||
#ifdef __KERNEL__
|
||||
void *data;
|
||||
const void *data;
|
||||
#else
|
||||
kernel_ulong_t data;
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue