rtl8187: use DMA-aware buffers with usb_control_msg
[safe/jmp/linux-2.6] / drivers / net / wireless / p54 / p54usb.c
index 3c31c15..6cc6cbc 100644 (file)
@@ -71,6 +71,7 @@ static struct usb_device_id p54u_table[] __devinitdata = {
        {USB_DEVICE(0x1260, 0xee22)},   /* SMC 2862W-G version 2 */
        {USB_DEVICE(0x13b1, 0x000a)},   /* Linksys WUSB54G ver 2 */
        {USB_DEVICE(0x13B1, 0x000C)},   /* Linksys WUSB54AG */
+       {USB_DEVICE(0x1413, 0x5400)},   /* Telsey 802.11g USB2.0 Adapter */
        {USB_DEVICE(0x1435, 0x0427)},   /* Inventel UR054G */
        {USB_DEVICE(0x2001, 0x3704)},   /* DLink DWL-G122 rev A2 */
        {USB_DEVICE(0x413c, 0x8102)},   /* Spinnaker DUT */
@@ -430,14 +431,16 @@ static const char p54u_firmware_upload_3887[] = "<\r";
 static int p54u_device_reset_3887(struct ieee80211_hw *dev)
 {
        struct p54u_priv *priv = dev->priv;
-       int ret, lock;
+       int ret, lock = (priv->intf->condition != USB_INTERFACE_BINDING);
        u8 buf[4];
 
-       ret = lock = usb_lock_device_for_reset(priv->udev, priv->intf);
-       if (ret < 0) {
-               dev_err(&priv->udev->dev, "(p54usb) unable to lock device for "
-                       "reset: %d\n", ret);
-               return ret;
+       if (lock) {
+               ret = usb_lock_device_for_reset(priv->udev, priv->intf);
+               if (ret < 0) {
+                       dev_err(&priv->udev->dev, "(p54usb) unable to lock "
+                               " device for reset: %d\n", ret);
+                       return ret;
+               }
        }
 
        ret = usb_reset_device(priv->udev);
@@ -498,6 +501,13 @@ static int p54u_upload_firmware_3887(struct ieee80211_hw *dev)
        if (err)
                goto err_upload_failed;
 
+       if (priv->common.fw_interface != FW_LM87) {
+               dev_err(&priv->udev->dev, "wrong firmware, "
+                       "please get a LM87 firmware and try again.\n");
+               err = -EINVAL;
+               goto err_upload_failed;
+       }
+
        left = block_size = min((size_t)P54U_FW_BLOCK, fw_entry->size);
        strcpy(buf, p54u_firmware_upload_3887);
        left -= strlen(p54u_firmware_upload_3887);
@@ -648,6 +658,14 @@ static int p54u_upload_firmware_net2280(struct ieee80211_hw *dev)
                return err;
        }
 
+       if (priv->common.fw_interface != FW_LM86) {
+               dev_err(&priv->udev->dev, "wrong firmware, "
+                       "please get a LM86(USB) firmware and try again.\n");
+               kfree(buf);
+               release_firmware(fw_entry);
+               return -EINVAL;
+       }
+
 #define P54U_WRITE(type, addr, data) \
        do {\
                err = p54u_write(priv, buf, type,\
@@ -959,11 +977,9 @@ static int __devinit p54u_probe(struct usb_interface *intf,
        if (err)
                goto err_free_dev;
 
-       err = ieee80211_register_hw(dev);
-       if (err) {
-               dev_err(&udev->dev, "(p54usb) Cannot register netdevice\n");
+       err = p54_register_common(dev, &udev->dev);
+       if (err)
                goto err_free_dev;
-       }
 
        return 0;
 
@@ -1007,6 +1023,7 @@ static struct usb_driver p54u_driver = {
        .disconnect = p54u_disconnect,
        .pre_reset = p54u_pre_reset,
        .post_reset = p54u_post_reset,
+       .soft_unbind = 1,
 };
 
 static int __init p54u_init(void)