static int drm_init(void) { extern int linux_guarantee_initialized(void); int error; error = linux_guarantee_initialized(); if (error) return error; if (ISSET(boothowto, AB_DEBUG)) drm_debug = ~(unsigned int)0; spin_lock_init(&drm_minor_lock); idr_init(&drm_minors_idr); linux_mutex_init(&drm_global_mutex); drm_connector_ida_init(); drm_global_init(); drm_sysctl_init(&drm_def); drm_i2c_encoders_init(); return 0; }
static int __init drm_core_init(void) { int ret = -ENOMEM; drm_global_init(); drm_connector_ida_init(); idr_init(&drm_minors_idr); if (register_chrdev(DRM_MAJOR, "drm", &drm_stub_fops)) goto err_p1; drm_class = drm_sysfs_create(THIS_MODULE, "drm"); if (IS_ERR(drm_class)) { printk(KERN_ERR "DRM: Error creating drm class.\n"); ret = PTR_ERR(drm_class); goto err_p2; } drm_debugfs_root = debugfs_create_dir("dri", NULL); if (!drm_debugfs_root) { DRM_ERROR("Cannot create /sys/kernel/debug/dri\n"); ret = -1; goto err_p3; } DRM_INFO("Initialized %s %d.%d.%d %s\n", CORE_NAME, CORE_MAJOR, CORE_MINOR, CORE_PATCHLEVEL, CORE_DATE); return 0; err_p3: drm_sysfs_destroy(); err_p2: unregister_chrdev(DRM_MAJOR, "drm"); idr_destroy(&drm_minors_idr); err_p1: return ret; }