drivercore: revert addition of of_match to struct device

Commit b826291c, "drivercore/dt: add a match table pointer to struct
device" added an of_match pointer to struct device to cache the
of_match_table entry discovered at driver match time.  This was unsafe
because matching is not an atomic operation with probing a driver.  If
two or more drivers are attempted to be matched to a driver at the
same time, then the cached matching entry pointer could get
overwritten.

This patch reverts the of_match cache pointer and reworks all users to
call of_match_device() directly instead.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Šī revīzija ir iekļauta:
Grant Likely
2011-05-18 11:19:24 -06:00
vecāks 01294d8262
revīzija b1608d69cb
22 mainīti faili ar 108 papildinājumiem un 50 dzēšanām

Parādīt failu

@@ -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;
@@ -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);