示例#1
0
static int __init i810_init(void)
{
	int		      retcode;
	drm_device_t	      *dev = &i810_device;

	DRM_DEBUG("\n");

	memset((void *)dev, 0, sizeof(*dev));
	dev->count_lock	  = SPIN_LOCK_UNLOCKED;
	sema_init(&dev->struct_sem, 1);

#ifdef MODULE
	drm_parse_options(i810);
#endif
	DRM_DEBUG("doing misc_register\n");
	if ((retcode = misc_register(&i810_misc))) {
		DRM_ERROR("Cannot register \"%s\"\n", I810_NAME);
		return retcode;
	}
	dev->device = MKDEV(MISC_MAJOR, i810_misc.minor);
	dev->name   = I810_NAME;

   	DRM_DEBUG("doing mem init\n");
	drm_mem_init();
	DRM_DEBUG("doing proc init\n");
	drm_proc_init(dev);
	DRM_DEBUG("doing agp init\n");
	dev->agp    = drm_agp_init();
   	if(dev->agp == NULL) {
	   	DRM_INFO("The i810 drm module requires the agpgart module"
			 " to function correctly\nPlease load the agpgart"
			 " module before you load the i810 module\n");
	   	drm_proc_cleanup();
	   	misc_deregister(&i810_misc);
	   	i810_takedown(dev);
	   	return -ENOMEM;
	}
	DRM_DEBUG("doing ctxbitmap init\n");
	if((retcode = drm_ctxbitmap_init(dev))) {
		DRM_ERROR("Cannot allocate memory for context bitmap.\n");
		drm_proc_cleanup();
		misc_deregister(&i810_misc);
		i810_takedown(dev);
		return retcode;
	}

	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
		 I810_NAME,
		 I810_MAJOR,
		 I810_MINOR,
		 I810_PATCHLEVEL,
		 I810_DATE,
		 i810_misc.minor);

	return 0;
}
static int __init tdfx_init(void)
{
	int		      retcode;
	drm_device_t	      *dev = &tdfx_device;

	DRM_DEBUG("\n");

	memset((void *)dev, 0, sizeof(*dev));
	dev->count_lock	  = SPIN_LOCK_UNLOCKED;
	sema_init(&dev->struct_sem, 1);

#ifdef MODULE
	drm_parse_options(tdfx);
#endif

	if ((retcode = misc_register(&tdfx_misc))) {
		DRM_ERROR("Cannot register \"%s\"\n", TDFX_NAME);
		return retcode;
	}
	dev->device = MKDEV(MISC_MAJOR, tdfx_misc.minor);
	dev->name   = TDFX_NAME;

	drm_mem_init();
	drm_proc_init(dev);
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
	dev->agp    = drm_agp_init();
#endif
	if((retcode = drm_ctxbitmap_init(dev))) {
		DRM_ERROR("Cannot allocate memory for context bitmap.\n");
		drm_proc_cleanup();
		misc_deregister(&tdfx_misc);
		tdfx_takedown(dev);
		return retcode;
	}

	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
		 TDFX_NAME,
		 TDFX_MAJOR,
		 TDFX_MINOR,
		 TDFX_PATCHLEVEL,
		 TDFX_DATE,
		 tdfx_misc.minor);

	return 0;
}
static int __init tdfx_options(char *str)
{
	drm_parse_options(str);
	return 1;
}