summaryrefslogtreecommitdiffstats
path: root/sys/dev/an/if_an_pci.c
diff options
context:
space:
mode:
authorambrisko <ambrisko@FreeBSD.org>2008-01-18 16:31:24 +0000
committerambrisko <ambrisko@FreeBSD.org>2008-01-18 16:31:24 +0000
commit22d76bf90958438be196e171ba26c47a2893217b (patch)
tree9d767f04c28d898a4047e90e47cc5f000de30fec /sys/dev/an/if_an_pci.c
parentae86af8218f9798ff70696ccc00d8f840fe386e0 (diff)
downloadFreeBSD-src-22d76bf90958438be196e171ba26c47a2893217b.zip
FreeBSD-src-22d76bf90958438be196e171ba26c47a2893217b.tar.gz
First real attempt at proper locking. The locking is a little complicated
since the the command and data that is being built to be sent to or read from the HW lives in the softc. Commands are later run via an_setdef etc. In the ioctl path various references are kept to the data stored in the softc so it needs to be protected. Almost think of the command in the softc a global variable since it essentially is. Since locking wasn't done in this type of context the commands would get corrupted. Thanks to avatar@ for catching some lock issues and dhw@ for testing. Things are a lot more stable except for the MPI-350 cards. My an(4) remote laptop stays on the network now. The driver should be changed so that it uses private memory that is passed to the functions that talk to the card. Then only those functions would really need to grab locks. Reviewed by: avatar@
Diffstat (limited to 'sys/dev/an/if_an_pci.c')
-rw-r--r--sys/dev/an/if_an_pci.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/dev/an/if_an_pci.c b/sys/dev/an/if_an_pci.c
index a284c8a..d13b147 100644
--- a/sys/dev/an/if_an_pci.c
+++ b/sys/dev/an/if_an_pci.c
@@ -118,13 +118,16 @@ static int
an_probe_pci(device_t dev)
{
struct an_type *t;
+ struct an_softc *sc = device_get_softc(dev);
+ bzero(sc, sizeof(struct an_softc));
t = an_devs;
while (t->an_name != NULL) {
if (pci_get_vendor(dev) == t->an_vid &&
pci_get_device(dev) == t->an_did) {
device_set_desc(dev, t->an_name);
+ an_pci_probe(dev);
return(BUS_PROBE_DEFAULT);
}
t++;
@@ -133,6 +136,7 @@ an_probe_pci(device_t dev)
if (pci_get_vendor(dev) == AIRONET_VENDORID &&
pci_get_device(dev) == AIRONET_DEVICEID_MPI350) {
device_set_desc(dev, "Cisco Aironet MPI350");
+ an_pci_probe(dev);
return(BUS_PROBE_DEFAULT);
}
@@ -150,7 +154,6 @@ an_attach_pci(dev)
sc = device_get_softc(dev);
unit = device_get_unit(dev);
flags = device_get_flags(dev);
- bzero(sc, sizeof(struct an_softc));
if (pci_get_vendor(dev) == AIRONET_VENDORID &&
pci_get_device(dev) == AIRONET_DEVICEID_MPI350) {
OpenPOWER on IntegriCloud