aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2015-10-13 06:29:05 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-10-18 00:22:08 -0400
commit4c97ad993d763904fc1c9e0bdc3a6dba062802a2 (patch)
tree65019ab05cba45b85a4c523ecb2b6d581069cf01
parent47f82f1adf701b31d1816bf45118f8e83c02588e (diff)
dmaengine: hsu: remove platform data
There are no platforms where it's not possible to calculate the number of channels based on IO space length, and since that is the only purpose for struct hsu_dma_platform_data, removing it. Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Acked-by: Vinod Koul <vinod.koul@intel.com> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/dma/hsu/hsu.c24
-rw-r--r--drivers/dma/hsu/hsu.h1
-rw-r--r--drivers/dma/hsu/pci.c2
-rw-r--r--include/linux/dma/hsu.h1
-rw-r--r--include/linux/platform_data/dma-hsu.h4
5 files changed, 9 insertions, 23 deletions
diff --git a/drivers/dma/hsu/hsu.c b/drivers/dma/hsu/hsu.c
index 7669c7dd1e34..823ad728aecf 100644
--- a/drivers/dma/hsu/hsu.c
+++ b/drivers/dma/hsu/hsu.c
@@ -146,7 +146,7 @@ irqreturn_t hsu_dma_irq(struct hsu_dma_chip *chip, unsigned short nr)
146 u32 sr; 146 u32 sr;
147 147
148 /* Sanity check */ 148 /* Sanity check */
149 if (nr >= chip->pdata->nr_channels) 149 if (nr >= chip->hsu->nr_channels)
150 return IRQ_NONE; 150 return IRQ_NONE;
151 151
152 hsuc = &chip->hsu->chan[nr]; 152 hsuc = &chip->hsu->chan[nr];
@@ -375,7 +375,6 @@ static void hsu_dma_free_chan_resources(struct dma_chan *chan)
375int hsu_dma_probe(struct hsu_dma_chip *chip) 375int hsu_dma_probe(struct hsu_dma_chip *chip)
376{ 376{
377 struct hsu_dma *hsu; 377 struct hsu_dma *hsu;
378 struct hsu_dma_platform_data *pdata = chip->pdata;
379 void __iomem *addr = chip->regs + chip->offset; 378 void __iomem *addr = chip->regs + chip->offset;
380 unsigned short i; 379 unsigned short i;
381 int ret; 380 int ret;
@@ -386,25 +385,16 @@ int hsu_dma_probe(struct hsu_dma_chip *chip)
386 385
387 chip->hsu = hsu; 386 chip->hsu = hsu;
388 387
389 if (!pdata) { 388 /* Calculate nr_channels from the IO space length */
390 pdata = devm_kzalloc(chip->dev, sizeof(*pdata), GFP_KERNEL); 389 hsu->nr_channels = (chip->length - chip->offset) / HSU_DMA_CHAN_LENGTH;
391 if (!pdata)
392 return -ENOMEM;
393 390
394 chip->pdata = pdata; 391 hsu->chan = devm_kcalloc(chip->dev, hsu->nr_channels,
395
396 /* Guess nr_channels from the IO space length */
397 pdata->nr_channels = (chip->length - chip->offset) /
398 HSU_DMA_CHAN_LENGTH;
399 }
400
401 hsu->chan = devm_kcalloc(chip->dev, pdata->nr_channels,
402 sizeof(*hsu->chan), GFP_KERNEL); 392 sizeof(*hsu->chan), GFP_KERNEL);
403 if (!hsu->chan) 393 if (!hsu->chan)
404 return -ENOMEM; 394 return -ENOMEM;
405 395
406 INIT_LIST_HEAD(&hsu->dma.channels); 396 INIT_LIST_HEAD(&hsu->dma.channels);
407 for (i = 0; i < pdata->nr_channels; i++) { 397 for (i = 0; i < hsu->nr_channels; i++) {
408 struct hsu_dma_chan *hsuc = &hsu->chan[i]; 398 struct hsu_dma_chan *hsuc = &hsu->chan[i];
409 399
410 hsuc->vchan.desc_free = hsu_dma_desc_free; 400 hsuc->vchan.desc_free = hsu_dma_desc_free;
@@ -440,7 +430,7 @@ int hsu_dma_probe(struct hsu_dma_chip *chip)
440 if (ret) 430 if (ret)
441 return ret; 431 return ret;
442 432
443 dev_info(chip->dev, "Found HSU DMA, %d channels\n", pdata->nr_channels); 433 dev_info(chip->dev, "Found HSU DMA, %d channels\n", hsu->nr_channels);
444 return 0; 434 return 0;
445} 435}
446EXPORT_SYMBOL_GPL(hsu_dma_probe); 436EXPORT_SYMBOL_GPL(hsu_dma_probe);
@@ -452,7 +442,7 @@ int hsu_dma_remove(struct hsu_dma_chip *chip)
452 442
453 dma_async_device_unregister(&hsu->dma); 443 dma_async_device_unregister(&hsu->dma);
454 444
455 for (i = 0; i < chip->pdata->nr_channels; i++) { 445 for (i = 0; i < hsu->nr_channels; i++) {
456 struct hsu_dma_chan *hsuc = &hsu->chan[i]; 446 struct hsu_dma_chan *hsuc = &hsu->chan[i];
457 447
458 tasklet_kill(&hsuc->vchan.task); 448 tasklet_kill(&hsuc->vchan.task);
diff --git a/drivers/dma/hsu/hsu.h b/drivers/dma/hsu/hsu.h
index eeb9fff66967..f06579c6d548 100644
--- a/drivers/dma/hsu/hsu.h
+++ b/drivers/dma/hsu/hsu.h
@@ -107,6 +107,7 @@ struct hsu_dma {
107 107
108 /* channels */ 108 /* channels */
109 struct hsu_dma_chan *chan; 109 struct hsu_dma_chan *chan;
110 unsigned short nr_channels;
110}; 111};
111 112
112static inline struct hsu_dma *to_hsu_dma(struct dma_device *ddev) 113static inline struct hsu_dma *to_hsu_dma(struct dma_device *ddev)
diff --git a/drivers/dma/hsu/pci.c b/drivers/dma/hsu/pci.c
index 77879e6ddc4c..e2db76bd56d8 100644
--- a/drivers/dma/hsu/pci.c
+++ b/drivers/dma/hsu/pci.c
@@ -31,7 +31,7 @@ static irqreturn_t hsu_pci_irq(int irq, void *dev)
31 irqreturn_t ret = IRQ_NONE; 31 irqreturn_t ret = IRQ_NONE;
32 32
33 dmaisr = readl(chip->regs + HSU_PCI_DMAISR); 33 dmaisr = readl(chip->regs + HSU_PCI_DMAISR);
34 for (i = 0; i < chip->pdata->nr_channels; i++) { 34 for (i = 0; i < chip->hsu->nr_channels; i++) {
35 if (dmaisr & 0x1) 35 if (dmaisr & 0x1)
36 ret |= hsu_dma_irq(chip, i); 36 ret |= hsu_dma_irq(chip, i);
37 dmaisr >>= 1; 37 dmaisr >>= 1;
diff --git a/include/linux/dma/hsu.h b/include/linux/dma/hsu.h
index 765b414eef98..79df69dc629c 100644
--- a/include/linux/dma/hsu.h
+++ b/include/linux/dma/hsu.h
@@ -35,7 +35,6 @@ struct hsu_dma_chip {
35 unsigned int length; 35 unsigned int length;
36 unsigned int offset; 36 unsigned int offset;
37 struct hsu_dma *hsu; 37 struct hsu_dma *hsu;
38 struct hsu_dma_platform_data *pdata;
39}; 38};
40 39
41#if IS_ENABLED(CONFIG_HSU_DMA) 40#if IS_ENABLED(CONFIG_HSU_DMA)
diff --git a/include/linux/platform_data/dma-hsu.h b/include/linux/platform_data/dma-hsu.h
index 8a1f6a4920b2..3453fa655502 100644
--- a/include/linux/platform_data/dma-hsu.h
+++ b/include/linux/platform_data/dma-hsu.h
@@ -18,8 +18,4 @@ struct hsu_dma_slave {
18 int chan_id; 18 int chan_id;
19}; 19};
20 20
21struct hsu_dma_platform_data {
22 unsigned short nr_channels;
23};
24
25#endif /* _PLATFORM_DATA_DMA_HSU_H */ 21#endif /* _PLATFORM_DATA_DMA_HSU_H */