 #ifdef CONFIG_PCI_NAMES printk(KERN_INFO PFX "%s\n", pd->pretty_name); #endif 
static int __devinit nvidiafb_probe(struct pci_dev *pd,				    const struct pci_device_id *ent){	struct nvidia_par *par;	struct fb_info *info;	unsigned short cmd;	NVTRACE_ENTER();	assert(pd != NULL);	info = framebuffer_alloc(sizeof(struct nvidia_par), &pd->dev);	if (!info)		goto err_out;	par = (struct nvidia_par *)info->par;	par->pci_dev = pd;	info->pixmap.addr = kmalloc(8 * 1024, GFP_KERNEL);	if (info->pixmap.addr == NULL)		goto err_out_kfree;	memset(info->pixmap.addr, 0, 8 * 1024);	if (pci_enable_device(pd)) {		printk(KERN_ERR PFX "cannot enable PCI device\n");		goto err_out_enable;	}	if (pci_request_regions(pd, "nvidiafb")) {		printk(KERN_ERR PFX "cannot request PCI regions\n");		goto err_out_request;	}	par->Architecture = nvidia_get_arch(pd);	par->Chipset = (pd->vendor << 16) | pd->device;	printk(KERN_INFO PFX "nVidia device/chipset %X\n", par->Chipset);#ifdef CONFIG_PCI_NAMES	printk(KERN_INFO PFX "%s\n", pd->pretty_name);#endif	if (par->Architecture == 0) {		printk(KERN_ERR PFX "unknown NV_ARCH\n");		goto err_out_free_base0;	}	sprintf(nvidiafb_fix.id, "NV%x", (pd->device & 0x0ff0) >> 4);	par->FlatPanel = flatpanel;	if (flatpanel == 1)		printk(KERN_INFO PFX "flatpanel support enabled\n");	par->CRTCnumber = forceCRTC;	par->FpScale = (!noscale);	par->paneltweak = paneltweak;	/* enable IO and mem if not already done */	pci_read_config_word(pd, PCI_COMMAND, &cmd);	cmd |= (PCI_COMMAND_IO | PCI_COMMAND_MEMORY);	pci_write_config_word(pd, PCI_COMMAND, cmd);	nvidiafb_fix.mmio_start = pci_resource_start(pd, 0);	nvidiafb_fix.smem_start = pci_resource_start(pd, 1);	nvidiafb_fix.mmio_len = pci_resource_len(pd, 0);	par->REGS = ioremap(nvidiafb_fix.mmio_start, nvidiafb_fix.mmio_len);	if (!par->REGS) {		printk(KERN_ERR PFX "cannot ioremap MMIO base\n");		goto err_out_free_base0;	}	NVCommonSetup(info);	par->FbAddress = nvidiafb_fix.smem_start;	par->FbMapSize = par->RamAmountKBytes * 1024;	if (vram && vram * 1024 * 1024 < par->FbMapSize)		par->FbMapSize = vram * 1024 * 1024;	/* Limit amount of vram to 64 MB */	if (par->FbMapSize > 64 * 1024 * 1024)		par->FbMapSize = 64 * 1024 * 1024;	par->FbUsableSize = par->FbMapSize - (128 * 1024);	par->ScratchBufferSize = (par->Architecture < NV_ARCH_10) ? 8 * 1024 :	    16 * 1024;	par->ScratchBufferStart = par->FbUsableSize - par->ScratchBufferSize;	info->screen_base = ioremap(nvidiafb_fix.smem_start, par->FbMapSize);	info->screen_size = par->FbUsableSize;	nvidiafb_fix.smem_len = par->RamAmountKBytes * 1024;	if (!info->screen_base) {		printk(KERN_ERR PFX "cannot ioremap FB base\n");		goto err_out_free_base1;	}	par->FbStart = info->screen_base;#ifdef CONFIG_MTRR	if (!nomtrr) {		par->mtrr.vram = mtrr_add(nvidiafb_fix.smem_start,					  par->RamAmountKBytes * 1024,					  MTRR_TYPE_WRCOMB, 1);		if (par->mtrr.vram < 0) {			printk(KERN_ERR PFX "unable to setup MTRR\n");		} else {			par->mtrr.vram_valid = 1;			/* let there be speed */			printk(KERN_INFO PFX "MTRR set to ON\n");		}	}#endif				/* CONFIG_MTRR */	info->fbops = &nvidia_fb_ops;	info->fix = nvidiafb_fix;	if (nvidia_set_fbinfo(info) < 0) {		printk(KERN_ERR PFX "error setting initial video mode\n");		goto err_out_iounmap_fb;	}	nvidia_save_vga(par, &par->SavedReg);	if (register_framebuffer(info) < 0) {		printk(KERN_ERR PFX "error registering nVidia framebuffer\n");		goto err_out_iounmap_fb;	}	pci_set_drvdata(pd, info);	printk(KERN_INFO PFX	       "PCI nVidia %s framebuffer (%dMB @ 0x%lX)\n",	       info->fix.id,	       par->FbMapSize / (1024 * 1024), info->fix.smem_start);#ifdef CONFIG_PMAC_BACKLIGHT	if (par->FlatPanel && _machine == _MACH_Pmac)		register_backlight_controller(&nvidia_backlight_controller,					      par, "mnca");#endif	NVTRACE_LEAVE();	return 0;      err_out_iounmap_fb:	iounmap(info->screen_base);      err_out_free_base1:	fb_destroy_modedb(info->monspecs.modedb);	nvidia_delete_i2c_busses(par);	iounmap(par->REGS);      err_out_free_base0:	pci_release_regions(pd);      err_out_request:	pci_disable_device(pd);      err_out_enable:	kfree(info->pixmap.addr);      err_out_kfree:	framebuffer_release(info);      err_out:	return -ENODEV;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/982245f01734e9d5a3ab98b2b2e9761ae7719094/nvidia.c/clean/drivers/video/nvidia/nvidia.c