mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	bochs: convert to drm_dev_register
The drm_get_pci_dev API is deprecated, replace it by drm_dev_register. Signed-off-by: Peter Wu <peter@lekensteyn.nl> Link: http://patchwork.freedesktop.org/patch/msgid/20180906221810.20170-4-peter@lekensteyn.nl Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
		
							parent
							
								
									df2052cc92
								
							
						
					
					
						commit
						7780eb9ce8
					
				
					 3 changed files with 30 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -117,7 +117,7 @@ static inline u64 bochs_bo_mmap_offset(struct bochs_bo *bo)
 | 
			
		|||
/* ---------------------------------------------------------------------- */
 | 
			
		||||
 | 
			
		||||
/* bochs_hw.c */
 | 
			
		||||
int bochs_hw_init(struct drm_device *dev, uint32_t flags);
 | 
			
		||||
int bochs_hw_init(struct drm_device *dev);
 | 
			
		||||
void bochs_hw_fini(struct drm_device *dev);
 | 
			
		||||
 | 
			
		||||
void bochs_hw_setmode(struct bochs_device *bochs,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -35,7 +35,7 @@ static void bochs_unload(struct drm_device *dev)
 | 
			
		|||
	dev->dev_private = NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int bochs_load(struct drm_device *dev, unsigned long flags)
 | 
			
		||||
static int bochs_load(struct drm_device *dev)
 | 
			
		||||
{
 | 
			
		||||
	struct bochs_device *bochs;
 | 
			
		||||
	int ret;
 | 
			
		||||
| 
						 | 
				
			
			@ -46,7 +46,7 @@ static int bochs_load(struct drm_device *dev, unsigned long flags)
 | 
			
		|||
	dev->dev_private = bochs;
 | 
			
		||||
	bochs->dev = dev;
 | 
			
		||||
 | 
			
		||||
	ret = bochs_hw_init(dev, flags);
 | 
			
		||||
	ret = bochs_hw_init(dev);
 | 
			
		||||
	if (ret)
 | 
			
		||||
		goto err;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -82,8 +82,6 @@ static const struct file_operations bochs_fops = {
 | 
			
		|||
 | 
			
		||||
static struct drm_driver bochs_driver = {
 | 
			
		||||
	.driver_features	= DRIVER_GEM | DRIVER_MODESET,
 | 
			
		||||
	.load			= bochs_load,
 | 
			
		||||
	.unload			= bochs_unload,
 | 
			
		||||
	.fops			= &bochs_fops,
 | 
			
		||||
	.name			= "bochs-drm",
 | 
			
		||||
	.desc			= "bochs dispi vga interface (qemu stdvga)",
 | 
			
		||||
| 
						 | 
				
			
			@ -138,6 +136,7 @@ static const struct dev_pm_ops bochs_pm_ops = {
 | 
			
		|||
static int bochs_pci_probe(struct pci_dev *pdev,
 | 
			
		||||
			   const struct pci_device_id *ent)
 | 
			
		||||
{
 | 
			
		||||
	struct drm_device *dev;
 | 
			
		||||
	unsigned long fbsize;
 | 
			
		||||
	int ret;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -151,14 +150,37 @@ static int bochs_pci_probe(struct pci_dev *pdev,
 | 
			
		|||
	if (ret)
 | 
			
		||||
		return ret;
 | 
			
		||||
 | 
			
		||||
	return drm_get_pci_dev(pdev, ent, &bochs_driver);
 | 
			
		||||
	dev = drm_dev_alloc(&bochs_driver, &pdev->dev);
 | 
			
		||||
	if (IS_ERR(dev))
 | 
			
		||||
		return PTR_ERR(dev);
 | 
			
		||||
 | 
			
		||||
	dev->pdev = pdev;
 | 
			
		||||
	pci_set_drvdata(pdev, dev);
 | 
			
		||||
 | 
			
		||||
	ret = bochs_load(dev);
 | 
			
		||||
	if (ret)
 | 
			
		||||
		goto err_free_dev;
 | 
			
		||||
 | 
			
		||||
	ret = drm_dev_register(dev, 0);
 | 
			
		||||
	if (ret)
 | 
			
		||||
		goto err_unload;
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
 | 
			
		||||
err_unload:
 | 
			
		||||
	bochs_unload(dev);
 | 
			
		||||
err_free_dev:
 | 
			
		||||
	drm_dev_put(dev);
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void bochs_pci_remove(struct pci_dev *pdev)
 | 
			
		||||
{
 | 
			
		||||
	struct drm_device *dev = pci_get_drvdata(pdev);
 | 
			
		||||
 | 
			
		||||
	drm_put_dev(dev);
 | 
			
		||||
	drm_dev_unregister(dev);
 | 
			
		||||
	bochs_unload(dev);
 | 
			
		||||
	drm_dev_put(dev);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct pci_device_id bochs_pci_tbl[] = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -47,7 +47,7 @@ static void bochs_dispi_write(struct bochs_device *bochs, u16 reg, u16 val)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int bochs_hw_init(struct drm_device *dev, uint32_t flags)
 | 
			
		||||
int bochs_hw_init(struct drm_device *dev)
 | 
			
		||||
{
 | 
			
		||||
	struct bochs_device *bochs = dev->dev_private;
 | 
			
		||||
	struct pci_dev *pdev = dev->pdev;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue