if (drm_core_check_feature(dev, DRIVER_HAVE_DMA)) 
if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) && !dev->driver->release) 
int drm_release( struct inode *inode, struct file *filp ){	drm_file_t *priv = filp->private_data;	drm_device_t *dev;	int retcode = 0;	lock_kernel();	dev = priv->head->dev;	DRM_DEBUG( "open_count = %d\n", dev->open_count );	if (dev->driver->prerelease)		dev->driver->prerelease(dev, filp);	/* ========================================================	 * Begin inline drm_release	 */	DRM_DEBUG( "pid = %d, device = 0x%lx, open_count = %d\n",		   current->pid, (long)old_encode_dev(priv->head->device), dev->open_count );	if ( priv->lock_count && dev->lock.hw_lock &&	     _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) &&	     dev->lock.filp == filp ) {		DRM_DEBUG( "File %p released, freeing lock for context %d\n",			filp,			_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) );				if (dev->driver->release)			dev->driver->release(dev, filp);		drm_lock_free( dev, &dev->lock.hw_lock->lock,				_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) );				/* FIXME: may require heavy-handed reset of                                   hardware at this point, possibly                                   processed via a callback to the X                                   server. */	}	else if ( dev->driver->release && priv->lock_count && dev->lock.hw_lock ) {		/* The lock is required to reclaim buffers */		DECLARE_WAITQUEUE( entry, current );		add_wait_queue( &dev->lock.lock_queue, &entry );		for (;;) {			__set_current_state(TASK_INTERRUPTIBLE);			if ( !dev->lock.hw_lock ) {				/* Device has been unregistered */				retcode = -EINTR;				break;			}			if ( drm_lock_take( &dev->lock.hw_lock->lock,					     DRM_KERNEL_CONTEXT ) ) {				dev->lock.filp	    = filp;				dev->lock.lock_time = jiffies;                                atomic_inc( &dev->counts[_DRM_STAT_LOCKS] );				break;	/* Got lock */			}				/* Contention */			schedule();			if ( signal_pending( current ) ) {				retcode = -ERESTARTSYS;				break;			}		}		__set_current_state(TASK_RUNNING);		remove_wait_queue( &dev->lock.lock_queue, &entry );		if( !retcode ) {			if (dev->driver->release)				dev->driver->release(dev, filp);			drm_lock_free( dev, &dev->lock.hw_lock->lock,					DRM_KERNEL_CONTEXT );		}	}		if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))	{		dev->driver->reclaim_buffers(dev, filp);	}	drm_fasync( -1, filp, 0 );	down( &dev->ctxlist_sem );	if ( !list_empty( &dev->ctxlist->head ) ) {		drm_ctx_list_t *pos, *n;		list_for_each_entry_safe( pos, n, &dev->ctxlist->head, head ) {			if ( pos->tag == priv &&			     pos->handle != DRM_KERNEL_CONTEXT ) {				if (dev->driver->context_dtor)					dev->driver->context_dtor(dev, pos->handle);				drm_ctxbitmap_free( dev, pos->handle );				list_del( &pos->head );				drm_free( pos, sizeof(*pos), DRM_MEM_CTXLIST );				--dev->ctx_count;			}		}	}	up( &dev->ctxlist_sem );	down( &dev->struct_sem );	if ( priv->remove_auth_on_close == 1 ) {		drm_file_t *temp = dev->file_first;		while ( temp ) {			temp->authenticated = 0;			temp = temp->next;		}	}	if ( priv->prev ) {		priv->prev->next = priv->next;	} else {		dev->file_first	 = priv->next;	}	if ( priv->next ) {		priv->next->prev = priv->prev;	} else {		dev->file_last	 = priv->prev;	}	up( &dev->struct_sem );		if (dev->driver->free_filp_priv)		dev->driver->free_filp_priv(dev, priv);	drm_free( priv, sizeof(*priv), DRM_MEM_FILES );	/* ========================================================	 * End inline drm_release	 */	atomic_inc( &dev->counts[_DRM_STAT_CLOSES] );	spin_lock( &dev->count_lock );	if ( !--dev->open_count ) {		if ( atomic_read( &dev->ioctl_count ) || dev->blocked ) {			DRM_ERROR( "Device busy: %d %d\n",				   atomic_read( &dev->ioctl_count ),				   dev->blocked );			spin_unlock( &dev->count_lock );			unlock_kernel();			return -EBUSY;		}		spin_unlock( &dev->count_lock );		unlock_kernel();		return drm_takedown( dev );	}	spin_unlock( &dev->count_lock );	unlock_kernel();	return retcode;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/0c7b525c344bc29a760c37053f8d5c80292ee1be/drm_fops.c/buggy/drivers/char/drm/drm_fops.c