fb_set_cmap(&all->info.cmap, &all->info); 
static void tcx_init_one(struct sbus_dev *sdev){	struct all_info *all;	int linebytes, i;	all = kmalloc(sizeof(*all), GFP_KERNEL);	if (!all) {		printk(KERN_ERR "tcx: Cannot allocate memory.\n");		return;	}	memset(all, 0, sizeof(*all));	INIT_LIST_HEAD(&all->list);	spin_lock_init(&all->par.lock);	all->par.sdev = sdev;	all->par.lowdepth = prom_getbool(sdev->prom_node, "tcx-8-bit");	sbusfb_fill_var(&all->info.var, sdev->prom_node, 8);	linebytes = prom_getintdefault(sdev->prom_node, "linebytes",				       all->info.var.xres);	all->par.fbsize = PAGE_ALIGN(linebytes * all->info.var.yres);	all->par.tec = sbus_ioremap(&sdev->resource[7], 0,			     sizeof(struct tcx_tec), "tcx tec");	all->par.thc = sbus_ioremap(&sdev->resource[9], 0,			     sizeof(struct tcx_thc), "tcx thc");	all->par.bt = sbus_ioremap(&sdev->resource[8], 0,			     sizeof(struct bt_regs), "tcx dac");	memcpy(&all->par.mmap_map, &__tcx_mmap_map, sizeof(all->par.mmap_map));	if (!all->par.lowdepth) {		all->par.cplane = sbus_ioremap(&sdev->resource[4], 0,				     all->par.fbsize * sizeof(u32), "tcx cplane");	} else {		all->par.mmap_map[1].size = SBUS_MMAP_EMPTY;		all->par.mmap_map[4].size = SBUS_MMAP_EMPTY;		all->par.mmap_map[5].size = SBUS_MMAP_EMPTY;		all->par.mmap_map[6].size = SBUS_MMAP_EMPTY;	}	all->par.physbase = 0;	for (i = 0; i < TCX_MMAP_ENTRIES; i++) {		int j;		switch (i) {		case 10:			j = 12;			break;		case 11: case 12:			j = i - 1;			break;		default:			j = i;			break;		};		all->par.mmap_map[i].poff = sdev->reg_addrs[j].phys_addr;	}	all->info.flags = FBINFO_DEFAULT;	all->info.fbops = &tcx_ops;#ifdef CONFIG_SPARC32	all->info.screen_base = (char __iomem *)		prom_getintdefault(sdev->prom_node, "address", 0);#endif	if (!all->info.screen_base)		all->info.screen_base = sbus_ioremap(&sdev->resource[0], 0,				     all->par.fbsize, "tcx ram");	all->info.par = &all->par;	/* Initialize brooktree DAC. */	sbus_writel(0x04 << 24, &all->par.bt->addr);         /* color planes */	sbus_writel(0xff << 24, &all->par.bt->control);	sbus_writel(0x05 << 24, &all->par.bt->addr);	sbus_writel(0x00 << 24, &all->par.bt->control);	sbus_writel(0x06 << 24, &all->par.bt->addr);         /* overlay plane */	sbus_writel(0x73 << 24, &all->par.bt->control);	sbus_writel(0x07 << 24, &all->par.bt->addr);	sbus_writel(0x00 << 24, &all->par.bt->control);	tcx_reset(&all->info);	tcx_blank(0, &all->info);	if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {		printk(KERN_ERR "tcx: Could not allocate color map.\n");		kfree(all);		return;	}	tcx_init_fix(&all->info, linebytes);	if (register_framebuffer(&all->info) < 0) {		printk(KERN_ERR "tcx: Could not register framebuffer.\n");		fb_dealloc_cmap(&all->info.cmap);		kfree(all);		return;	}	list_add(&all->list, &tcx_list);	printk("tcx: %s at %lx:%lx, %s\n",	       sdev->prom_name,	       (long) sdev->reg_addrs[0].which_io,	       (long) sdev->reg_addrs[0].phys_addr,	       all->par.lowdepth ? "8-bit only" : "24-bit depth");}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/6ee7c15294985e4e722959fd4482df60cefd2cc8/tcx.c/clean/drivers/video/tcx.c