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:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user