mmc: sdhci: Add size for caller in init+register
Add a param to allow users of sdhci_pltfm to allocate private space in calls to sdhci_pltfm_init+sdhci_pltfm_register. This is implemented in the same way as sdhci does for its users. None of the users have been migrated yet and are passing in zero to retain their private allocation. - todo: migrate clients to using allocation this way - todo: remove priv variable once migration is complete Also removed unused variable in sdhci_pltfm_init fn Signed-off-by: Christian Daudt <csd@broadcom.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
This commit is contained in:
parent
7396e318b4
commit
0e74823429
|
@ -148,7 +148,7 @@ static int bcm2835_sdhci_probe(struct platform_device *pdev)
|
|||
struct sdhci_pltfm_host *pltfm_host;
|
||||
int ret;
|
||||
|
||||
host = sdhci_pltfm_init(pdev, &bcm2835_sdhci_pdata);
|
||||
host = sdhci_pltfm_init(pdev, &bcm2835_sdhci_pdata, 0);
|
||||
if (IS_ERR(host))
|
||||
return PTR_ERR(host);
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ static const struct sdhci_pltfm_data sdhci_cns3xxx_pdata = {
|
|||
|
||||
static int sdhci_cns3xxx_probe(struct platform_device *pdev)
|
||||
{
|
||||
return sdhci_pltfm_register(pdev, &sdhci_cns3xxx_pdata);
|
||||
return sdhci_pltfm_register(pdev, &sdhci_cns3xxx_pdata, 0);
|
||||
}
|
||||
|
||||
static int sdhci_cns3xxx_remove(struct platform_device *pdev)
|
||||
|
|
|
@ -130,7 +130,7 @@ static int sdhci_dove_probe(struct platform_device *pdev)
|
|||
gpio_direction_input(priv->gpio_cd);
|
||||
}
|
||||
|
||||
host = sdhci_pltfm_init(pdev, &sdhci_dove_pdata);
|
||||
host = sdhci_pltfm_init(pdev, &sdhci_dove_pdata, 0);
|
||||
if (IS_ERR(host)) {
|
||||
ret = PTR_ERR(host);
|
||||
goto err_sdhci_pltfm_init;
|
||||
|
|
|
@ -503,7 +503,7 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
|
|||
int err;
|
||||
struct pltfm_imx_data *imx_data;
|
||||
|
||||
host = sdhci_pltfm_init(pdev, &sdhci_esdhc_imx_pdata);
|
||||
host = sdhci_pltfm_init(pdev, &sdhci_esdhc_imx_pdata, 0);
|
||||
if (IS_ERR(host))
|
||||
return PTR_ERR(host);
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ static const struct sdhci_pltfm_data sdhci_esdhc_pdata = {
|
|||
|
||||
static int sdhci_esdhc_probe(struct platform_device *pdev)
|
||||
{
|
||||
return sdhci_pltfm_register(pdev, &sdhci_esdhc_pdata);
|
||||
return sdhci_pltfm_register(pdev, &sdhci_esdhc_pdata, 0);
|
||||
}
|
||||
|
||||
static int sdhci_esdhc_remove(struct platform_device *pdev)
|
||||
|
|
|
@ -68,7 +68,7 @@ static const struct sdhci_pltfm_data sdhci_hlwd_pdata = {
|
|||
|
||||
static int sdhci_hlwd_probe(struct platform_device *pdev)
|
||||
{
|
||||
return sdhci_pltfm_register(pdev, &sdhci_hlwd_pdata);
|
||||
return sdhci_pltfm_register(pdev, &sdhci_hlwd_pdata, 0);
|
||||
}
|
||||
|
||||
static int sdhci_hlwd_remove(struct platform_device *pdev)
|
||||
|
|
|
@ -115,10 +115,10 @@ void sdhci_get_of_property(struct platform_device *pdev) {}
|
|||
EXPORT_SYMBOL_GPL(sdhci_get_of_property);
|
||||
|
||||
struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
|
||||
const struct sdhci_pltfm_data *pdata)
|
||||
const struct sdhci_pltfm_data *pdata,
|
||||
size_t priv_size)
|
||||
{
|
||||
struct sdhci_host *host;
|
||||
struct sdhci_pltfm_host *pltfm_host;
|
||||
struct device_node *np = pdev->dev.of_node;
|
||||
struct resource *iomem;
|
||||
int ret;
|
||||
|
@ -134,17 +134,17 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
|
|||
|
||||
/* Some PCI-based MFD need the parent here */
|
||||
if (pdev->dev.parent != &platform_bus && !np)
|
||||
host = sdhci_alloc_host(pdev->dev.parent, sizeof(*pltfm_host));
|
||||
host = sdhci_alloc_host(pdev->dev.parent,
|
||||
sizeof(struct sdhci_pltfm_host) + priv_size);
|
||||
else
|
||||
host = sdhci_alloc_host(&pdev->dev, sizeof(*pltfm_host));
|
||||
host = sdhci_alloc_host(&pdev->dev,
|
||||
sizeof(struct sdhci_pltfm_host) + priv_size);
|
||||
|
||||
if (IS_ERR(host)) {
|
||||
ret = PTR_ERR(host);
|
||||
goto err;
|
||||
}
|
||||
|
||||
pltfm_host = sdhci_priv(host);
|
||||
|
||||
host->hw_name = dev_name(&pdev->dev);
|
||||
if (pdata && pdata->ops)
|
||||
host->ops = pdata->ops;
|
||||
|
@ -204,12 +204,13 @@ void sdhci_pltfm_free(struct platform_device *pdev)
|
|||
EXPORT_SYMBOL_GPL(sdhci_pltfm_free);
|
||||
|
||||
int sdhci_pltfm_register(struct platform_device *pdev,
|
||||
const struct sdhci_pltfm_data *pdata)
|
||||
const struct sdhci_pltfm_data *pdata,
|
||||
size_t priv_size)
|
||||
{
|
||||
struct sdhci_host *host;
|
||||
int ret = 0;
|
||||
|
||||
host = sdhci_pltfm_init(pdev, pdata);
|
||||
host = sdhci_pltfm_init(pdev, pdata, priv_size);
|
||||
if (IS_ERR(host))
|
||||
return PTR_ERR(host);
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@ struct sdhci_pltfm_host {
|
|||
/* migrate from sdhci_of_host */
|
||||
unsigned int clock;
|
||||
u16 xfer_mode_shadow;
|
||||
|
||||
unsigned long private[0] ____cacheline_aligned;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER
|
||||
|
@ -92,15 +94,22 @@ static inline void sdhci_be32bs_writeb(struct sdhci_host *host, u8 val, int reg)
|
|||
extern void sdhci_get_of_property(struct platform_device *pdev);
|
||||
|
||||
extern struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
|
||||
const struct sdhci_pltfm_data *pdata);
|
||||
const struct sdhci_pltfm_data *pdata,
|
||||
size_t priv_size);
|
||||
extern void sdhci_pltfm_free(struct platform_device *pdev);
|
||||
|
||||
extern int sdhci_pltfm_register(struct platform_device *pdev,
|
||||
const struct sdhci_pltfm_data *pdata);
|
||||
const struct sdhci_pltfm_data *pdata,
|
||||
size_t priv_size);
|
||||
extern int sdhci_pltfm_unregister(struct platform_device *pdev);
|
||||
|
||||
extern unsigned int sdhci_pltfm_clk_get_max_clock(struct sdhci_host *host);
|
||||
|
||||
static inline void *sdhci_pltfm_priv(struct sdhci_pltfm_host *host)
|
||||
{
|
||||
return (void *)host->private;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
extern const struct dev_pm_ops sdhci_pltfm_pmops;
|
||||
#define SDHCI_PLTFM_PMOPS (&sdhci_pltfm_pmops)
|
||||
|
|
|
@ -175,7 +175,7 @@ static int sdhci_pxav2_probe(struct platform_device *pdev)
|
|||
if (!pxa)
|
||||
return -ENOMEM;
|
||||
|
||||
host = sdhci_pltfm_init(pdev, NULL);
|
||||
host = sdhci_pltfm_init(pdev, NULL, 0);
|
||||
if (IS_ERR(host)) {
|
||||
kfree(pxa);
|
||||
return PTR_ERR(host);
|
||||
|
|
|
@ -230,7 +230,7 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
|
|||
if (!pxa)
|
||||
return -ENOMEM;
|
||||
|
||||
host = sdhci_pltfm_init(pdev, &sdhci_pxav3_pdata);
|
||||
host = sdhci_pltfm_init(pdev, &sdhci_pxav3_pdata, 0);
|
||||
if (IS_ERR(host)) {
|
||||
kfree(pxa);
|
||||
return PTR_ERR(host);
|
||||
|
|
|
@ -231,7 +231,7 @@ static int sdhci_tegra_probe(struct platform_device *pdev)
|
|||
return -EINVAL;
|
||||
soc_data = match->data;
|
||||
|
||||
host = sdhci_pltfm_init(pdev, soc_data->pdata);
|
||||
host = sdhci_pltfm_init(pdev, soc_data->pdata, 0);
|
||||
if (IS_ERR(host))
|
||||
return PTR_ERR(host);
|
||||
pltfm_host = sdhci_priv(host);
|
||||
|
|
Loading…
Reference in New Issue