/* Move the device towards the head of the device list. Need to be called while holding the zcrypt device list lock. Note: cards with speed_rating of 0 are kept at the end of the list.  */
static void __zcrypt_increase_preference(struct zcrypt_device *zdev)
/* Move the device towards the head of the device list. Need to be called while holding the zcrypt device list lock. Note: cards with speed_rating of 0 are kept at the end of the list.  */
static void __zcrypt_increase_preference(struct zcrypt_device *zdev)
{
	struct zcrypt_device *tmp;
	struct list_head *l;
	if (zdev->speed_rating == 0)
		return;
	for (l = zdev->list.prev; l != &zcrypt_device_list; l = l->prev) {
		tmp = list_entry(l, struct zcrypt_device, list);
		if ((tmp->request_count + 1) * tmp->speed_rating <=
		    (zdev->request_count + 1) * zdev->speed_rating &&
		    tmp->speed_rating != 0)
			break;
	}
	if (l == zdev->list.prev)
		return;
	list_move(&zdev->list, l);
}