mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2/2 v2] pch_dma: Reduce wasting memory
@ 2011-10-12  0:38 Tomoya MORINAGA
  2011-10-12  5:30 ` Vinod Koul
  0 siblings, 1 reply; 3+ messages in thread
From: Tomoya MORINAGA @ 2011-10-12  0:38 UTC (permalink / raw)
  To: Dan Williams, Vinod Koul, linux-kernel
  Cc: qi.wang, yong.y.wang, joel.clark, kok.howg.ewe, Tomoya MORINAGA

nr_channels is defined in "struct pch_dma".
and struct pch_dma_chan is defined in "struct pch_dma".
So, "sizeof(struct pch_dma_chan) * nr_channels" is unnecessary.

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.lapis-semi.com>
---
v2: Change sizeof(struct pch_dma) to sizeof(*pd)
---
 drivers/dma/pch_dma.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c
index 326fedc..58b215c 100644
--- a/drivers/dma/pch_dma.c
+++ b/drivers/dma/pch_dma.c
@@ -997,8 +997,7 @@ static int __devinit pch_dma_probe(struct pci_dev *pdev,
 	int i;
 
 	nr_channels = id->driver_data;
-	pd = kzalloc(sizeof(struct pch_dma)+
-		sizeof(struct pch_dma_chan) * nr_channels, GFP_KERNEL);
+	pd = kzalloc(sizeof(*pd), GFP_KERNEL);
 	if (!pd)
 		return -ENOMEM;
 
-- 
1.7.4.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2 v2] pch_dma: Reduce wasting memory
  2011-10-12  0:38 [PATCH 2/2 v2] pch_dma: Reduce wasting memory Tomoya MORINAGA
@ 2011-10-12  5:30 ` Vinod Koul
  2011-10-12  6:24   ` Tomoya MORINAGA
  0 siblings, 1 reply; 3+ messages in thread
From: Vinod Koul @ 2011-10-12  5:30 UTC (permalink / raw)
  To: Tomoya MORINAGA
  Cc: Dan Williams, linux-kernel, qi.wang, yong.y.wang, joel.clark,
	kok.howg.ewe

On Wed, 2011-10-12 at 09:38 +0900, Tomoya MORINAGA wrote:
> nr_channels is defined in "struct pch_dma".
> and struct pch_dma_chan is defined in "struct pch_dma".
> So, "sizeof(struct pch_dma_chan) * nr_channels" is unnecessary.
> 
> Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.lapis-semi.com>
> ---
> v2: Change sizeof(struct pch_dma) to sizeof(*pd)
> ---
>  drivers/dma/pch_dma.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c
> index 326fedc..58b215c 100644
> --- a/drivers/dma/pch_dma.c
> +++ b/drivers/dma/pch_dma.c
> @@ -997,8 +997,7 @@ static int __devinit pch_dma_probe(struct pci_dev *pdev,
>  	int i;
>  
>  	nr_channels = id->driver_data;
> -	pd = kzalloc(sizeof(struct pch_dma)+
> -		sizeof(struct pch_dma_chan) * nr_channels, GFP_KERNEL);
> +	pd = kzalloc(sizeof(*pd), GFP_KERNEL);
>  	if (!pd)
>  		return -ENOMEM;
>  
Applied thanks.

Although we can further optimize by removing static array and
dynamically allocate channel structures based on nr_channels, that can
be taken further separately.

-- 
~Vinod


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2 v2] pch_dma: Reduce wasting memory
  2011-10-12  5:30 ` Vinod Koul
@ 2011-10-12  6:24   ` Tomoya MORINAGA
  0 siblings, 0 replies; 3+ messages in thread
From: Tomoya MORINAGA @ 2011-10-12  6:24 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Dan Williams, linux-kernel, qi.wang, yong.y.wang, joel.clark,
	kok.howg.ewe

(2011/10/12 14:30), Vinod Koul wrote:
> Applied thanks.
>
> Although we can further optimize by removing static array and
> dynamically allocate channel structures based on nr_channels, that can
> be taken further separately.
>
Yes, I think so.
We will improve data memory structure using dynamic memory allocation 
based on nr_channels.

Thanks,
-- 
tomoya
ROHM Co., Ltd.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-10-12  6:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-12  0:38 [PATCH 2/2 v2] pch_dma: Reduce wasting memory Tomoya MORINAGA
2011-10-12  5:30 ` Vinod Koul
2011-10-12  6:24   ` Tomoya MORINAGA

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®