]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
mmc: replace host->card_busy
authorPierre Ossman <drzeus@drzeus.cx>
Tue, 26 Dec 2006 14:11:23 +0000 (15:11 +0100)
committerPierre Ossman <drzeus@drzeus.cx>
Sun, 4 Feb 2007 19:54:06 +0000 (20:54 +0100)
As card_busy was only used to indicate if the host was exclusively
claimed and not really used to identify a particular card, replacing
it with just a boolean makes things a lot more easily understandable.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
drivers/mmc/mmc.c
include/linux/mmc/host.h

index 6f2a282e2b9759c0511cf5501a0bd4e9bd501e3f..105f419d08cb1f6cd5f5a47147cc67ad21cad5c3 100644 (file)
@@ -103,7 +103,7 @@ mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
                 mmc_hostname(host), mrq->cmd->opcode,
                 mrq->cmd->arg, mrq->cmd->flags);
 
-       WARN_ON(host->card_busy == NULL);
+       WARN_ON(!host->claimed);
 
        mrq->cmd->error = 0;
        mrq->cmd->mrq = mrq;
@@ -157,7 +157,7 @@ int mmc_wait_for_cmd(struct mmc_host *host, struct mmc_command *cmd, int retries
 {
        struct mmc_request mrq;
 
-       BUG_ON(host->card_busy == NULL);
+       BUG_ON(!host->claimed);
 
        memset(&mrq, 0, sizeof(struct mmc_request));
 
@@ -195,7 +195,7 @@ int mmc_wait_for_app_cmd(struct mmc_host *host, unsigned int rca,
 
        int i, err;
 
-       BUG_ON(host->card_busy == NULL);
+       BUG_ON(!host->claimed);
        BUG_ON(retries < 0);
 
        err = MMC_ERR_INVALID;
@@ -320,14 +320,14 @@ int __mmc_claim_host(struct mmc_host *host, struct mmc_card *card)
        spin_lock_irqsave(&host->lock, flags);
        while (1) {
                set_current_state(TASK_UNINTERRUPTIBLE);
-               if (host->card_busy == NULL)
+               if (!host->claimed)
                        break;
                spin_unlock_irqrestore(&host->lock, flags);
                schedule();
                spin_lock_irqsave(&host->lock, flags);
        }
        set_current_state(TASK_RUNNING);
-       host->card_busy = card;
+       host->claimed = 1;
        spin_unlock_irqrestore(&host->lock, flags);
        remove_wait_queue(&host->wq, &wait);
 
@@ -353,10 +353,10 @@ void mmc_release_host(struct mmc_host *host)
 {
        unsigned long flags;
 
-       BUG_ON(host->card_busy == NULL);
+       BUG_ON(!host->claimed);
 
        spin_lock_irqsave(&host->lock, flags);
-       host->card_busy = NULL;
+       host->claimed = 0;
        spin_unlock_irqrestore(&host->lock, flags);
 
        wake_up(&host->wq);
@@ -381,7 +381,7 @@ static int mmc_select_card(struct mmc_host *host, struct mmc_card *card)
        int err;
        struct mmc_command cmd;
 
-       BUG_ON(host->card_busy == NULL);
+       BUG_ON(!host->claimed);
 
        if (host->card_selected == card)
                return MMC_ERR_NONE;
index c15ae1986b9833e9727a3833be875e3daac93030..dc4c6e39519815746e402d95fc7b801bc26c6199 100644 (file)
@@ -106,8 +106,9 @@ struct mmc_host {
        struct list_head        cards;          /* devices attached to this host */
 
        wait_queue_head_t       wq;
-       spinlock_t              lock;           /* card_busy lock */
-       struct mmc_card         *card_busy;     /* the MMC card claiming host */
+       spinlock_t              lock;           /* claimed lock */
+       unsigned int            claimed:1;      /* host exclusively claimed */
+
        struct mmc_card         *card_selected; /* the selected MMC card */
 
        struct delayed_work     detect;