introduce open_hw() function
probe_hw opens the hardware in the order we want it: first try devname, if this is NULL then try the KMSDEVICE environment variable and as a last fallback use "/dev/dri/card0". Instead of implementing the same code again when really opening the device move the code to a open_hw() function and let probe_hw use it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
		
							parent
							
								
									aa6ceaaa84
								
							
						
					
					
						commit
						456a001e3f
					
				| 
						 | 
				
			
			@ -174,7 +174,7 @@ Identify(int flags)
 | 
			
		|||
		      Chipsets);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static Bool probe_hw(char *dev)
 | 
			
		||||
static int open_hw(char *dev)
 | 
			
		||||
{
 | 
			
		||||
    int fd;
 | 
			
		||||
    if (dev)
 | 
			
		||||
| 
						 | 
				
			
			@ -186,13 +186,20 @@ static Bool probe_hw(char *dev)
 | 
			
		|||
	    fd = open(dev,O_RDWR, 0);
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
    if (fd == -1) {
 | 
			
		||||
    if (fd == -1)
 | 
			
		||||
	xf86DrvMsg(-1, X_ERROR,"open %s: %s\n", dev, strerror(errno));
 | 
			
		||||
	return FALSE;
 | 
			
		||||
    }
 | 
			
		||||
    close(fd);
 | 
			
		||||
    return TRUE;
 | 
			
		||||
 | 
			
		||||
    return fd;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static Bool probe_hw(char *dev)
 | 
			
		||||
{
 | 
			
		||||
    int fd = open_hw(dev);
 | 
			
		||||
    if (fd != -1) {
 | 
			
		||||
        close(fd);
 | 
			
		||||
	return TRUE;
 | 
			
		||||
    }
 | 
			
		||||
    return FALSE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const OptionInfoRec *
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue