|  | @@ -68,18 +68,16 @@ static struct efi_device * efidev_find ( EFI_HANDLE device ) {
 | 
		
	
		
			
			| 68 | 68 |   * @ret efidev		Parent EFI device, or NULL
 | 
		
	
		
			
			| 69 | 69 |   */
 | 
		
	
		
			
			| 70 | 70 |  struct efi_device * efidev_parent ( struct device *dev ) {
 | 
		
	
		
			
			| 71 |  | -	struct device *parent = dev->parent;
 | 
		
	
		
			
			| 72 |  | -	struct efi_device *efidev;
 | 
		
	
		
			
			|  | 71 | +	struct device *parent;
 | 
		
	
		
			
			| 73 | 72 |  
 | 
		
	
		
			
			| 74 |  | -	/* Check that parent exists and is an EFI device */
 | 
		
	
		
			
			| 75 |  | -	if ( ! parent )
 | 
		
	
		
			
			| 76 |  | -		return NULL;
 | 
		
	
		
			
			| 77 |  | -	if ( parent->desc.bus_type != BUS_TYPE_EFI )
 | 
		
	
		
			
			| 78 |  | -		return NULL;
 | 
		
	
		
			
			|  | 73 | +	/* Walk upwards until we find an EFI device */
 | 
		
	
		
			
			|  | 74 | +	while ( ( parent = dev->parent ) ) {
 | 
		
	
		
			
			|  | 75 | +		if ( parent->desc.bus_type == BUS_TYPE_EFI )
 | 
		
	
		
			
			|  | 76 | +			return container_of ( parent, struct efi_device, dev );
 | 
		
	
		
			
			|  | 77 | +		dev = parent;
 | 
		
	
		
			
			|  | 78 | +	}
 | 
		
	
		
			
			| 79 | 79 |  
 | 
		
	
		
			
			| 80 |  | -	/* Get containing EFI device */
 | 
		
	
		
			
			| 81 |  | -	efidev = container_of ( parent, struct efi_device, dev );
 | 
		
	
		
			
			| 82 |  | -	return efidev;
 | 
		
	
		
			
			|  | 80 | +	return NULL;
 | 
		
	
		
			
			| 83 | 81 |  }
 | 
		
	
		
			
			| 84 | 82 |  
 | 
		
	
		
			
			| 85 | 83 |  /**
 |