/* This function is called only from the atmel_lcdfb_probe() so no locking by fb_info->mm_lock around smem_len setting is needed.  */
static int atmel_lcdfb_alloc_video_memory(struct atmel_lcdfb_info *sinfo)
/* This function is called only from the atmel_lcdfb_probe() so no locking by fb_info->mm_lock around smem_len setting is needed.  */
static int atmel_lcdfb_alloc_video_memory(struct atmel_lcdfb_info *sinfo)
{
	struct fb_info *info = sinfo->info;
	struct fb_var_screeninfo *var = &info->var;
	unsigned int smem_len;
	smem_len = (var->xres_virtual * var->yres_virtual
		    * ((var->bits_per_pixel + 7) / 8));
	info->fix.smem_len = max(smem_len, sinfo->smem_len);
	info->screen_base = dma_alloc_writecombine(info->device, info->fix.smem_len,
					(dma_addr_t *)&info->fix.smem_start, GFP_KERNEL);
	if (!info->screen_base) {
		return -ENOMEM;
	}
	memset(info->screen_base, 0, info->fix.smem_len);
	return 0;
}