Skip to content

Commit bf60e59

Browse files
ahunter6storulf
authored andcommitted
mmc: sdhci: Allow override of mmc host operations
In the past, fixes for specific hardware devices were implemented in sdhci using quirks. That approach is no longer accepted because the growing number of quirks was starting to make the code difficult to understand and maintain. One alternative to quirks, is to allow drivers to override the default mmc host operations. This patch makes it easy to do that, and it is needed for a subsequent bug fix, for which separate patches are provided. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: stable@vger.kernel.org # v4.4+ Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent a32ef81 commit bf60e59

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

drivers/mmc/host/sdhci.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2849,6 +2849,8 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev,
28492849

28502850
host = mmc_priv(mmc);
28512851
host->mmc = mmc;
2852+
host->mmc_host_ops = sdhci_ops;
2853+
mmc->ops = &host->mmc_host_ops;
28522854

28532855
return host;
28542856
}
@@ -3037,7 +3039,6 @@ int sdhci_add_host(struct sdhci_host *host)
30373039
/*
30383040
* Set host parameters.
30393041
*/
3040-
mmc->ops = &sdhci_ops;
30413042
max_clk = host->max_clk;
30423043

30433044
if (host->ops->get_min_clock)

drivers/mmc/host/sdhci.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ struct sdhci_host {
430430

431431
/* Internal data */
432432
struct mmc_host *mmc; /* MMC structure */
433+
struct mmc_host_ops mmc_host_ops; /* MMC host ops */
433434
u64 dma_mask; /* custom DMA mask */
434435

435436
#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)

0 commit comments

Comments
 (0)