summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjal2 <jal2>2004-01-10 20:31:17 +0000
committerjal2 <jal2>2004-01-10 20:31:17 +0000
commitf9e1c7aa889add0b0fb1de58c3af7826c7c66f86 (patch)
treeb5612d024e67cdb89e86b3b170bdd83e3d3b36ff
parent6e464891c2a534485b3fe7c650b6e55e9fcd327c (diff)
version 0.12beta5:
- fixed bug in at76c503.c:at76c503_delete_device(), which called unregister_netdev() even if netdev wasn't registered before - usb-uhci of 2.4.23/24 calls the disconnect() after we resetted the device try to work around this
-rw-r--r--Makefile4
-rw-r--r--at76c503-fw_skel.c14
-rw-r--r--at76c503.c34
-rw-r--r--at76c503.h11
4 files changed, 44 insertions, 19 deletions
diff --git a/Makefile b/Makefile
index 8ad5dd4..9074353 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
-#$Id: Makefile,v 1.20 2004/01/04 22:31:30 jal2 Exp $
+#$Id: Makefile,v 1.21 2004/01/10 20:31:17 jal2 Exp $
-VERSION = 0.12beta4
+VERSION = 0.12beta5
CC=gcc
diff --git a/at76c503-fw_skel.c b/at76c503-fw_skel.c
index bdd746b..3066468 100644
--- a/at76c503-fw_skel.c
+++ b/at76c503-fw_skel.c
@@ -1,6 +1,6 @@
/* -*- linux-c -*- */
/*
- * $Id: at76c503-fw_skel.c,v 1.2 2003/12/25 22:40:26 jal2 Exp $
+ * $Id: at76c503-fw_skel.c,v 1.3 2004/01/10 20:31:17 jal2 Exp $
*
* Driver for at76c503-based devices based on the Atmel "Fast-Vnet" reference
*
@@ -154,9 +154,15 @@ static void at76c50x_disconnect(struct usb_interface *interface)
usb_set_intfdata(interface, NULL);
#endif
- info("%s disconnecting", ((struct at76c503 *)ptr)->netdev->name);
- at76c503_delete_device(ptr);
- info(DRIVER_NAME " disconnected");
+ if (!(((struct at76c503 *)ptr)->flags & AT76C503A_USB_RESET)) {
+ info("%s disconnecting", ((struct at76c503 *)ptr)->netdev->name);
+ at76c503_delete_device(ptr);
+ info(DRIVER_NAME " disconnected");
+ } else {
+ info("%s: %s called during reset - ignored "
+ "(assuming broken usb-uhci behaviour)",
+ ((struct at76c503 *)ptr)->netdev->name, __FUNCTION__);
+ }
}
static int __init mod_init(void)
diff --git a/at76c503.c b/at76c503.c
index 01d6d54..d9c0a36 100644
--- a/at76c503.c
+++ b/at76c503.c
@@ -1,5 +1,5 @@
/* -*- linux-c -*- */
-/* $Id: at76c503.c,v 1.41 2004/01/04 22:31:30 jal2 Exp $
+/* $Id: at76c503.c,v 1.42 2004/01/10 20:31:17 jal2 Exp $
*
* USB at76c503/at76c505 driver
*
@@ -2464,6 +2464,12 @@ end_scan:
dbg(DBG_DEVSTART, "resetting the device");
+ /* flag that we reset the device to
+ at76c503-fw_skel.c:at76c50x_disconnect(), which gets
+ called during reset by usb-uhci of 2.4.23 (uhci doesn't
+ call it, nor does uhci-hcd of 2.6.0!) */
+ dev->flags |= AT76C503A_USB_RESET;
+
usb_reset_device(dev->udev);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 0)
@@ -2471,6 +2477,8 @@ end_scan:
dev->udev->state = USB_STATE_CONFIGURED;
#endif
+ dev->flags &= ~AT76C503A_USB_RESET;
+
/* jal: currently (2.6.0-test2 and 2.4.23)
usb_reset_device() does not recognize that
the interface descr. are changed.
@@ -4856,18 +4864,21 @@ void at76c503_delete_device(struct at76c503 *dev)
return;
+ /* signal to _stop() that the device is gone */
+ dev->flags |= AT76C503A_UNPLUG;
+
dbg(DBG_PROC_ENTRY, "%s: ENTER",__FUNCTION__);
- if ((sem_taken=down_trylock(&rtnl_sem)) != 0)
- info("%s: rtnl_sem already down'ed", __FUNCTION__);
- /* signal to _stop() that the device is gone */
- dev->flags |= AT76C503A_UNPLUG;
+ if (dev->flags & AT76C503A_NETDEV_REGISTERED) {
+ if ((sem_taken=down_trylock(&rtnl_sem)) != 0)
+ info("%s: rtnl_sem already down'ed", __FUNCTION__);
- /* synchronously calls at76c503a_stop() */
- unregister_netdevice(dev->netdev);
+ /* synchronously calls at76c503a_stop() */
+ unregister_netdevice(dev->netdev);
- if (!sem_taken)
- rtnl_unlock();
+ if (!sem_taken)
+ rtnl_unlock();
+ }
PUT_DEV(dev->udev);
@@ -4999,6 +5010,8 @@ struct at76c503 *alloc_new_device(struct usb_device *udev, int board_type,
}
dev = (struct at76c503 *)netdev->priv;
+ memset(dev, 0, sizeof(*dev));
+
dev->udev = udev;
dev->netdev = netdev;
@@ -5100,7 +5113,7 @@ int init_new_device(struct at76c503 *dev)
else
dev->rx_data_fcs_len = 4;
- info("$Id: at76c503.c,v 1.41 2004/01/04 22:31:30 jal2 Exp $ compiled %s %s", __DATE__, __TIME__);
+ info("$Id: at76c503.c,v 1.42 2004/01/10 20:31:17 jal2 Exp $ compiled %s %s", __DATE__, __TIME__);
info("firmware version %d.%d.%d #%d (fcs_len %d)",
dev->fw_version.major, dev->fw_version.minor,
dev->fw_version.patch, dev->fw_version.build,
@@ -5160,6 +5173,7 @@ int init_new_device(struct at76c503 *dev)
goto error;
}
info("registered %s", dev->netdev->name);
+ dev->flags |= AT76C503A_NETDEV_REGISTERED;
return 0;
diff --git a/at76c503.h b/at76c503.h
index 0379aa7..0ed1961 100644
--- a/at76c503.h
+++ b/at76c503.h
@@ -1,5 +1,5 @@
/* -*- linux-c -*- */
-/* $Id: at76c503.h,v 1.17 2003/12/27 00:03:35 jal2 Exp $
+/* $Id: at76c503.h,v 1.18 2004/01/10 20:31:17 jal2 Exp $
*
* USB at76c503 driver
*
@@ -593,11 +593,16 @@ struct at76c503 {
u8 *intfw; /* points to internal firmware part, intfw_size bytes long */
struct usb_driver *calling_driver; /* the calling driver: at76c503-{rfmd,i3861,i3863,...} */
int flags; /* AT76C503A_UNPLUG signals at76c503a_stop()
- that the device was unplugged */
+ that the device was unplugged
+ AT76C503A_NETDEV_REGISTERED signals that register_netdevice
+ xwas successfully called */
+
};
#define AT76C503A_UNPLUG 1
-
+#define AT76C503A_NETDEV_REGISTERED 2
+#define AT76C503A_USB_RESET 4 /* set during call to usb_reset_device and
+ update_usb_intf_descr() in at76c503.c */
/* Function prototypes */
int at76c503_do_probe(struct module *mod, struct usb_device *udev,