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>
This commit is contained in:
@@ -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;
|
||||
@@ -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;
|
||||
|
Reference in New Issue
Block a user