Re: [PATCH] video: mx3_camera: Allocate camera object via kzalloc
On Mon, 19 Mar 2012, Mauro Carvalho Chehab wrote: Em 20-02-2012 16:23, Fabio Estevam escreveu: On Mon, Feb 20, 2012 at 4:17 PM, Guennadi Liakhovetski g.liakhovet...@gmx.de wrote: On Mon, 20 Feb 2012, Fabio Estevam wrote: Align mx3_camera driver with the other soc camera driver implementations by allocating the camera object via kzalloc. Sorry, any specific reason, why you think this aligning is so important? Not really. Just compared it with all other soc camera drivers I found and mx3_camera was the only one that uses vzalloc Any specific reason that requires mx3_camera to use vzalloc instead of kzalloc? kzalloc() is more restrictive than vzalloc(). With v*alloc, it will allocate a virtual memory area, with can be discontinuous, while kzalloc will get a continuous area. The DMA logic need to be prepared for virtual memory, if v*alloc() is used (e. g. using videobuf2-vmalloc). As it is currently including media/videobuf2-dma-contig.h, I this patch makes sense on my eyes. Don't think so. vzalloc() is used in mx3_camera to allocate driver private data objects and are never used for DMA, so, it doesn't have any restrictions on contiguity, coherency, alignment etc. One could argue, that since the struct is anyway smaller than 1 page, it anyway will be allocated in a physically contiguous memory area (will it?) and so, maybe, kmalloc() is less heavy weight than vmalloc() and might save a couple of CPU cycles, but I don't think it's anything important, that we should be optimising for. Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] video: mx3_camera: Allocate camera object via kzalloc
Hi Guennadi, On 3/20/12, Guennadi Liakhovetski g.liakhovet...@gmx.de wrote: Don't think so. vzalloc() is used in mx3_camera to allocate driver private data objects and are never used for DMA, so, it doesn't have any restrictions on contiguity, coherency, alignment etc. Is this valid only for mx3_camera driver? All other soc camera drivers use kzalloc. What makes mx3_camera different in this respect? -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] video: mx3_camera: Allocate camera object via kzalloc
On Tue, 20 Mar 2012, Fabio Estevam wrote: Hi Guennadi, On 3/20/12, Guennadi Liakhovetski g.liakhovet...@gmx.de wrote: Don't think so. vzalloc() is used in mx3_camera to allocate driver private data objects and are never used for DMA, so, it doesn't have any restrictions on contiguity, coherency, alignment etc. Is this valid only for mx3_camera driver? No All other soc camera drivers use kzalloc. What makes mx3_camera different in this respect? Nothing Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] video: mx3_camera: Allocate camera object via kzalloc
On 3/20/12, Guennadi Liakhovetski g.liakhovet...@gmx.de wrote: Is this valid only for mx3_camera driver? No All other soc camera drivers use kzalloc. What makes mx3_camera different in this respect? Nothing Ok, so isn't my patch correct then? -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] video: mx3_camera: Allocate camera object via kzalloc
On Tue, 20 Mar 2012, Fabio Estevam wrote: On 3/20/12, Guennadi Liakhovetski g.liakhovet...@gmx.de wrote: Is this valid only for mx3_camera driver? No All other soc camera drivers use kzalloc. What makes mx3_camera different in this respect? Nothing Ok, so isn't my patch correct then? No. It doesn't improve anything. Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] video: mx3_camera: Allocate camera object via kzalloc
Em 20-02-2012 16:23, Fabio Estevam escreveu: On Mon, Feb 20, 2012 at 4:17 PM, Guennadi Liakhovetski g.liakhovet...@gmx.de wrote: On Mon, 20 Feb 2012, Fabio Estevam wrote: Align mx3_camera driver with the other soc camera driver implementations by allocating the camera object via kzalloc. Sorry, any specific reason, why you think this aligning is so important? Not really. Just compared it with all other soc camera drivers I found and mx3_camera was the only one that uses vzalloc Any specific reason that requires mx3_camera to use vzalloc instead of kzalloc? kzalloc() is more restrictive than vzalloc(). With v*alloc, it will allocate a virtual memory area, with can be discontinuous, while kzalloc will get a continuous area. The DMA logic need to be prepared for virtual memory, if v*alloc() is used (e. g. using videobuf2-vmalloc). As it is currently including media/videobuf2-dma-contig.h, I this patch makes sense on my eyes. Tested with kzalloc and it worked fine on my mx31pdk. If the driver is working with vzalloc, then maybe it is due to some arch-specific implementation for v*alloc. It shouldn't be working like that. Regards, Mauro Regards, Fabio Estevam -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] video: mx3_camera: Allocate camera object via kzalloc
Align mx3_camera driver with the other soc camera driver implementations by allocating the camera object via kzalloc. Signed-off-by: Fabio Estevam fabio.este...@freescale.com --- drivers/media/video/mx3_camera.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c index 7452277..cccd574 100644 --- a/drivers/media/video/mx3_camera.c +++ b/drivers/media/video/mx3_camera.c @@ -1159,7 +1159,7 @@ static int __devinit mx3_camera_probe(struct platform_device *pdev) goto egetres; } - mx3_cam = vzalloc(sizeof(*mx3_cam)); + mx3_cam = kzalloc(sizeof(*mx3_cam), GFP_KERNEL); if (!mx3_cam) { dev_err(pdev-dev, Could not allocate mx3 camera object\n); err = -ENOMEM; -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] video: mx3_camera: Allocate camera object via kzalloc
On Mon, 20 Feb 2012, Fabio Estevam wrote: Align mx3_camera driver with the other soc camera driver implementations by allocating the camera object via kzalloc. Sorry, any specific reason, why you think this aligning is so important? I personally don't see any. Thanks Guennadi Signed-off-by: Fabio Estevam fabio.este...@freescale.com --- drivers/media/video/mx3_camera.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c index 7452277..cccd574 100644 --- a/drivers/media/video/mx3_camera.c +++ b/drivers/media/video/mx3_camera.c @@ -1159,7 +1159,7 @@ static int __devinit mx3_camera_probe(struct platform_device *pdev) goto egetres; } - mx3_cam = vzalloc(sizeof(*mx3_cam)); + mx3_cam = kzalloc(sizeof(*mx3_cam), GFP_KERNEL); if (!mx3_cam) { dev_err(pdev-dev, Could not allocate mx3 camera object\n); err = -ENOMEM; -- 1.7.1 --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] video: mx3_camera: Allocate camera object via kzalloc
On Mon, Feb 20, 2012 at 4:17 PM, Guennadi Liakhovetski g.liakhovet...@gmx.de wrote: On Mon, 20 Feb 2012, Fabio Estevam wrote: Align mx3_camera driver with the other soc camera driver implementations by allocating the camera object via kzalloc. Sorry, any specific reason, why you think this aligning is so important? Not really. Just compared it with all other soc camera drivers I found and mx3_camera was the only one that uses vzalloc Any specific reason that requires mx3_camera to use vzalloc instead of kzalloc? Tested with kzalloc and it worked fine on my mx31pdk. Regards, Fabio Estevam -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html