diff options
author | Ivo van Doorn <ivdoorn@gmail.com> | 2009-05-05 13:46:08 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-05-06 15:15:04 -0400 |
commit | 358623c22c9fd837b3b1b444377037f72553dc9f (patch) | |
tree | fcf4b4838edde6924157473086e8b7130f120ebd /drivers/net | |
parent | 6cfe62cd58da862db04d4eb61f218f65b0cedbb3 (diff) |
rt2x00: Simplify rt2x00_check_rev
rt2x00_check_rev() was too specific for rt2500usb and rt73usb,
by adding the mask argument (instead of hardcoding it into
the function itself) we can use the function in rt2800usb as
well.
v2: Fix revision mask for rt2800usb
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500usb.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800usb.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00.h | 7 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.c | 3 |
4 files changed, 10 insertions, 9 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 08e88333b0ff..1debb88bc60e 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -1559,7 +1559,7 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1559 | rt2500usb_register_read(rt2x00dev, MAC_CSR0, ®); | 1559 | rt2500usb_register_read(rt2x00dev, MAC_CSR0, ®); |
1560 | rt2x00_set_chip(rt2x00dev, RT2570, value, reg); | 1560 | rt2x00_set_chip(rt2x00dev, RT2570, value, reg); |
1561 | 1561 | ||
1562 | if (!rt2x00_check_rev(&rt2x00dev->chip, 0)) { | 1562 | if (!rt2x00_check_rev(&rt2x00dev->chip, 0x000ffff0, 0)) { |
1563 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); | 1563 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); |
1564 | return -ENODEV; | 1564 | return -ENODEV; |
1565 | } | 1565 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index cf4a97f32ab3..257bfb5483c9 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -2348,9 +2348,10 @@ static int rt2800usb_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
2348 | * The check for rt2860 is not a typo, some rt2870 hardware | 2348 | * The check for rt2860 is not a typo, some rt2870 hardware |
2349 | * identifies itself as rt2860 in the CSR register. | 2349 | * identifies itself as rt2860 in the CSR register. |
2350 | */ | 2350 | */ |
2351 | if ((rt2x00_get_field32(reg, MAC_CSR0_ASIC_VER) != 0x2860) && | 2351 | if (!rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28600000) && |
2352 | (rt2x00_get_field32(reg, MAC_CSR0_ASIC_VER) != 0x2870) && | 2352 | !rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28700000) && |
2353 | (rt2x00_get_field32(reg, MAC_CSR0_ASIC_VER) != 0x3070)) { | 2353 | !rt2x00_check_rev(&rt2x00dev->chip, 0xfff00000, 0x28800000) && |
2354 | !rt2x00_check_rev(&rt2x00dev->chip, 0xffff0000, 0x30700000)) { | ||
2354 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); | 2355 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); |
2355 | return -ENODEV; | 2356 | return -ENODEV; |
2356 | } | 2357 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 8d933ee30583..419b1b9f998e 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -915,11 +915,10 @@ static inline u32 rt2x00_rev(const struct rt2x00_chip *chipset) | |||
915 | return chipset->rev; | 915 | return chipset->rev; |
916 | } | 916 | } |
917 | 917 | ||
918 | static inline u16 rt2x00_check_rev(const struct rt2x00_chip *chipset, | 918 | static inline bool rt2x00_check_rev(const struct rt2x00_chip *chipset, |
919 | const u32 rev) | 919 | const u32 mask, const u32 rev) |
920 | { | 920 | { |
921 | return (((chipset->rev & 0xffff0) == rev) && | 921 | return ((chipset->rev & mask) == rev); |
922 | !!(chipset->rev & 0x0000f)); | ||
923 | } | 922 | } |
924 | 923 | ||
925 | /** | 924 | /** |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 6bd28a6bcef2..d10af3687a8e 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -1846,7 +1846,8 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1846 | rt2x00usb_register_read(rt2x00dev, MAC_CSR0, ®); | 1846 | rt2x00usb_register_read(rt2x00dev, MAC_CSR0, ®); |
1847 | rt2x00_set_chip(rt2x00dev, RT2571, value, reg); | 1847 | rt2x00_set_chip(rt2x00dev, RT2571, value, reg); |
1848 | 1848 | ||
1849 | if (!rt2x00_check_rev(&rt2x00dev->chip, 0x25730)) { | 1849 | if (!rt2x00_check_rev(&rt2x00dev->chip, 0x000ffff0, 0x25730) || |
1850 | !rt2x00_check_rev(&rt2x00dev->chip, 0x0000000f, 0)) { | ||
1850 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); | 1851 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); |
1851 | return -ENODEV; | 1852 | return -ENODEV; |
1852 | } | 1853 | } |