diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2011-05-18 13:19:24 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-05-18 14:32:23 -0400 |
commit | b1608d69cb804e414d0887140ba08a9398e4e638 (patch) | |
tree | 8999cd827e7fb4138ff83f7829d8fdcf44ee653d /drivers/mmc | |
parent | 01294d82622d6d9d64bde8e4530c7e2c6dbb6ee6 (diff) |
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>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/sdhci-of-core.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/mmc/host/sdhci-of-core.c b/drivers/mmc/host/sdhci-of-core.c index f9b611fc773e..60e4186a4345 100644 --- a/drivers/mmc/host/sdhci-of-core.c +++ b/drivers/mmc/host/sdhci-of-core.c | |||
@@ -124,8 +124,10 @@ static bool __devinit sdhci_of_wp_inverted(struct device_node *np) | |||
124 | #endif | 124 | #endif |
125 | } | 125 | } |
126 | 126 | ||
127 | static const struct of_device_id sdhci_of_match[]; | ||
127 | static int __devinit sdhci_of_probe(struct platform_device *ofdev) | 128 | static int __devinit sdhci_of_probe(struct platform_device *ofdev) |
128 | { | 129 | { |
130 | const struct of_device_id *match; | ||
129 | struct device_node *np = ofdev->dev.of_node; | 131 | struct device_node *np = ofdev->dev.of_node; |
130 | struct sdhci_of_data *sdhci_of_data; | 132 | struct sdhci_of_data *sdhci_of_data; |
131 | struct sdhci_host *host; | 133 | struct sdhci_host *host; |
@@ -134,9 +136,10 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev) | |||
134 | int size; | 136 | int size; |
135 | int ret; | 137 | int ret; |
136 | 138 | ||
137 | if (!ofdev->dev.of_match) | 139 | match = of_match_device(sdhci_of_match, &ofdev->dev); |
140 | if (!match) | ||
138 | return -EINVAL; | 141 | return -EINVAL; |
139 | sdhci_of_data = ofdev->dev.of_match->data; | 142 | sdhci_of_data = match->data; |
140 | 143 | ||
141 | if (!of_device_is_available(np)) | 144 | if (!of_device_is_available(np)) |
142 | return -ENODEV; | 145 | return -ENODEV; |