diff options
author | Ivo van Doorn <ivdoorn@gmail.com> | 2008-04-21 21:01:58 +0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-05-07 23:02:21 +0400 |
commit | bd394a74a0e81efb15feaa8d7d10a0eaa8f4bf07 (patch) | |
tree | ee2a9b666c87fc9a1a1cbbcbe49a3a33cdec0e8f /drivers/net/wireless/rt2x00/rt2x00usb.h | |
parent | e58c6aca99357d7f85f18e0b661d8c5a87f926a9 (diff) | |
download | linux-bd394a74a0e81efb15feaa8d7d10a0eaa8f4bf07.tar.xz |
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.h | 19 |
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 @@ #define REGISTER_TIMEOUT 500 #define REGISTER_TIMEOUT_FIRMWARE 1000 +/** + * REGISTER_TIMEOUT16 - Determine the timeout for 16bit register access + * @__datalen: Data length + */ +#define REGISTER_TIMEOUT16(__datalen) \ + ( REGISTER_TIMEOUT * ((__datalen) / sizeof(u16)) ) + +/** + * REGISTER_TIMEOUT32 - Determine the timeout for 32bit register access + * @__datalen: Data length + */ +#define REGISTER_TIMEOUT32(__datalen) \ + ( REGISTER_TIMEOUT * ((__datalen) / sizeof(u32)) ) + /* * Cache size */ @@ -187,11 +201,10 @@ static inline int rt2x00usb_vendor_request_sw(struct rt2x00_dev *rt2x00dev, static inline int rt2x00usb_eeprom_read(struct rt2x00_dev *rt2x00dev, __le16 *eeprom, const u16 lenght) { - int timeout = REGISTER_TIMEOUT * (lenght / sizeof(u16)); - return rt2x00usb_vendor_request(rt2x00dev, USB_EEPROM_READ, USB_VENDOR_REQUEST_IN, 0, 0, - eeprom, lenght, timeout); + eeprom, lenght, + REGISTER_TIMEOUT16(lenght)); } /* |