[MMC] Clean up wbsd detection handling

The wbsd driver's card detection routing is a bit of a mess. This
patch cleans up the routine and makes it a bit more comprihensible.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by Pierre Ossman and committed by Russell King 210ce2a7 e062c8ae

+12 -17
+12 -17
drivers/mmc/wbsd.c
··· 1136 1136 { 1137 1137 struct wbsd_host* host = (struct wbsd_host*)param; 1138 1138 u8 csr; 1139 + int delay = -1; 1139 1140 1140 1141 spin_lock(&host->lock); 1141 1142 ··· 1156 1155 DBG("Card inserted\n"); 1157 1156 host->flags |= WBSD_FCARD_PRESENT; 1158 1157 1159 - spin_unlock(&host->lock); 1160 - 1161 - /* 1162 - * Delay card detection to allow electrical connections 1163 - * to stabilise. 1164 - */ 1165 - mmc_detect_change(host->mmc, msecs_to_jiffies(500)); 1158 + delay = 500; 1166 1159 } 1167 - else 1168 - spin_unlock(&host->lock); 1169 1160 } 1170 1161 else if (host->flags & WBSD_FCARD_PRESENT) 1171 1162 { ··· 1174 1181 tasklet_schedule(&host->finish_tasklet); 1175 1182 } 1176 1183 1177 - /* 1178 - * Unlock first since we might get a call back. 1179 - */ 1180 - spin_unlock(&host->lock); 1181 - 1182 - mmc_detect_change(host->mmc, 0); 1184 + delay = 0; 1183 1185 } 1184 - else 1185 - spin_unlock(&host->lock); 1186 + 1187 + /* 1188 + * Unlock first since we might get a call back. 1189 + */ 1190 + 1191 + spin_unlock(&host->lock); 1192 + 1193 + if (delay != -1) 1194 + mmc_detect_change(host->mmc, msecs_to_jiffies(delay)); 1186 1195 } 1187 1196 1188 1197 static void wbsd_tasklet_fifo(unsigned long param)