Commit 4c97ad99 authored by Heikki Krogerus's avatar Heikki Krogerus Committed by Greg Kroah-Hartman

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: default avatarVinod Koul <vinod.koul@intel.com>
Acked-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 47f82f1a
...@@ -146,7 +146,7 @@ irqreturn_t hsu_dma_irq(struct hsu_dma_chip *chip, unsigned short nr) ...@@ -146,7 +146,7 @@ irqreturn_t hsu_dma_irq(struct hsu_dma_chip *chip, unsigned short nr)
u32 sr; u32 sr;
/* Sanity check */ /* Sanity check */
if (nr >= chip->pdata->nr_channels) if (nr >= chip->hsu->nr_channels)
return IRQ_NONE; return IRQ_NONE;
hsuc = &chip->hsu->chan[nr]; hsuc = &chip->hsu->chan[nr];
...@@ -375,7 +375,6 @@ static void hsu_dma_free_chan_resources(struct dma_chan *chan) ...@@ -375,7 +375,6 @@ static void hsu_dma_free_chan_resources(struct dma_chan *chan)
int hsu_dma_probe(struct hsu_dma_chip *chip) int hsu_dma_probe(struct hsu_dma_chip *chip)
{ {
struct hsu_dma *hsu; struct hsu_dma *hsu;
struct hsu_dma_platform_data *pdata = chip->pdata;
void __iomem *addr = chip->regs + chip->offset; void __iomem *addr = chip->regs + chip->offset;
unsigned short i; unsigned short i;
int ret; int ret;
...@@ -386,25 +385,16 @@ int hsu_dma_probe(struct hsu_dma_chip *chip) ...@@ -386,25 +385,16 @@ int hsu_dma_probe(struct hsu_dma_chip *chip)
chip->hsu = hsu; chip->hsu = hsu;
if (!pdata) { /* Calculate nr_channels from the IO space length */
pdata = devm_kzalloc(chip->dev, sizeof(*pdata), GFP_KERNEL); hsu->nr_channels = (chip->length - chip->offset) / HSU_DMA_CHAN_LENGTH;
if (!pdata)
return -ENOMEM;
chip->pdata = pdata;
/* Guess nr_channels from the IO space length */
pdata->nr_channels = (chip->length - chip->offset) /
HSU_DMA_CHAN_LENGTH;
}
hsu->chan = devm_kcalloc(chip->dev, pdata->nr_channels, hsu->chan = devm_kcalloc(chip->dev, hsu->nr_channels,
sizeof(*hsu->chan), GFP_KERNEL); sizeof(*hsu->chan), GFP_KERNEL);
if (!hsu->chan) if (!hsu->chan)
return -ENOMEM; return -ENOMEM;
INIT_LIST_HEAD(&hsu->dma.channels); INIT_LIST_HEAD(&hsu->dma.channels);
for (i = 0; i < pdata->nr_channels; i++) { for (i = 0; i < hsu->nr_channels; i++) {
struct hsu_dma_chan *hsuc = &hsu->chan[i]; struct hsu_dma_chan *hsuc = &hsu->chan[i];
hsuc->vchan.desc_free = hsu_dma_desc_free; hsuc->vchan.desc_free = hsu_dma_desc_free;
...@@ -440,7 +430,7 @@ int hsu_dma_probe(struct hsu_dma_chip *chip) ...@@ -440,7 +430,7 @@ int hsu_dma_probe(struct hsu_dma_chip *chip)
if (ret) if (ret)
return ret; return ret;
dev_info(chip->dev, "Found HSU DMA, %d channels\n", pdata->nr_channels); dev_info(chip->dev, "Found HSU DMA, %d channels\n", hsu->nr_channels);
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(hsu_dma_probe); EXPORT_SYMBOL_GPL(hsu_dma_probe);
...@@ -452,7 +442,7 @@ int hsu_dma_remove(struct hsu_dma_chip *chip) ...@@ -452,7 +442,7 @@ int hsu_dma_remove(struct hsu_dma_chip *chip)
dma_async_device_unregister(&hsu->dma); dma_async_device_unregister(&hsu->dma);
for (i = 0; i < chip->pdata->nr_channels; i++) { for (i = 0; i < hsu->nr_channels; i++) {
struct hsu_dma_chan *hsuc = &hsu->chan[i]; struct hsu_dma_chan *hsuc = &hsu->chan[i];
tasklet_kill(&hsuc->vchan.task); tasklet_kill(&hsuc->vchan.task);
......
...@@ -107,6 +107,7 @@ struct hsu_dma { ...@@ -107,6 +107,7 @@ struct hsu_dma {
/* channels */ /* channels */
struct hsu_dma_chan *chan; struct hsu_dma_chan *chan;
unsigned short nr_channels;
}; };
static inline struct hsu_dma *to_hsu_dma(struct dma_device *ddev) static inline struct hsu_dma *to_hsu_dma(struct dma_device *ddev)
......
...@@ -31,7 +31,7 @@ static irqreturn_t hsu_pci_irq(int irq, void *dev) ...@@ -31,7 +31,7 @@ static irqreturn_t hsu_pci_irq(int irq, void *dev)
irqreturn_t ret = IRQ_NONE; irqreturn_t ret = IRQ_NONE;
dmaisr = readl(chip->regs + HSU_PCI_DMAISR); dmaisr = readl(chip->regs + HSU_PCI_DMAISR);
for (i = 0; i < chip->pdata->nr_channels; i++) { for (i = 0; i < chip->hsu->nr_channels; i++) {
if (dmaisr & 0x1) if (dmaisr & 0x1)
ret |= hsu_dma_irq(chip, i); ret |= hsu_dma_irq(chip, i);
dmaisr >>= 1; dmaisr >>= 1;
......
...@@ -35,7 +35,6 @@ struct hsu_dma_chip { ...@@ -35,7 +35,6 @@ struct hsu_dma_chip {
unsigned int length; unsigned int length;
unsigned int offset; unsigned int offset;
struct hsu_dma *hsu; struct hsu_dma *hsu;
struct hsu_dma_platform_data *pdata;
}; };
#if IS_ENABLED(CONFIG_HSU_DMA) #if IS_ENABLED(CONFIG_HSU_DMA)
......
...@@ -18,8 +18,4 @@ struct hsu_dma_slave { ...@@ -18,8 +18,4 @@ struct hsu_dma_slave {
int chan_id; int chan_id;
}; };
struct hsu_dma_platform_data {
unsigned short nr_channels;
};
#endif /* _PLATFORM_DATA_DMA_HSU_H */ #endif /* _PLATFORM_DATA_DMA_HSU_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