summaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/sdhci-pci-core.c
diff options
context:
space:
mode:
authorAdrian Hunter2017-03-20 18:50:33 +0100
committerUlf Hansson2017-04-24 21:41:27 +0200
commitac9f67b5800b9a96987ec602a34dd256a92ac7ca (patch)
treecba571d3cbc3f8b4f10afdff36bc5a5ec4e0b988 /drivers/mmc/host/sdhci-pci-core.c
parentmmc: sdhci: Let drivers decide whether to use mmc_retune_needed() with pm (diff)
downloadkernel-qcow2-linux-ac9f67b5800b9a96987ec602a34dd256a92ac7ca.tar.gz
kernel-qcow2-linux-ac9f67b5800b9a96987ec602a34dd256a92ac7ca.tar.xz
kernel-qcow2-linux-ac9f67b5800b9a96987ec602a34dd256a92ac7ca.zip
mmc: sdhci-pci: Let devices define their own private data
Let devices define their own private data to facilitate device-specific operations. The size of the private structure is specified in the sdhci_pci_fixes structure, then sdhci_pci_probe_slot() will allocate extra space for it, and sdhci_pci_priv() can be used to get a reference to it. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Tested-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Diffstat (limited to 'drivers/mmc/host/sdhci-pci-core.c')
-rw-r--r--drivers/mmc/host/sdhci-pci-core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
index b7150e935fb6..84b73cb22940 100644
--- a/drivers/mmc/host/sdhci-pci-core.c
+++ b/drivers/mmc/host/sdhci-pci-core.c
@@ -1830,6 +1830,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
struct sdhci_pci_slot *slot;
struct sdhci_host *host;
int ret, bar = first_bar + slotno;
+ size_t priv_size = chip->fixes ? chip->fixes->priv_size : 0;
if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) {
dev_err(&pdev->dev, "BAR %d is not iomem. Aborting.\n", bar);
@@ -1851,7 +1852,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
return ERR_PTR(-ENODEV);
}
- host = sdhci_alloc_host(&pdev->dev, sizeof(struct sdhci_pci_slot));
+ host = sdhci_alloc_host(&pdev->dev, sizeof(*slot) + priv_size);
if (IS_ERR(host)) {
dev_err(&pdev->dev, "cannot allocate host\n");
return ERR_CAST(host);