diff mbox

[-next,25/26] fbdev: Use dma_zalloc_coherent

Message ID 881b8f8d85c96b6e9d8735aa10bbf18468688b9d.1402863905.git.joe@perches.com (mailing list archive)
State New, archived
Headers show

Commit Message

Joe Perches June 15, 2014, 8:37 p.m. UTC
Use the zeroing function instead of dma_alloc_coherent & memset(,0,)

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/video/fbdev/da8xx-fb.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Geert Uytterhoeven June 15, 2014, 10:16 p.m. UTC | #1
On Sun, Jun 15, 2014 at 10:37 PM, Joe Perches <joe@perches.com> wrote:
> diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c
> index a8484f7..788f6b3 100644
> --- a/drivers/video/fbdev/da8xx-fb.c
> +++ b/drivers/video/fbdev/da8xx-fb.c
> @@ -1447,18 +1447,15 @@ static int fb_probe(struct platform_device *device)
>                 da8xx_fb_fix.line_length - 1;
>
>         /* allocate palette buffer */
> -       par->v_palette_base = dma_alloc_coherent(NULL,
> -                                              PALETTE_SIZE,
> -                                              (resource_size_t *)
> -                                              &par->p_palette_base,
> -                                              GFP_KERNEL | GFP_DMA);
> +       par->v_palette_base = dma_zalloc_coherent(NULL, PALETTE_SIZE,
> +                                                 (resource_size_t *)&par->p_palette_base,

Suggestion for further cleanup: It seems this cast is no longer needed.

> +                                                 GFP_KERNEL | GFP_DMA);

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Joe Perches June 15, 2014, 11:32 p.m. UTC | #2
On Mon, 2014-06-16 at 00:16 +0200, Geert Uytterhoeven wrote:
> On Sun, Jun 15, 2014 at 10:37 PM, Joe Perches <joe@perches.com> wrote:
> > diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c
[]
> > @@ -1447,18 +1447,15 @@ static int fb_probe(struct platform_device *device)
> >                 da8xx_fb_fix.line_length - 1;
> >
> >         /* allocate palette buffer */
> > -       par->v_palette_base = dma_alloc_coherent(NULL,
> > -                                              PALETTE_SIZE,
> > -                                              (resource_size_t *)
> > -                                              &par->p_palette_base,
> > -                                              GFP_KERNEL | GFP_DMA);
> > +       par->v_palette_base = dma_zalloc_coherent(NULL, PALETTE_SIZE,
> > +                                                 (resource_size_t *)&par->p_palette_base,
> 
> Suggestion for further cleanup: It seems this cast is no longer needed.

Sure, but after this is applied.

--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tomi Valkeinen June 23, 2014, 11:53 a.m. UTC | #3
On 15/06/14 23:37, Joe Perches wrote:
> Use the zeroing function instead of dma_alloc_coherent & memset(,0,)
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  drivers/video/fbdev/da8xx-fb.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c
> index a8484f7..788f6b3 100644
> --- a/drivers/video/fbdev/da8xx-fb.c
> +++ b/drivers/video/fbdev/da8xx-fb.c
> @@ -1447,18 +1447,15 @@ static int fb_probe(struct platform_device *device)
>  		da8xx_fb_fix.line_length - 1;
>  
>  	/* allocate palette buffer */
> -	par->v_palette_base = dma_alloc_coherent(NULL,
> -					       PALETTE_SIZE,
> -					       (resource_size_t *)
> -					       &par->p_palette_base,
> -					       GFP_KERNEL | GFP_DMA);
> +	par->v_palette_base = dma_zalloc_coherent(NULL, PALETTE_SIZE,
> +						  (resource_size_t *)&par->p_palette_base,
> +						  GFP_KERNEL | GFP_DMA);
>  	if (!par->v_palette_base) {
>  		dev_err(&device->dev,
>  			"GLCD: kmalloc for palette buffer failed\n");
>  		ret = -EINVAL;
>  		goto err_release_fb_mem;
>  	}
> -	memset(par->v_palette_base, 0, PALETTE_SIZE);
>  
>  	par->irq = platform_get_irq(device, 0);
>  	if (par->irq < 0) {
> 

Thanks, queued for 3.17.

 Tomi
diff mbox

Patch

diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c
index a8484f7..788f6b3 100644
--- a/drivers/video/fbdev/da8xx-fb.c
+++ b/drivers/video/fbdev/da8xx-fb.c
@@ -1447,18 +1447,15 @@  static int fb_probe(struct platform_device *device)
 		da8xx_fb_fix.line_length - 1;
 
 	/* allocate palette buffer */
-	par->v_palette_base = dma_alloc_coherent(NULL,
-					       PALETTE_SIZE,
-					       (resource_size_t *)
-					       &par->p_palette_base,
-					       GFP_KERNEL | GFP_DMA);
+	par->v_palette_base = dma_zalloc_coherent(NULL, PALETTE_SIZE,
+						  (resource_size_t *)&par->p_palette_base,
+						  GFP_KERNEL | GFP_DMA);
 	if (!par->v_palette_base) {
 		dev_err(&device->dev,
 			"GLCD: kmalloc for palette buffer failed\n");
 		ret = -EINVAL;
 		goto err_release_fb_mem;
 	}
-	memset(par->v_palette_base, 0, PALETTE_SIZE);
 
 	par->irq = platform_get_irq(device, 0);
 	if (par->irq < 0) {