Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 89951
b: refs/heads/master
c: 47b10cd
h: refs/heads/master
i:
  89949: 7b75555
  89947: 2ea1e50
  89943: 4c1d5d4
  89935: c665848
  89919: 7d045ae
v: v3
  • Loading branch information
Ivo van Doorn authored and John W. Linville committed Feb 29, 2008
1 parent b282aba commit e883e32
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 80 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 31562e802a72caf0757f351fff563d558d48d087
refs/heads/master: 47b10cd1375855dbc6675a176c71a512ac4b7317
10 changes: 8 additions & 2 deletions trunk/drivers/net/wireless/rt2x00/rt2500usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,15 +292,21 @@ 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);
rt2x00_set_field16(&led->rt2x00dev->led_mcu_reg,
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
Expand Down
52 changes: 0 additions & 52 deletions trunk/drivers/net/wireless/rt2x00/rt2x00usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
18 changes: 0 additions & 18 deletions trunk/drivers/net/wireless/rt2x00/rt2x00usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
23 changes: 16 additions & 7 deletions trunk/drivers/net/wireless/rt2x00/rt73usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e883e32

Please sign in to comment.