diff options
author | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2012-10-29 11:27:34 -0400 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2012-11-20 09:58:55 -0500 |
commit | 09f2b7864ce37483f4c4ecb30b0eed599f475035 (patch) | |
tree | b5de00eb1692b4a497a07d36c2fa7d5dc8614542 /drivers/dma/mv_xor.c | |
parent | a3fc74bc9bd8ffd1f2352a2053e906d1efad870d (diff) |
dma: mv_xor: do not use pool_size from platform_data within the driver
The driver currently pokes into the platform_data structure during its
normal operation to get the pool_size value. Poking into the
platform_data structure is not nice when moving to the Device Tree, so
this commit adds a new pool_size field in the mv_xor_device structure,
which gets initialized at ->probe() time. The driver then uses this
field instead of the platform_data.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'drivers/dma/mv_xor.c')
-rw-r--r-- | drivers/dma/mv_xor.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index 610d0b886cd6..704277259a5b 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c | |||
@@ -604,9 +604,7 @@ static int mv_xor_alloc_chan_resources(struct dma_chan *chan) | |||
604 | int idx; | 604 | int idx; |
605 | struct mv_xor_chan *mv_chan = to_mv_xor_chan(chan); | 605 | struct mv_xor_chan *mv_chan = to_mv_xor_chan(chan); |
606 | struct mv_xor_desc_slot *slot = NULL; | 606 | struct mv_xor_desc_slot *slot = NULL; |
607 | struct mv_xor_platform_data *plat_data = | 607 | int num_descs_in_pool = mv_chan->device->pool_size/MV_XOR_SLOT_SIZE; |
608 | mv_chan->device->pdev->dev.platform_data; | ||
609 | int num_descs_in_pool = plat_data->pool_size/MV_XOR_SLOT_SIZE; | ||
610 | 608 | ||
611 | /* Allocate descriptor slots */ | 609 | /* Allocate descriptor slots */ |
612 | idx = mv_chan->slots_allocated; | 610 | idx = mv_chan->slots_allocated; |
@@ -1084,11 +1082,10 @@ static int __devexit mv_xor_remove(struct platform_device *dev) | |||
1084 | struct mv_xor_device *device = platform_get_drvdata(dev); | 1082 | struct mv_xor_device *device = platform_get_drvdata(dev); |
1085 | struct dma_chan *chan, *_chan; | 1083 | struct dma_chan *chan, *_chan; |
1086 | struct mv_xor_chan *mv_chan; | 1084 | struct mv_xor_chan *mv_chan; |
1087 | struct mv_xor_platform_data *plat_data = dev->dev.platform_data; | ||
1088 | 1085 | ||
1089 | dma_async_device_unregister(&device->common); | 1086 | dma_async_device_unregister(&device->common); |
1090 | 1087 | ||
1091 | dma_free_coherent(&dev->dev, plat_data->pool_size, | 1088 | dma_free_coherent(&dev->dev, device->pool_size, |
1092 | device->dma_desc_pool_virt, device->dma_desc_pool); | 1089 | device->dma_desc_pool_virt, device->dma_desc_pool); |
1093 | 1090 | ||
1094 | list_for_each_entry_safe(chan, _chan, &device->common.channels, | 1091 | list_for_each_entry_safe(chan, _chan, &device->common.channels, |
@@ -1120,8 +1117,9 @@ static int __devinit mv_xor_probe(struct platform_device *pdev) | |||
1120 | * note: writecombine gives slightly better performance, but | 1117 | * note: writecombine gives slightly better performance, but |
1121 | * requires that we explicitly flush the writes | 1118 | * requires that we explicitly flush the writes |
1122 | */ | 1119 | */ |
1120 | adev->pool_size = plat_data->pool_size; | ||
1123 | adev->dma_desc_pool_virt = dma_alloc_writecombine(&pdev->dev, | 1121 | adev->dma_desc_pool_virt = dma_alloc_writecombine(&pdev->dev, |
1124 | plat_data->pool_size, | 1122 | adev->pool_size, |
1125 | &adev->dma_desc_pool, | 1123 | &adev->dma_desc_pool, |
1126 | GFP_KERNEL); | 1124 | GFP_KERNEL); |
1127 | if (!adev->dma_desc_pool_virt) | 1125 | if (!adev->dma_desc_pool_virt) |