/* Limit the number of available kernel image capture buffers based on the number requested, the currently selected image size, and the maximum amount of memory permitted for kernel capture buffers.  */
static int omap24xxcam_vbq_setup(struct videobuf_queue *vbq, unsigned int *cnt, unsigned int *size)
/* Limit the number of available kernel image capture buffers based on the number requested, the currently selected image size, and the maximum amount of memory permitted for kernel capture buffers.  */
static int omap24xxcam_vbq_setup(struct videobuf_queue *vbq, unsigned int *cnt, unsigned int *size)
{
	struct omap24xxcam_fh *fh = vbq->priv_data;
	if (*cnt <= 0)
		*cnt = VIDEO_MAX_FRAME;
	if (*cnt > VIDEO_MAX_FRAME)
		*cnt = VIDEO_MAX_FRAME;
	*size = fh->pix.sizeimage;
	while (*size * *cnt > fh->cam->capture_mem)
		(*cnt)--;
	return 0;
}