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/scsi/qlogicpti.c | |
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/scsi/qlogicpti.c')
-rw-r--r-- | drivers/scsi/qlogicpti.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c index e2d45c91b8e8..9689d41c7888 100644 --- a/drivers/scsi/qlogicpti.c +++ b/drivers/scsi/qlogicpti.c | |||
@@ -1292,8 +1292,10 @@ static struct scsi_host_template qpti_template = { | |||
1292 | .use_clustering = ENABLE_CLUSTERING, | 1292 | .use_clustering = ENABLE_CLUSTERING, |
1293 | }; | 1293 | }; |
1294 | 1294 | ||
1295 | static const struct of_device_id qpti_match[]; | ||
1295 | static int __devinit qpti_sbus_probe(struct platform_device *op) | 1296 | static int __devinit qpti_sbus_probe(struct platform_device *op) |
1296 | { | 1297 | { |
1298 | const struct of_device_id *match; | ||
1297 | struct scsi_host_template *tpnt; | 1299 | struct scsi_host_template *tpnt; |
1298 | struct device_node *dp = op->dev.of_node; | 1300 | struct device_node *dp = op->dev.of_node; |
1299 | struct Scsi_Host *host; | 1301 | struct Scsi_Host *host; |
@@ -1301,9 +1303,10 @@ static int __devinit qpti_sbus_probe(struct platform_device *op) | |||
1301 | static int nqptis; | 1303 | static int nqptis; |
1302 | const char *fcode; | 1304 | const char *fcode; |
1303 | 1305 | ||
1304 | if (!op->dev.of_match) | 1306 | match = of_match_device(qpti_match, &op->dev); |
1307 | if (!match) | ||
1305 | return -EINVAL; | 1308 | return -EINVAL; |
1306 | tpnt = op->dev.of_match->data; | 1309 | tpnt = match->data; |
1307 | 1310 | ||
1308 | /* Sometimes Antares cards come up not completely | 1311 | /* Sometimes Antares cards come up not completely |
1309 | * setup, and we get a report of a zero IRQ. | 1312 | * setup, and we get a report of a zero IRQ. |