forked from mirrors/linux
		
	drm: Remove drm_driver->set_busid hook
The only special-case is pci devices, and we can easily handle this in the core. Do so and drop a pile of boilerplate from drivers. Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170524145212.27837-5-daniel.vetter@ffwll.ch
This commit is contained in:
		
							parent
							
								
									76bba2cdb5
								
							
						
					
					
						commit
						5c484cee7e
					
				
					 23 changed files with 3 additions and 31 deletions
				
			
		| 
						 | 
				
			
			@ -734,7 +734,6 @@ static struct drm_driver kms_driver = {
 | 
			
		|||
	.open = amdgpu_driver_open_kms,
 | 
			
		||||
	.postclose = amdgpu_driver_postclose_kms,
 | 
			
		||||
	.lastclose = amdgpu_driver_lastclose_kms,
 | 
			
		||||
	.set_busid = drm_pci_set_busid,
 | 
			
		||||
	.unload = amdgpu_driver_unload_kms,
 | 
			
		||||
	.get_vblank_counter = amdgpu_get_vblank_counter_kms,
 | 
			
		||||
	.enable_vblank = amdgpu_enable_vblank_kms,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -197,7 +197,6 @@ static struct drm_driver driver = {
 | 
			
		|||
 | 
			
		||||
	.load = ast_driver_load,
 | 
			
		||||
	.unload = ast_driver_unload,
 | 
			
		||||
	.set_busid = drm_pci_set_busid,
 | 
			
		||||
 | 
			
		||||
	.fops = &ast_fops,
 | 
			
		||||
	.name = DRIVER_NAME,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -84,7 +84,6 @@ static struct drm_driver bochs_driver = {
 | 
			
		|||
	.driver_features	= DRIVER_GEM | DRIVER_MODESET,
 | 
			
		||||
	.load			= bochs_load,
 | 
			
		||||
	.unload			= bochs_unload,
 | 
			
		||||
	.set_busid		= drm_pci_set_busid,
 | 
			
		||||
	.fops			= &bochs_fops,
 | 
			
		||||
	.name			= "bochs-drm",
 | 
			
		||||
	.desc			= "bochs dispi vga interface (qemu stdvga)",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -132,7 +132,6 @@ static struct drm_driver driver = {
 | 
			
		|||
	.driver_features = DRIVER_MODESET | DRIVER_GEM,
 | 
			
		||||
	.load = cirrus_driver_load,
 | 
			
		||||
	.unload = cirrus_driver_unload,
 | 
			
		||||
	.set_busid = drm_pci_set_busid,
 | 
			
		||||
	.fops = &cirrus_driver_fops,
 | 
			
		||||
	.name = DRIVER_NAME,
 | 
			
		||||
	.desc = DRIVER_DESC,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,6 +32,7 @@ void drm_lastclose(struct drm_device *dev);
 | 
			
		|||
int drm_irq_by_busid(struct drm_device *dev, void *data,
 | 
			
		||||
		     struct drm_file *file_priv);
 | 
			
		||||
void drm_pci_agp_destroy(struct drm_device *dev);
 | 
			
		||||
int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master);
 | 
			
		||||
 | 
			
		||||
/* drm_prime.c */
 | 
			
		||||
int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -143,8 +143,8 @@ static int drm_set_busid(struct drm_device *dev, struct drm_file *file_priv)
 | 
			
		|||
	if (master->unique != NULL)
 | 
			
		||||
		drm_unset_busid(dev, master);
 | 
			
		||||
 | 
			
		||||
	if (dev->driver->set_busid) {
 | 
			
		||||
		ret = dev->driver->set_busid(dev, master);
 | 
			
		||||
	if (dev_is_pci(dev->dev)) {
 | 
			
		||||
		ret = drm_pci_set_busid(dev, master);
 | 
			
		||||
		if (ret) {
 | 
			
		||||
			drm_unset_busid(dev, master);
 | 
			
		||||
			return ret;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -149,7 +149,6 @@ int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master)
 | 
			
		|||
	master->unique_len = strlen(master->unique);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
EXPORT_SYMBOL(drm_pci_set_busid);
 | 
			
		||||
 | 
			
		||||
static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -480,7 +480,6 @@ static struct drm_driver driver = {
 | 
			
		|||
	.load = psb_driver_load,
 | 
			
		||||
	.unload = psb_driver_unload,
 | 
			
		||||
	.lastclose = psb_driver_lastclose,
 | 
			
		||||
	.set_busid = drm_pci_set_busid,
 | 
			
		||||
 | 
			
		||||
	.num_ioctls = ARRAY_SIZE(psb_ioctls),
 | 
			
		||||
	.irq_preinstall = psb_irq_preinstall,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -59,7 +59,6 @@ static struct drm_driver driver = {
 | 
			
		|||
	.load = i810_driver_load,
 | 
			
		||||
	.lastclose = i810_driver_lastclose,
 | 
			
		||||
	.preclose = i810_driver_preclose,
 | 
			
		||||
	.set_busid = drm_pci_set_busid,
 | 
			
		||||
	.dma_quiescent = i810_driver_dma_quiescent,
 | 
			
		||||
	.ioctls = i810_ioctls,
 | 
			
		||||
	.fops = &i810_driver_fops,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2622,7 +2622,6 @@ static struct drm_driver driver = {
 | 
			
		|||
	.open = i915_driver_open,
 | 
			
		||||
	.lastclose = i915_driver_lastclose,
 | 
			
		||||
	.postclose = i915_driver_postclose,
 | 
			
		||||
	.set_busid = drm_pci_set_busid,
 | 
			
		||||
 | 
			
		||||
	.gem_close_object = i915_gem_close_object,
 | 
			
		||||
	.gem_free_object_unlocked = i915_gem_free_object,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -62,7 +62,6 @@ static struct drm_driver driver = {
 | 
			
		|||
	.load = mga_driver_load,
 | 
			
		||||
	.unload = mga_driver_unload,
 | 
			
		||||
	.lastclose = mga_driver_lastclose,
 | 
			
		||||
	.set_busid = drm_pci_set_busid,
 | 
			
		||||
	.dma_quiescent = mga_driver_dma_quiescent,
 | 
			
		||||
	.get_vblank_counter = mga_get_vblank_counter,
 | 
			
		||||
	.enable_vblank = mga_enable_vblank,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -91,7 +91,6 @@ static struct drm_driver driver = {
 | 
			
		|||
	.driver_features = DRIVER_GEM | DRIVER_MODESET,
 | 
			
		||||
	.load = mgag200_driver_load,
 | 
			
		||||
	.unload = mgag200_driver_unload,
 | 
			
		||||
	.set_busid = drm_pci_set_busid,
 | 
			
		||||
	.fops = &mgag200_driver_fops,
 | 
			
		||||
	.name = DRIVER_NAME,
 | 
			
		||||
	.desc = DRIVER_DESC,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1102,7 +1102,6 @@ static int __init
 | 
			
		|||
nouveau_drm_init(void)
 | 
			
		||||
{
 | 
			
		||||
	driver_pci = driver_stub;
 | 
			
		||||
	driver_pci.set_busid = drm_pci_set_busid;
 | 
			
		||||
	driver_platform = driver_stub;
 | 
			
		||||
 | 
			
		||||
	nouveau_display_options();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -262,8 +262,6 @@ static struct drm_driver qxl_driver = {
 | 
			
		|||
			   DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED |
 | 
			
		||||
			   DRIVER_ATOMIC,
 | 
			
		||||
 | 
			
		||||
	.set_busid = drm_pci_set_busid,
 | 
			
		||||
 | 
			
		||||
	.dumb_create = qxl_mode_dumb_create,
 | 
			
		||||
	.dumb_map_offset = qxl_mode_dumb_mmap,
 | 
			
		||||
	.dumb_destroy = drm_gem_dumb_destroy,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -62,7 +62,6 @@ static struct drm_driver driver = {
 | 
			
		|||
	.load = r128_driver_load,
 | 
			
		||||
	.preclose = r128_driver_preclose,
 | 
			
		||||
	.lastclose = r128_driver_lastclose,
 | 
			
		||||
	.set_busid = drm_pci_set_busid,
 | 
			
		||||
	.get_vblank_counter = r128_get_vblank_counter,
 | 
			
		||||
	.enable_vblank = r128_enable_vblank,
 | 
			
		||||
	.disable_vblank = r128_disable_vblank,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -545,7 +545,6 @@ static struct drm_driver kms_driver = {
 | 
			
		|||
	.open = radeon_driver_open_kms,
 | 
			
		||||
	.postclose = radeon_driver_postclose_kms,
 | 
			
		||||
	.lastclose = radeon_driver_lastclose_kms,
 | 
			
		||||
	.set_busid = drm_pci_set_busid,
 | 
			
		||||
	.unload = radeon_driver_unload_kms,
 | 
			
		||||
	.get_vblank_counter = radeon_get_vblank_counter_kms,
 | 
			
		||||
	.enable_vblank = radeon_enable_vblank_kms,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -55,7 +55,6 @@ static struct drm_driver driver = {
 | 
			
		|||
	.preclose = savage_reclaim_buffers,
 | 
			
		||||
	.lastclose = savage_driver_lastclose,
 | 
			
		||||
	.unload = savage_driver_unload,
 | 
			
		||||
	.set_busid = drm_pci_set_busid,
 | 
			
		||||
	.ioctls = savage_ioctls,
 | 
			
		||||
	.dma_ioctl = savage_bci_buffers,
 | 
			
		||||
	.fops = &savage_driver_fops,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -104,7 +104,6 @@ static struct drm_driver driver = {
 | 
			
		|||
	.open = sis_driver_open,
 | 
			
		||||
	.preclose = sis_reclaim_buffers_locked,
 | 
			
		||||
	.postclose = sis_driver_postclose,
 | 
			
		||||
	.set_busid = drm_pci_set_busid,
 | 
			
		||||
	.dma_quiescent = sis_idle,
 | 
			
		||||
	.lastclose = sis_lastclose,
 | 
			
		||||
	.ioctls = sis_ioctls,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -55,7 +55,6 @@ static const struct file_operations tdfx_driver_fops = {
 | 
			
		|||
 | 
			
		||||
static struct drm_driver driver = {
 | 
			
		||||
	.driver_features = DRIVER_LEGACY,
 | 
			
		||||
	.set_busid = drm_pci_set_busid,
 | 
			
		||||
	.fops = &tdfx_driver_fops,
 | 
			
		||||
	.name = DRIVER_NAME,
 | 
			
		||||
	.desc = DRIVER_DESC,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -77,7 +77,6 @@ static struct drm_driver driver = {
 | 
			
		|||
	.open = via_driver_open,
 | 
			
		||||
	.preclose = via_reclaim_buffers_locked,
 | 
			
		||||
	.postclose = via_driver_postclose,
 | 
			
		||||
	.set_busid = drm_pci_set_busid,
 | 
			
		||||
	.context_dtor = via_final_context,
 | 
			
		||||
	.get_vblank_counter = via_get_vblank_counter,
 | 
			
		||||
	.enable_vblank = via_enable_vblank,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1531,7 +1531,6 @@ static struct drm_driver driver = {
 | 
			
		|||
	.master_drop = vmw_master_drop,
 | 
			
		||||
	.open = vmw_driver_open,
 | 
			
		||||
	.postclose = vmw_postclose,
 | 
			
		||||
	.set_busid = drm_pci_set_busid,
 | 
			
		||||
 | 
			
		||||
	.dumb_create = vmw_dumb_create,
 | 
			
		||||
	.dumb_map_offset = vmw_dumb_map_offset,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -172,8 +172,6 @@ struct drm_driver {
 | 
			
		|||
	 */
 | 
			
		||||
	void (*release) (struct drm_device *);
 | 
			
		||||
 | 
			
		||||
	int (*set_busid)(struct drm_device *dev, struct drm_master *master);
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @get_vblank_counter:
 | 
			
		||||
	 *
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,7 +49,6 @@ void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver);
 | 
			
		|||
int drm_get_pci_dev(struct pci_dev *pdev,
 | 
			
		||||
		    const struct pci_device_id *ent,
 | 
			
		||||
		    struct drm_driver *driver);
 | 
			
		||||
int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master);
 | 
			
		||||
#else
 | 
			
		||||
static inline int drm_get_pci_dev(struct pci_dev *pdev,
 | 
			
		||||
				  const struct pci_device_id *ent,
 | 
			
		||||
| 
						 | 
				
			
			@ -57,12 +56,6 @@ static inline int drm_get_pci_dev(struct pci_dev *pdev,
 | 
			
		|||
{
 | 
			
		||||
	return -ENOSYS;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline int drm_pci_set_busid(struct drm_device *dev,
 | 
			
		||||
				    struct drm_master *master)
 | 
			
		||||
{
 | 
			
		||||
	return -ENOSYS;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define DRM_PCIE_SPEED_25 1
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue