diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2011-05-18 11:19:24 -0600 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-05-18 12:32:23 -0600 |
commit | b1608d69cb804e414d0887140ba08a9398e4e638 (patch) | |
tree | 8999cd827e7fb4138ff83f7829d8fdcf44ee653d /drivers/net/can | |
parent | 01294d82622d6d9d64bde8e4530c7e2c6dbb6ee6 (diff) | |
download | blackbird-op-linux-b1608d69cb804e414d0887140ba08a9398e4e638.tar.gz blackbird-op-linux-b1608d69cb804e414d0887140ba08a9398e4e638.zip |
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/net/can')
-rw-r--r-- | drivers/net/can/mscan/mpc5xxx_can.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c index bd1d811c204f..5fedc3375562 100644 --- a/drivers/net/can/mscan/mpc5xxx_can.c +++ b/drivers/net/can/mscan/mpc5xxx_can.c @@ -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; @@ -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) { |