aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00usb.h
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-04-21 13:01:58 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-05-07 15:02:21 -0400
commitbd394a74a0e81efb15feaa8d7d10a0eaa8f4bf07 (patch)
treeee2a9b666c87fc9a1a1cbbcbe49a3a33cdec0e8f /drivers/net/wireless/rt2x00/rt2x00usb.h
parente58c6aca99357d7f85f18e0b661d8c5a87f926a9 (diff)
rt2x00: Add helper macros
Add some helper macro's to help determining the the timeout for USB register access. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00usb.h')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h
index 11e55180cbaf..1efaaae04632 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.h
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.h
@@ -47,6 +47,20 @@
47#define REGISTER_TIMEOUT 500 47#define REGISTER_TIMEOUT 500
48#define REGISTER_TIMEOUT_FIRMWARE 1000 48#define REGISTER_TIMEOUT_FIRMWARE 1000
49 49
50/**
51 * REGISTER_TIMEOUT16 - Determine the timeout for 16bit register access
52 * @__datalen: Data length
53 */
54#define REGISTER_TIMEOUT16(__datalen) \
55 ( REGISTER_TIMEOUT * ((__datalen) / sizeof(u16)) )
56
57/**
58 * REGISTER_TIMEOUT32 - Determine the timeout for 32bit register access
59 * @__datalen: Data length
60 */
61#define REGISTER_TIMEOUT32(__datalen) \
62 ( REGISTER_TIMEOUT * ((__datalen) / sizeof(u32)) )
63
50/* 64/*
51 * Cache size 65 * Cache size
52 */ 66 */
@@ -187,11 +201,10 @@ static inline int rt2x00usb_vendor_request_sw(struct rt2x00_dev *rt2x00dev,
187static inline int rt2x00usb_eeprom_read(struct rt2x00_dev *rt2x00dev, 201static inline int rt2x00usb_eeprom_read(struct rt2x00_dev *rt2x00dev,
188 __le16 *eeprom, const u16 lenght) 202 __le16 *eeprom, const u16 lenght)
189{ 203{
190 int timeout = REGISTER_TIMEOUT * (lenght / sizeof(u16));
191
192 return rt2x00usb_vendor_request(rt2x00dev, USB_EEPROM_READ, 204 return rt2x00usb_vendor_request(rt2x00dev, USB_EEPROM_READ,
193 USB_VENDOR_REQUEST_IN, 0, 0, 205 USB_VENDOR_REQUEST_IN, 0, 0,
194 eeprom, lenght, timeout); 206 eeprom, lenght,
207 REGISTER_TIMEOUT16(lenght));
195} 208}
196 209
197/* 210/*