Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 316587
b: refs/heads/master
c: a3b2491
h: refs/heads/master
i:
  316585: 88084b0
  316583: 5a5394d
v: v3
  • Loading branch information
Hiroshi Doyu authored and Joerg Roedel committed Jun 25, 2012
1 parent da5e0c4 commit 074c614
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 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: 0760e8faa960f8ee991fa4acb802db4e20661281
refs/heads/master: a3b24915456b63c9002e94152e122b07de5566f2
29 changes: 9 additions & 20 deletions trunk/drivers/iommu/tegra-smmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,6 @@ struct smmu_device {
spinlock_t lock;
char *name;
struct device *dev;
int num_as;
struct smmu_as *as; /* Run-time allocated array */
struct page *avp_vector_page; /* dummy page shared by all AS's */

/*
Expand All @@ -254,6 +252,9 @@ struct smmu_device {
unsigned long asid_security;

struct device_node *ahb;

int num_as;
struct smmu_as as[0]; /* Run-time allocated array */
};

static struct smmu_device *smmu_handle; /* unique for a system */
Expand Down Expand Up @@ -902,15 +903,18 @@ static int tegra_smmu_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
int i, asids, err = 0;
dma_addr_t base;
size_t size;
const void *prop;
size_t bytes, size;

if (smmu_handle)
return -EIO;

BUILD_BUG_ON(PAGE_SHIFT != SMMU_PAGE_SHIFT);

smmu = devm_kzalloc(dev, sizeof(*smmu), GFP_KERNEL);
if (of_property_read_u32(dev->of_node, "nvidia,#asids", &asids))
return -ENODEV;

bytes = sizeof(*smmu) + asids * sizeof(*smmu->as);
smmu = devm_kzalloc(dev, bytes, GFP_KERNEL);
if (!smmu) {
dev_err(dev, "failed to allocate smmu_device\n");
return -ENOMEM;
Expand Down Expand Up @@ -938,13 +942,6 @@ static int tegra_smmu_probe(struct platform_device *pdev)
if (!size)
return -EINVAL;

prop = of_get_property(dev->of_node, "nvidia,#asids", NULL);
if (!prop)
return -ENODEV;
asids = be32_to_cpup(prop);
if (!asids)
return -ENODEV;

smmu->ahb = of_parse_phandle(dev->of_node, "nvidia,ahb", 0);
if (!smmu->ahb)
return -ENODEV;
Expand All @@ -959,14 +956,6 @@ static int tegra_smmu_probe(struct platform_device *pdev)
smmu->translation_enable_2 = ~0;
smmu->asid_security = 0;

smmu->as = devm_kzalloc(dev,
sizeof(smmu->as[0]) * smmu->num_as, GFP_KERNEL);
if (!smmu->as) {
dev_err(dev, "failed to allocate smmu_as\n");
err = -ENOMEM;
goto fail;
}

for (i = 0; i < smmu->num_as; i++) {
struct smmu_as *as = &smmu->as[i];

Expand Down

0 comments on commit 074c614

Please sign in to comment.