Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 164708
b: refs/heads/master
c: 9feae24
h: refs/heads/master
v: v3
  • Loading branch information
Adrian Hunter authored and Linus Torvalds committed Sep 23, 2009
1 parent 7bfde79 commit 545e24c
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 319a3f1429c91147058ac26c5f5bac8ec1730bc6
refs/heads/master: 9feae246963c648b212abad0f0eb8938de5f5fe5
41 changes: 34 additions & 7 deletions trunk/drivers/mmc/core/mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,6 @@ static void mmc_detect(struct mmc_host *host)
}
}

#ifdef CONFIG_MMC_UNSAFE_RESUME

/*
* Suspend callback from host.
*/
Expand Down Expand Up @@ -551,20 +549,49 @@ static void mmc_resume(struct mmc_host *host)

}

#else
#ifdef CONFIG_MMC_UNSAFE_RESUME

#define mmc_suspend NULL
#define mmc_resume NULL
static const struct mmc_bus_ops mmc_ops = {
.remove = mmc_remove,
.detect = mmc_detect,
.suspend = mmc_suspend,
.resume = mmc_resume,
};

#endif
static void mmc_attach_bus_ops(struct mmc_host *host)
{
mmc_attach_bus(host, &mmc_ops);
}

#else

static const struct mmc_bus_ops mmc_ops = {
.remove = mmc_remove,
.detect = mmc_detect,
.suspend = NULL,
.resume = NULL,
};

static const struct mmc_bus_ops mmc_ops_unsafe = {
.remove = mmc_remove,
.detect = mmc_detect,
.suspend = mmc_suspend,
.resume = mmc_resume,
};

static void mmc_attach_bus_ops(struct mmc_host *host)
{
const struct mmc_bus_ops *bus_ops;

if (host->caps & MMC_CAP_NONREMOVABLE)
bus_ops = &mmc_ops_unsafe;
else
bus_ops = &mmc_ops;
mmc_attach_bus(host, bus_ops);
}

#endif

/*
* Starting point for MMC card init.
*/
Expand All @@ -575,7 +602,7 @@ int mmc_attach_mmc(struct mmc_host *host, u32 ocr)
BUG_ON(!host);
WARN_ON(!host->claimed);

mmc_attach_bus(host, &mmc_ops);
mmc_attach_bus_ops(host);

/*
* We need to get OCR a different way for SPI.
Expand Down
41 changes: 34 additions & 7 deletions trunk/drivers/mmc/core/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,6 @@ static void mmc_sd_detect(struct mmc_host *host)
}
}

#ifdef CONFIG_MMC_UNSAFE_RESUME

/*
* Suspend callback from host.
*/
Expand Down Expand Up @@ -605,20 +603,49 @@ static void mmc_sd_resume(struct mmc_host *host)

}

#else
#ifdef CONFIG_MMC_UNSAFE_RESUME

#define mmc_sd_suspend NULL
#define mmc_sd_resume NULL
static const struct mmc_bus_ops mmc_sd_ops = {
.remove = mmc_sd_remove,
.detect = mmc_sd_detect,
.suspend = mmc_sd_suspend,
.resume = mmc_sd_resume,
};

#endif
static void mmc_sd_attach_bus_ops(struct mmc_host *host)
{
mmc_attach_bus(host, &mmc_sd_ops);
}

#else

static const struct mmc_bus_ops mmc_sd_ops = {
.remove = mmc_sd_remove,
.detect = mmc_sd_detect,
.suspend = NULL,
.resume = NULL,
};

static const struct mmc_bus_ops mmc_sd_ops_unsafe = {
.remove = mmc_sd_remove,
.detect = mmc_sd_detect,
.suspend = mmc_sd_suspend,
.resume = mmc_sd_resume,
};

static void mmc_sd_attach_bus_ops(struct mmc_host *host)
{
const struct mmc_bus_ops *bus_ops;

if (host->caps & MMC_CAP_NONREMOVABLE)
bus_ops = &mmc_sd_ops_unsafe;
else
bus_ops = &mmc_sd_ops;
mmc_attach_bus(host, bus_ops);
}

#endif

/*
* Starting point for SD card init.
*/
Expand All @@ -629,7 +656,7 @@ int mmc_attach_sd(struct mmc_host *host, u32 ocr)
BUG_ON(!host);
WARN_ON(!host->claimed);

mmc_attach_bus(host, &mmc_sd_ops);
mmc_sd_attach_bus_ops(host);

/*
* We need to get OCR a different way for SPI.
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/mmc/host.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ struct mmc_host {
#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */
#define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */
#define MMC_CAP_DISABLE (1 << 7) /* Can the host be disabled */
#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */

/* host specific block data */
unsigned int max_seg_size; /* see blk_queue_max_segment_size */
Expand Down

0 comments on commit 545e24c

Please sign in to comment.