]> err.no Git - linux-2.6/commitdiff
rt2x00: Remove async vendor request calls from rt2x00usb
authorIvo van Doorn <ivdoorn@gmail.com>
Sun, 17 Feb 2008 16:35:28 +0000 (17:35 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 29 Feb 2008 20:37:24 +0000 (15:37 -0500)
The async vendor requests are a ugly hack which is not working correctly.
The proper fix for the scheduling while atomic issue is finding out why
we can't use led classes for USB drivers and fix that.

Just replace all async calls with the regular ones and print an
error for the disallowed LED configuration attempts. That will
help in determining which led class is causing the problem.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2500usb.c
drivers/net/wireless/rt2x00/rt2x00usb.c
drivers/net/wireless/rt2x00/rt2x00usb.h
drivers/net/wireless/rt2x00/rt73usb.c

index 826ed692878c275d4fe6a5ee0095c7c485c1bc46..9f59db91cfc2ac2458aefbc7c51a0de8ed823e2d 100644 (file)
@@ -292,6 +292,12 @@ static void rt2500usb_led_brightness(struct led_classdev *led_cdev,
        unsigned int activity =
            led->rt2x00dev->led_flags & LED_SUPPORT_ACTIVITY;
 
+       if (in_atomic()) {
+               NOTICE(led->rt2x00dev,
+                      "Ignoring LED brightness command for led %d", led->type);
+               return;
+       }
+
        if (led->type == LED_TYPE_RADIO || led->type == LED_TYPE_ASSOC) {
                rt2x00_set_field16(&led->rt2x00dev->led_mcu_reg,
                                   MAC_CSR20_LINK, enabled);
@@ -299,8 +305,8 @@ static void rt2500usb_led_brightness(struct led_classdev *led_cdev,
                                   MAC_CSR20_ACTIVITY, enabled && activity);
        }
 
-       rt2x00usb_vendor_request_async(led->rt2x00dev, USB_SINGLE_WRITE,
-                                      MAC_CSR20, led->rt2x00dev->led_mcu_reg);
+       rt2500usb_register_write(led->rt2x00dev, MAC_CSR20,
+                                led->rt2x00dev->led_mcu_reg);
 }
 #else
 #define rt2500usb_led_brightness       NULL
index 89471b24a44385ee8393b5e9625721dc65ecaf82..063b167da31e233f9392cea317811be6d0068623 100644 (file)
@@ -122,58 +122,6 @@ int rt2x00usb_vendor_request_buff(struct rt2x00_dev *rt2x00dev,
 }
 EXPORT_SYMBOL_GPL(rt2x00usb_vendor_request_buff);
 
-static void rt2x00usb_vendor_request_async_complete(struct urb *urb)
-{
-       /*
-        * We're done with it, descrease usage count and let the
-        * usb layer delete it as soon as it is done with it.
-        */
-       usb_put_urb(urb);
-}
-
-int rt2x00usb_vendor_request_async(struct rt2x00_dev *rt2x00dev,
-                                  const u8 request, const u16 offset,
-                                  const u16 value)
-{
-       struct usb_device *usb_dev = rt2x00dev_usb_dev(rt2x00dev);
-       struct usb_ctrlrequest *ctrl;
-       struct urb *urb;
-       int status;
-
-       urb = usb_alloc_urb(0, GFP_NOIO);
-       if (!urb)
-               return -ENOMEM;
-
-       ctrl = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO);
-       if (!ctrl) {
-               status = -ENOMEM;
-               goto exit;
-       }
-
-       ctrl->bRequestType= USB_VENDOR_REQUEST_OUT;
-       ctrl->bRequest = request;
-       ctrl->wValue = cpu_to_le16p(&value);
-       ctrl->wIndex = cpu_to_le16p(&offset);
-       ctrl->wLength = 0;
-
-       usb_fill_control_urb(urb, usb_dev, usb_sndctrlpipe(usb_dev, 0),
-                            (unsigned char *)ctrl, NULL, 0,
-                            rt2x00usb_vendor_request_async_complete, NULL);
-
-       status = usb_submit_urb(urb, GFP_ATOMIC);
-       if (!status)
-               goto exit;
-
-       return 0;
-
-exit:
-       usb_put_urb(urb);
-       kfree(ctrl);
-
-       return status;
-}
-EXPORT_SYMBOL_GPL(rt2x00usb_vendor_request_async);
-
 /*
  * TX data handlers.
  */
index 275b089a2a4d969a910cc90b8dbb194388d69cf5..11e55180cbaf61c95eaa6138bba8fae42fa695e6 100644 (file)
@@ -194,24 +194,6 @@ static inline int rt2x00usb_eeprom_read(struct rt2x00_dev *rt2x00dev,
                                        eeprom, lenght, timeout);
 }
 
-/**
- * rt2x00usb_vendor_request_async - Send register command to device (async)
- * @rt2x00dev: Pointer to &struct rt2x00_dev
- * @request: USB vendor command (See &enum rt2x00usb_vendor_request)
- * @offset: Register offset to perform action on
- * @value: Value to write to device
- *
- * Asynchroneous version of &rt2x00usb_vendor_request this is required
- * for some routines where the driver cannot sleep because it is in
- * irq context. Note that with this function the driver will not be
- * notified on failure or timeout of the command. It will only be notified
- * if the start of the command succeeded or not. This means it should not be
- * used when the command must succeed.
- */
-int rt2x00usb_vendor_request_async(struct rt2x00_dev *rt2x00dev,
-                                  const u8 request, const u16 offset,
-                                  const u16 value);
-
 /*
  * Radio handlers
  */
index bf2391b895719ef75e4bfd08aac73638a482c26e..6546b0d607b9daf5bc72b52e1c341b9ce5b98a63 100644 (file)
@@ -290,29 +290,38 @@ static void rt73usb_led_brightness(struct led_classdev *led_cdev,
        unsigned int bg_mode =
            (enabled && led->rt2x00dev->curr_band == IEEE80211_BAND_2GHZ);
 
+       if (in_atomic()) {
+               NOTICE(led->rt2x00dev,
+                      "Ignoring LED brightness command for led %d", led->type);
+               return;
+       }
+
        if (led->type == LED_TYPE_RADIO) {
                rt2x00_set_field16(&led->rt2x00dev->led_mcu_reg,
                                   MCU_LEDCS_RADIO_STATUS, enabled);
 
-               rt2x00usb_vendor_request_async(led->rt2x00dev, USB_LED_CONTROL,
-                                              0, led->rt2x00dev->led_mcu_reg);
+               rt2x00usb_vendor_request_sw(led->rt2x00dev, USB_LED_CONTROL,
+                                           0, led->rt2x00dev->led_mcu_reg,
+                                           REGISTER_TIMEOUT);
        } else if (led->type == LED_TYPE_ASSOC) {
                rt2x00_set_field16(&led->rt2x00dev->led_mcu_reg,
                                   MCU_LEDCS_LINK_BG_STATUS, bg_mode);
                rt2x00_set_field16(&led->rt2x00dev->led_mcu_reg,
                                   MCU_LEDCS_LINK_A_STATUS, a_mode);
 
-               rt2x00usb_vendor_request_async(led->rt2x00dev, USB_LED_CONTROL,
-                                              0, led->rt2x00dev->led_mcu_reg);
+               rt2x00usb_vendor_request_sw(led->rt2x00dev, USB_LED_CONTROL,
+                                           0, led->rt2x00dev->led_mcu_reg,
+                                           REGISTER_TIMEOUT);
        } else if (led->type == LED_TYPE_QUALITY) {
                /*
                 * The brightness is divided into 6 levels (0 - 5),
                 * this means we need to convert the brightness
                 * argument into the matching level within that range.
                 */
-               rt2x00usb_vendor_request_async(led->rt2x00dev, USB_LED_CONTROL,
-                                              brightness / (LED_FULL / 6),
-                                              led->rt2x00dev->led_mcu_reg);
+               rt2x00usb_vendor_request_sw(led->rt2x00dev, USB_LED_CONTROL,
+                                           brightness / (LED_FULL / 6),
+                                           led->rt2x00dev->led_mcu_reg,
+                                           REGISTER_TIMEOUT);
        }
 }
 #else