Skip to content

Commit

Permalink
Merge branch 'devicetree/merge' of git://git.secretlab.ca/git/linux-2.6
Browse files Browse the repository at this point in the history
* 'devicetree/merge' of git://git.secretlab.ca/git/linux-2.6:
  drivercore: revert addition of of_match to struct device
  of: fix race when matching drivers
  • Loading branch information
torvalds committed May 18, 2011
2 parents 7103dbe + b1608d6 commit fce5195
Show file tree
Hide file tree
Showing 22 changed files with 108 additions and 46 deletions.
7 changes: 5 additions & 2 deletions arch/powerpc/platforms/83xx/suspend.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,17 +318,20 @@ static const struct platform_suspend_ops mpc83xx_suspend_ops = {
.end = mpc83xx_suspend_end,
};

static struct of_device_id pmc_match[];
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;
int ret = 0;

if (!ofdev->dev.of_match)
match = of_match_device(pmc_match, &ofdev->dev);
if (!match)
return -EINVAL;

type = ofdev->dev.of_match->data;
type = match->data;

if (!of_device_is_available(np))
return -ENODEV;
Expand Down
7 changes: 5 additions & 2 deletions arch/powerpc/sysdev/fsl_msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,10 @@ static int __devinit fsl_msi_setup_hwirq(struct fsl_msi *msi,
return 0;
}

static const struct of_device_id fsl_of_msi_ids[];
static int __devinit fsl_of_msi_probe(struct platform_device *dev)
{
const struct of_device_id *match;
struct fsl_msi *msi;
struct resource res;
int err, i, j, irq_index, count;
Expand All @@ -316,9 +318,10 @@ static int __devinit fsl_of_msi_probe(struct platform_device *dev)
u32 offset;
static const u32 all_avail[] = { 0, NR_MSI_IRQS };

if (!dev->dev.of_match)
match = of_match_device(fsl_of_msi_ids, &dev->dev);
if (!match)
return -EINVAL;
features = dev->dev.of_match->data;
features = match->data;

printk(KERN_DEBUG "Setting up Freescale MSI support\n");

Expand Down
5 changes: 4 additions & 1 deletion arch/sparc/kernel/pci_sabre.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,10 @@ static void __devinit sabre_pbm_init(struct pci_pbm_info *pbm,
sabre_scan_bus(pbm, &op->dev);
}

static const struct of_device_id sabre_match[];
static int __devinit sabre_probe(struct platform_device *op)
{
const struct of_device_id *match;
const struct linux_prom64_registers *pr_regs;
struct device_node *dp = op->dev.of_node;
struct pci_pbm_info *pbm;
Expand All @@ -463,7 +465,8 @@ static int __devinit sabre_probe(struct platform_device *op)
const u32 *vdma;
u64 clear_irq;

hummingbird_p = op->dev.of_match && (op->dev.of_match->data != NULL);
match = of_match_device(sabre_match, &op->dev);
hummingbird_p = match && (match->data != NULL);
if (!hummingbird_p) {
struct device_node *cpu_dp;

Expand Down
8 changes: 6 additions & 2 deletions arch/sparc/kernel/pci_schizo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1458,11 +1458,15 @@ static int __devinit __schizo_init(struct platform_device *op, unsigned long chi
return err;
}

static const struct of_device_id schizo_match[];
static int __devinit schizo_probe(struct platform_device *op)
{
if (!op->dev.of_match)
const struct of_device_id *match;

match = of_match_device(schizo_match, &op->dev);
if (!match)
return -EINVAL;
return __schizo_init(op, (unsigned long) op->dev.of_match->data);
return __schizo_init(op, (unsigned long)match->data);
}

/* The ordering of this table is very important. Some Tomatillo
Expand Down
7 changes: 5 additions & 2 deletions drivers/atm/fore200e.c
Original file line number Diff line number Diff line change
Expand Up @@ -2643,16 +2643,19 @@ fore200e_init(struct fore200e* fore200e, struct device *parent)
}

#ifdef CONFIG_SBUS
static const struct of_device_id fore200e_sba_match[];
static int __devinit fore200e_sba_probe(struct platform_device *op)
{
const struct of_device_id *match;
const struct fore200e_bus *bus;
struct fore200e *fore200e;
static int index = 0;
int err;

if (!op->dev.of_match)
match = of_match_device(fore200e_sba_match, &op->dev);
if (!match)
return -EINVAL;
bus = op->dev.of_match->data;
bus = match->data;

fore200e = kzalloc(sizeof(struct fore200e), GFP_KERNEL);
if (!fore200e)
Expand Down
7 changes: 5 additions & 2 deletions drivers/char/hw_random/n2-drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,15 +619,18 @@ static void __devinit n2rng_driver_version(void)
pr_info("%s", version);
}

static const struct of_device_id n2rng_match[];
static int __devinit n2rng_probe(struct platform_device *op)
{
const struct of_device_id *match;
int victoria_falls;
int err = -ENOMEM;
struct n2rng *np;

if (!op->dev.of_match)
match = of_match_device(n2rng_match, &op->dev);
if (!match)
return -EINVAL;
victoria_falls = (op->dev.of_match->data != NULL);
victoria_falls = (match->data != NULL);

n2rng_driver_version();
np = kzalloc(sizeof(*np), GFP_KERNEL);
Expand Down
7 changes: 5 additions & 2 deletions drivers/char/ipmi/ipmi_si_intf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2554,9 +2554,11 @@ static struct pci_driver ipmi_pci_driver = {
};
#endif /* CONFIG_PCI */

static struct of_device_id ipmi_match[];
static int __devinit ipmi_probe(struct platform_device *dev)
{
#ifdef CONFIG_OF
const struct of_device_id *match;
struct smi_info *info;
struct resource resource;
const __be32 *regsize, *regspacing, *regshift;
Expand All @@ -2566,7 +2568,8 @@ static int __devinit ipmi_probe(struct platform_device *dev)

dev_info(&dev->dev, "probing via device tree\n");

if (!dev->dev.of_match)
match = of_match_device(ipmi_match, &dev->dev);
if (!match)
return -EINVAL;

ret = of_address_to_resource(np, 0, &resource);
Expand Down Expand Up @@ -2601,7 +2604,7 @@ static int __devinit ipmi_probe(struct platform_device *dev)
return -ENOMEM;
}

info->si_type = (enum si_type) dev->dev.of_match->data;
info->si_type = (enum si_type) match->data;
info->addr_source = SI_DEVICETREE;
info->irq_setup = std_irq_setup;

Expand Down
14 changes: 9 additions & 5 deletions drivers/char/xilinx_hwicap/xilinx_hwicap.c
Original file line number Diff line number Diff line change
Expand Up @@ -715,13 +715,13 @@ static int __devexit hwicap_remove(struct device *dev)
}

#ifdef CONFIG_OF
static int __devinit hwicap_of_probe(struct platform_device *op)
static int __devinit hwicap_of_probe(struct platform_device *op,
const struct hwicap_driver_config *config)
{
struct resource res;
const unsigned int *id;
const char *family;
int rc;
const struct hwicap_driver_config *config = op->dev.of_match->data;
const struct config_registers *regs;


Expand Down Expand Up @@ -751,20 +751,24 @@ static int __devinit hwicap_of_probe(struct platform_device *op)
regs);
}
#else
static inline int hwicap_of_probe(struct platform_device *op)
static inline int hwicap_of_probe(struct platform_device *op,
const struct hwicap_driver_config *config)
{
return -EINVAL;
}
#endif /* CONFIG_OF */

static const struct of_device_id __devinitconst hwicap_of_match[];
static int __devinit hwicap_drv_probe(struct platform_device *pdev)
{
const struct of_device_id *match;
struct resource *res;
const struct config_registers *regs;
const char *family;

if (pdev->dev.of_match)
return hwicap_of_probe(pdev);
match = of_match_device(hwicap_of_match, &pdev->dev);
if (match)
return hwicap_of_probe(pdev, match->data);

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
Expand Down
2 changes: 1 addition & 1 deletion drivers/edac/ppc4xx_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ ppc4xx_edac_mc_init(struct mem_ctl_info *mci,
struct ppc4xx_edac_pdata *pdata = NULL;
const struct device_node *np = op->dev.of_node;

if (op->dev.of_match == NULL)
if (of_match_device(ppc4xx_edac_match, &op->dev) == NULL)
return -EINVAL;

/* Initial driver pointers and private data */
Expand Down
9 changes: 6 additions & 3 deletions drivers/i2c/busses/i2c-mpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,15 +560,18 @@ static struct i2c_adapter mpc_ops = {
.timeout = HZ,
};

static const struct of_device_id mpc_i2c_of_match[];
static int __devinit fsl_i2c_probe(struct platform_device *op)
{
const struct of_device_id *match;
struct mpc_i2c *i2c;
const u32 *prop;
u32 clock = MPC_I2C_CLOCK_LEGACY;
int result = 0;
int plen;

if (!op->dev.of_match)
match = of_match_device(mpc_i2c_of_match, &op->dev);
if (!match)
return -EINVAL;

i2c = kzalloc(sizeof(*i2c), GFP_KERNEL);
Expand Down Expand Up @@ -605,8 +608,8 @@ static int __devinit fsl_i2c_probe(struct platform_device *op)
clock = *prop;
}

if (op->dev.of_match->data) {
struct mpc_i2c_data *data = op->dev.of_match->data;
if (match->data) {
struct mpc_i2c_data *data = match->data;
data->setup(op->dev.of_node, i2c, clock, data->prescaler);
} else {
/* Backwards compatibility */
Expand Down
7 changes: 5 additions & 2 deletions drivers/mmc/host/sdhci-of-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,10 @@ static bool __devinit sdhci_of_wp_inverted(struct device_node *np)
#endif
}

static const struct of_device_id sdhci_of_match[];
static int __devinit sdhci_of_probe(struct platform_device *ofdev)
{
const struct of_device_id *match;
struct device_node *np = ofdev->dev.of_node;
struct sdhci_of_data *sdhci_of_data;
struct sdhci_host *host;
Expand All @@ -134,9 +136,10 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev)
int size;
int ret;

if (!ofdev->dev.of_match)
match = of_match_device(sdhci_of_match, &ofdev->dev);
if (!match)
return -EINVAL;
sdhci_of_data = ofdev->dev.of_match->data;
sdhci_of_data = match->data;

if (!of_device_is_available(np))
return -ENODEV;
Expand Down
7 changes: 5 additions & 2 deletions drivers/mtd/maps/physmap_of.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,13 @@ static void __devinit of_free_probes(const char **probes)
}
#endif

static struct of_device_id of_flash_match[];
static int __devinit of_flash_probe(struct platform_device *dev)
{
#ifdef CONFIG_MTD_PARTITIONS
const char **part_probe_types;
#endif
const struct of_device_id *match;
struct device_node *dp = dev->dev.of_node;
struct resource res;
struct of_flash *info;
Expand All @@ -232,9 +234,10 @@ static int __devinit of_flash_probe(struct platform_device *dev)
struct mtd_info **mtd_list = NULL;
resource_size_t res_size;

if (!dev->dev.of_match)
match = of_match_device(of_flash_match, &dev->dev);
if (!match)
return -EINVAL;
probe_type = dev->dev.of_match->data;
probe_type = match->data;

reg_tuple_size = (of_n_addr_cells(dp) + of_n_size_cells(dp)) * sizeof(u32);

Expand Down
7 changes: 5 additions & 2 deletions drivers/net/can/mscan/mpc5xxx_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,10 @@ static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev,
}
#endif /* CONFIG_PPC_MPC512x */

static struct of_device_id mpc5xxx_can_table[];
static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev)
{
const struct of_device_id *match;
struct mpc5xxx_can_data *data;
struct device_node *np = ofdev->dev.of_node;
struct net_device *dev;
Expand All @@ -258,9 +260,10 @@ static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev)
int irq, mscan_clksrc = 0;
int err = -ENOMEM;

if (!ofdev->dev.of_match)
match = of_match_device(mpc5xxx_can_table, &ofdev->dev);
if (!match)
return -EINVAL;
data = (struct mpc5xxx_can_data *)ofdev->dev.of_match->data;
data = match->data;

base = of_iomap(np, 0);
if (!base) {
Expand Down
9 changes: 6 additions & 3 deletions drivers/net/fs_enet/fs_enet-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -998,23 +998,26 @@ static const struct net_device_ops fs_enet_netdev_ops = {
#endif
};

static struct of_device_id fs_enet_match[];
static int __devinit fs_enet_probe(struct platform_device *ofdev)
{
const struct of_device_id *match;
struct net_device *ndev;
struct fs_enet_private *fep;
struct fs_platform_info *fpi;
const u32 *data;
const u8 *mac_addr;
int privsize, len, ret = -ENODEV;

if (!ofdev->dev.of_match)
match = of_match_device(fs_enet_match, &ofdev->dev);
if (!match)
return -EINVAL;

fpi = kzalloc(sizeof(*fpi), GFP_KERNEL);
if (!fpi)
return -ENOMEM;

if (!IS_FEC(ofdev->dev.of_match)) {
if (!IS_FEC(match)) {
data = of_get_property(ofdev->dev.of_node, "fsl,cpm-command", &len);
if (!data || len != 4)
goto out_free_fpi;
Expand Down Expand Up @@ -1049,7 +1052,7 @@ static int __devinit fs_enet_probe(struct platform_device *ofdev)
fep->dev = &ofdev->dev;
fep->ndev = ndev;
fep->fpi = fpi;
fep->ops = ofdev->dev.of_match->data;
fep->ops = match->data;

ret = fep->ops->setup_data(ndev);
if (ret)
Expand Down
7 changes: 5 additions & 2 deletions drivers/net/fs_enet/mii-fec.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,20 @@ static int fs_enet_fec_mii_reset(struct mii_bus *bus)
return 0;
}

static struct of_device_id fs_enet_mdio_fec_match[];
static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev)
{
const struct of_device_id *match;
struct resource res;
struct mii_bus *new_bus;
struct fec_info *fec;
int (*get_bus_freq)(struct device_node *);
int ret = -ENOMEM, clock, speed;

if (!ofdev->dev.of_match)
match = of_match_device(fs_enet_mdio_fec_match, &ofdev->dev);
if (!match)
return -EINVAL;
get_bus_freq = ofdev->dev.of_match->data;
get_bus_freq = match->data;

new_bus = mdiobus_alloc();
if (!new_bus)
Expand Down
Loading

0 comments on commit fce5195

Please sign in to comment.