Commit 95c54a96 authored by Alex Elder's avatar Alex Elder Committed by David S. Miller

net: ipa: pass a platform device to ipa_mem_init()

Rather than using the platform device pointer field in the IPA
pointer, pass a platform device pointer to ipa_mem_init().  Use
that pointer throughout that function.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a47956e7
...@@ -870,7 +870,7 @@ static int ipa_probe(struct platform_device *pdev) ...@@ -870,7 +870,7 @@ static int ipa_probe(struct platform_device *pdev)
if (ret) if (ret)
goto err_kfree_ipa; goto err_kfree_ipa;
ret = ipa_mem_init(ipa, data->mem_data); ret = ipa_mem_init(ipa, pdev, data->mem_data);
if (ret) if (ret)
goto err_reg_exit; goto err_reg_exit;
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <linux/bug.h> #include <linux/bug.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/iommu.h> #include <linux/iommu.h>
#include <linux/platform_device.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/soc/qcom/smem.h> #include <linux/soc/qcom/smem.h>
...@@ -75,9 +76,9 @@ ipa_mem_zero_region_add(struct gsi_trans *trans, enum ipa_mem_id mem_id) ...@@ -75,9 +76,9 @@ ipa_mem_zero_region_add(struct gsi_trans *trans, enum ipa_mem_id mem_id)
int ipa_mem_setup(struct ipa *ipa) int ipa_mem_setup(struct ipa *ipa)
{ {
dma_addr_t addr = ipa->zero_addr; dma_addr_t addr = ipa->zero_addr;
const struct reg *reg;
const struct ipa_mem *mem; const struct ipa_mem *mem;
struct gsi_trans *trans; struct gsi_trans *trans;
const struct reg *reg;
u32 offset; u32 offset;
u16 size; u16 size;
u32 val; u32 val;
...@@ -615,9 +616,10 @@ static void ipa_smem_exit(struct ipa *ipa) ...@@ -615,9 +616,10 @@ static void ipa_smem_exit(struct ipa *ipa)
} }
/* Perform memory region-related initialization */ /* Perform memory region-related initialization */
int ipa_mem_init(struct ipa *ipa, const struct ipa_mem_data *mem_data) int ipa_mem_init(struct ipa *ipa, struct platform_device *pdev,
const struct ipa_mem_data *mem_data)
{ {
struct device *dev = &ipa->pdev->dev; struct device *dev = &pdev->dev;
struct resource *res; struct resource *res;
int ret; int ret;
...@@ -634,14 +636,13 @@ int ipa_mem_init(struct ipa *ipa, const struct ipa_mem_data *mem_data) ...@@ -634,14 +636,13 @@ int ipa_mem_init(struct ipa *ipa, const struct ipa_mem_data *mem_data)
if (!ipa_table_mem_valid(ipa, true)) if (!ipa_table_mem_valid(ipa, true))
return -EINVAL; return -EINVAL;
ret = dma_set_mask_and_coherent(&ipa->pdev->dev, DMA_BIT_MASK(64)); ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
if (ret) { if (ret) {
dev_err(dev, "error %d setting DMA mask\n", ret); dev_err(dev, "error %d setting DMA mask\n", ret);
return ret; return ret;
} }
res = platform_get_resource_byname(ipa->pdev, IORESOURCE_MEM, res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ipa-shared");
"ipa-shared");
if (!res) { if (!res) {
dev_err(dev, dev_err(dev,
"DT error getting \"ipa-shared\" memory property\n"); "DT error getting \"ipa-shared\" memory property\n");
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#ifndef _IPA_MEM_H_ #ifndef _IPA_MEM_H_
#define _IPA_MEM_H_ #define _IPA_MEM_H_
struct platform_device;
struct ipa; struct ipa;
struct ipa_mem_data; struct ipa_mem_data;
...@@ -100,7 +102,8 @@ int ipa_mem_setup(struct ipa *ipa); /* No ipa_mem_teardown() needed */ ...@@ -100,7 +102,8 @@ int ipa_mem_setup(struct ipa *ipa); /* No ipa_mem_teardown() needed */
int ipa_mem_zero_modem(struct ipa *ipa); int ipa_mem_zero_modem(struct ipa *ipa);
int ipa_mem_init(struct ipa *ipa, const struct ipa_mem_data *mem_data); int ipa_mem_init(struct ipa *ipa, struct platform_device *pdev,
const struct ipa_mem_data *mem_data);
void ipa_mem_exit(struct ipa *ipa); void ipa_mem_exit(struct ipa *ipa);
#endif /* _IPA_MEM_H_ */ #endif /* _IPA_MEM_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment