Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 210ce2a7 authored by Pierre Ossman's avatar Pierre Ossman Committed by Russell King
Browse files

[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: default avatarPierre Ossman <drzeus@drzeus.cx>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent e062c8ae
Loading
Loading
Loading
Loading
+12 −17
Original line number Original line Diff line number Diff line
@@ -1136,6 +1136,7 @@ static void wbsd_tasklet_card(unsigned long param)
{
{
	struct wbsd_host* host = (struct wbsd_host*)param;
	struct wbsd_host* host = (struct wbsd_host*)param;
	u8 csr;
	u8 csr;
	int delay = -1;


	spin_lock(&host->lock);
	spin_lock(&host->lock);


@@ -1155,16 +1156,8 @@ static void wbsd_tasklet_card(unsigned long param)
			DBG("Card inserted\n");
			DBG("Card inserted\n");
			host->flags |= WBSD_FCARD_PRESENT;
			host->flags |= WBSD_FCARD_PRESENT;


			spin_unlock(&host->lock);
			delay = 500;

			/*
			 * Delay card detection to allow electrical connections
			 * to stabilise.
			 */
			mmc_detect_change(host->mmc, msecs_to_jiffies(500));
		}
		}
		else
			spin_unlock(&host->lock);
	}
	}
	else if (host->flags & WBSD_FCARD_PRESENT)
	else if (host->flags & WBSD_FCARD_PRESENT)
	{
	{
@@ -1181,15 +1174,17 @@ static void wbsd_tasklet_card(unsigned long param)
			tasklet_schedule(&host->finish_tasklet);
			tasklet_schedule(&host->finish_tasklet);
		}
		}


		delay = 0;
	}

	/*
	/*
	 * Unlock first since we might get a call back.
	 * Unlock first since we might get a call back.
	 */
	 */
		spin_unlock(&host->lock);


		mmc_detect_change(host->mmc, 0);
	}
	else
	spin_unlock(&host->lock);
	spin_unlock(&host->lock);

	if (delay != -1)
		mmc_detect_change(host->mmc, msecs_to_jiffies(delay));
}
}


static void wbsd_tasklet_fifo(unsigned long param)
static void wbsd_tasklet_fifo(unsigned long param)