aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ssb
diff options
context:
space:
mode:
authorMichael Büsch <mb@bu3sch.de>2011-02-14 18:21:50 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-02-18 16:53:20 -0500
commit8c68bd401d423c81fd4bfc19c625180528e4a5e8 (patch)
treedc96f89a1a11972ac7fe716a8ec154fe22407b5a /drivers/ssb
parentf4f314bf6fd39d85065c3fcda27bd594163abcf0 (diff)
ssb: Make ssb_wait_bit multi-bit safe
ssb_wait_bit was designed for only one-bit bitmasks. People start using it for multi-bit bitmasks. Make the "set" case is safe for this. The "unset" case is already safe. This does not change behavior of the current code. Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/ssb')
-rw-r--r--drivers/ssb/main.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index 3918d2cc585..775c579817b 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -1192,10 +1192,10 @@ void ssb_device_enable(struct ssb_device *dev, u32 core_specific_flags)
1192} 1192}
1193EXPORT_SYMBOL(ssb_device_enable); 1193EXPORT_SYMBOL(ssb_device_enable);
1194 1194
1195/* Wait for a bit in a register to get set or unset. 1195/* Wait for bitmask in a register to get set or cleared.
1196 * timeout is in units of ten-microseconds */ 1196 * timeout is in units of ten-microseconds */
1197static int ssb_wait_bit(struct ssb_device *dev, u16 reg, u32 bitmask, 1197static int ssb_wait_bits(struct ssb_device *dev, u16 reg, u32 bitmask,
1198 int timeout, int set) 1198 int timeout, int set)
1199{ 1199{
1200 int i; 1200 int i;
1201 u32 val; 1201 u32 val;
@@ -1203,7 +1203,7 @@ static int ssb_wait_bit(struct ssb_device *dev, u16 reg, u32 bitmask,
1203 for (i = 0; i < timeout; i++) { 1203 for (i = 0; i < timeout; i++) {
1204 val = ssb_read32(dev, reg); 1204 val = ssb_read32(dev, reg);
1205 if (set) { 1205 if (set) {
1206 if (val & bitmask) 1206 if ((val & bitmask) == bitmask)
1207 return 0; 1207 return 0;
1208 } else { 1208 } else {
1209 if (!(val & bitmask)) 1209 if (!(val & bitmask))
@@ -1227,8 +1227,8 @@ void ssb_device_disable(struct ssb_device *dev, u32 core_specific_flags)
1227 1227
1228 reject = ssb_tmslow_reject_bitmask(dev); 1228 reject = ssb_tmslow_reject_bitmask(dev);
1229 ssb_write32(dev, SSB_TMSLOW, reject | SSB_TMSLOW_CLOCK); 1229 ssb_write32(dev, SSB_TMSLOW, reject | SSB_TMSLOW_CLOCK);
1230 ssb_wait_bit(dev, SSB_TMSLOW, reject, 1000, 1); 1230 ssb_wait_bits(dev, SSB_TMSLOW, reject, 1000, 1);
1231 ssb_wait_bit(dev, SSB_TMSHIGH, SSB_TMSHIGH_BUSY, 1000, 0); 1231 ssb_wait_bits(dev, SSB_TMSHIGH, SSB_TMSHIGH_BUSY, 1000, 0);
1232 ssb_write32(dev, SSB_TMSLOW, 1232 ssb_write32(dev, SSB_TMSLOW,
1233 SSB_TMSLOW_FGC | SSB_TMSLOW_CLOCK | 1233 SSB_TMSLOW_FGC | SSB_TMSLOW_CLOCK |
1234 reject | SSB_TMSLOW_RESET | 1234 reject | SSB_TMSLOW_RESET |