From: andriy.shevchenko@linux.intel.com (Andy Shevchenko)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFC 22/26] ARM: omap: move dma channel allocation into plat-omap code
Date: Thu, 02 Jan 2014 17:46:40 +0200 [thread overview]
Message-ID: <1388677600.1871.254.camel@smile> (raw)
In-Reply-To: <E1Vyjwm-0005FP-2G@rmk-PC.arm.linux.org.uk>
On Thu, 2014-01-02 at 15:12 +0000, Russell King wrote:
> This really needs to be there, because otherwise the plat-omap code can
> kfree() this data structure, and then re-use the pointer later.
One comment bellow.
>
> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
> ---
> arch/arm/mach-omap1/dma.c | 11 -----------
> arch/arm/mach-omap2/dma.c | 7 -------
> arch/arm/plat-omap/dma.c | 11 ++++++++---
> include/linux/omap-dma.h | 1 -
> 4 files changed, 8 insertions(+), 22 deletions(-)
>
> diff --git a/arch/arm/mach-omap1/dma.c b/arch/arm/mach-omap1/dma.c
> index 4aae75d40bdd..3e93d0a323a4 100644
> --- a/arch/arm/mach-omap1/dma.c
> +++ b/arch/arm/mach-omap1/dma.c
> @@ -325,17 +325,6 @@ static int __init omap1_system_dma_init(void)
> d->dev_caps |= CLEAR_CSR_ON_READ;
> d->dev_caps |= IS_WORD_16;
>
> -
> - d->chan = kzalloc(sizeof(struct omap_dma_lch) *
> - (d->lch_count), GFP_KERNEL);
> - if (!d->chan) {
> - dev_err(&pdev->dev,
> - "%s: Memory allocation failed for d->chan!\n",
> - __func__);
> - ret = -ENOMEM;
> - goto exit_release_d;
> - }
> -
> if (cpu_is_omap15xx())
> d->chan_count = 9;
> else if (cpu_is_omap16xx() || cpu_is_omap7xx()) {
> diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
> index 244ff5012aed..9f210d637354 100644
> --- a/arch/arm/mach-omap2/dma.c
> +++ b/arch/arm/mach-omap2/dma.c
> @@ -251,13 +251,6 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
> }
>
> d = oh->dev_attr;
> - d->chan = kzalloc(sizeof(struct omap_dma_lch) *
> - (d->lch_count), GFP_KERNEL);
> -
> - if (!d->chan) {
> - dev_err(&pdev->dev, "%s: kzalloc fail\n", __func__);
> - return -ENOMEM;
> - }
>
> if (cpu_is_omap34xx() && (omap_type() != OMAP2_DEVICE_TYPE_GP))
> d->dev_caps |= HS_CHANNELS_RESERVED;
> diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
> index d4d9a5e62152..377c3d7dc4ce 100644
> --- a/arch/arm/plat-omap/dma.c
> +++ b/arch/arm/plat-omap/dma.c
> @@ -2030,9 +2030,16 @@ static int omap_system_dma_probe(struct platform_device *pdev)
>
> dma_lch_count = d->lch_count;
> dma_chan_count = dma_lch_count;
> - dma_chan = d->chan;
> enable_1510_mode = d->dev_caps & ENABLE_1510_MODE;
>
> + dma_chan = devm_kzalloc(&pdev->dev, sizeof(struct omap_dma_lch) *
> + dma_lch_count, GFP_KERNEL);
devm_kcalloc ?
> + if (!dma_chan) {
> + dev_err(&pdev->dev, "%s: kzalloc fail\n", __func__);
> + return -ENOMEM;
> + }
> +
> +
> if (dma_omap2plus()) {
> dma_linked_lch = kzalloc(sizeof(struct dma_link_info) *
> dma_lch_count, GFP_KERNEL);
> @@ -2117,7 +2124,6 @@ static int omap_system_dma_probe(struct platform_device *pdev)
> }
>
> exit_dma_lch_fail:
> - kfree(dma_chan);
> return ret;
> }
>
> @@ -2137,7 +2143,6 @@ static int omap_system_dma_remove(struct platform_device *pdev)
> free_irq(dma_irq, (void *)(irq_rel + 1));
> }
> }
> - kfree(dma_chan);
> return 0;
> }
>
> diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
> index 41328725721a..7813636a193d 100644
> --- a/include/linux/omap-dma.h
> +++ b/include/linux/omap-dma.h
> @@ -268,7 +268,6 @@ struct omap_dma_dev_attr {
> u32 dev_caps;
> u16 lch_count;
> u16 chan_count;
> - struct omap_dma_lch *chan;
> };
>
> enum {
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
next prev parent reply other threads:[~2014-01-02 15:46 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-02 15:08 [PATCH RFC 00/26] Migrate more OMAP DMA code to DMA engine Russell King - ARM Linux
2014-01-02 15:08 ` [PATCH RFC 01/26] dmaengine: omap-dma: use devm_kzalloc() to allocate omap_dmadev Russell King
2014-01-02 15:09 ` [PATCH RFC 02/26] dmaengine: omap-dma: provide a hook to get the underlying DMA platform ops Russell King
2014-01-02 15:09 ` [PATCH RFC 03/26] dmaengine: omap-dma: program hardware directly Russell King
2014-01-22 12:54 ` Sricharan R
2014-01-22 14:13 ` Russell King - ARM Linux
2014-01-02 15:09 ` [PATCH RFC 04/26] dmaengine: omap-dma: consolidate writes to DMA registers Russell King
2014-01-02 15:09 ` [PATCH RFC 05/26] dmaengine: omap-dma: control start/stop directly Russell King
2014-01-13 22:18 ` Tony Lindgren
2014-01-02 15:09 ` [PATCH RFC 06/26] dmaengine: omap-dma: move reading of dma position to omap-dma.c Russell King
2014-01-02 15:10 ` [PATCH RFC 07/26] dmaengine: omap-dma: consolidate setup of CSDP Russell King
2014-01-02 15:10 ` [PATCH RFC 08/26] dmaengine: omap-dma: consolidate setup of CCR Russell King
2014-01-13 22:14 ` Tony Lindgren
2014-01-13 23:12 ` Russell King - ARM Linux
2014-01-14 13:39 ` Russell King - ARM Linux
2014-01-14 17:04 ` Tony Lindgren
2014-01-22 12:55 ` Sricharan R
2014-01-22 14:19 ` Russell King - ARM Linux
2014-01-22 14:39 ` Santosh Shilimkar
2014-01-02 15:10 ` [PATCH RFC 09/26] dmaengine: omap-dma: provide register definitions Russell King
2014-01-02 15:10 ` [PATCH RFC 10/26] dmaengine: omap-dma: move CCR buffering disable errata out of the fast path Russell King
2014-01-02 15:10 ` [PATCH RFC 11/26] dmaengine: omap-dma: consolidate clearing channel status register Russell King
2014-01-02 15:10 ` [PATCH RFC 12/26] dmaengine: omap-dma: improve efficiency loading C.SA/C.EI/C.FI registers Russell King
2014-01-02 15:11 ` [PATCH RFC 13/26] dmaengine: omap-dma: move clnk_ctrl setting to preparation functions Russell King
2014-01-02 15:11 ` [PATCH RFC 14/26] dmaengine: omap-dma: move barrier to omap_dma_start_desc() Russell King
2014-01-02 15:11 ` [PATCH RFC 15/26] dmaengine: omap-dma: use cached CCR value when enabling DMA Russell King
2014-01-02 15:11 ` [PATCH RFC 16/26] dmaengine: omap-dma: provide register read/write functions Russell King
2014-01-02 15:11 ` [PATCH RFC 17/26] dmaengine: omap-dma: cleanup errata 3.3 handling Russell King
2014-01-02 15:11 ` [PATCH RFC 18/26] ARM: omap: remove references to disable_irq_lch Russell King
2014-01-02 15:12 ` [PATCH RFC 19/26] ARM: omap: remove almost-const variables Russell King
2014-01-02 15:12 ` [PATCH RFC 20/26] ARM: omap: clean up DMA register accesses Russell King
2014-01-02 15:49 ` Andy Shevchenko
2014-01-02 16:07 ` Russell King - ARM Linux
2014-01-02 15:12 ` [PATCH RFC 21/26] ARM: omap: dma: get rid of errata global Russell King
2014-01-02 15:12 ` [PATCH RFC 22/26] ARM: omap: move dma channel allocation into plat-omap code Russell King
2014-01-02 15:46 ` Andy Shevchenko [this message]
2014-01-02 15:12 ` [PATCH RFC 23/26] ARM: omap: dma: get rid of 'p' allocation and clean up Russell King
2014-01-02 15:12 ` [PATCH RFC 24/26] dmaengine: omap-dma: move register read/writes into omap-dma.c Russell King
2014-01-02 15:13 ` [PATCH RFC 25/26] dmaengine: omap-dma: move IRQ handling to omap-dma Russell King
2014-01-02 15:13 ` [PATCH RFC 26/26] ARM: omap2: ensure dma platform device has resources Russell King
2014-01-08 1:21 ` [PATCH RFC 00/26] Migrate more OMAP DMA code to DMA engine Tony Lindgren
2014-01-09 15:24 ` Russell King - ARM Linux
2014-01-13 14:18 ` Russell King - ARM Linux
2014-01-13 17:37 ` Tony Lindgren
2014-01-13 18:55 ` Russell King - ARM Linux
2014-01-13 19:26 ` Tony Lindgren
2014-01-13 20:34 ` Russell King - ARM Linux
2014-01-13 21:02 ` Tony Lindgren
2014-01-13 21:11 ` Russell King - ARM Linux
2014-01-13 21:21 ` Tony Lindgren
2014-01-13 21:28 ` Russell King - ARM Linux
2014-01-13 22:03 ` Tony Lindgren
2014-01-09 12:37 ` Vinod Koul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1388677600.1871.254.camel@smile \
--to=andriy.shevchenko@linux.intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).