/* Unblocks lu->tgt as soon as all its logical units can be unblocked. Note, it is harmless to run scsi_unblock_requests() outside the card->lock protected section. On the other hand, running it inside the section might clash with shost->host_lock.  */
static void sbp2_conditionally_unblock(struct sbp2_logical_unit *lu)
/* Unblocks lu->tgt as soon as all its logical units can be unblocked. Note, it is harmless to run scsi_unblock_requests() outside the card->lock protected section. On the other hand, running it inside the section might clash with shost->host_lock.  */
static void sbp2_conditionally_unblock(struct sbp2_logical_unit *lu)
{
	struct sbp2_target *tgt = lu->tgt;
	struct fw_card *card = target_device(tgt)->card;
	struct Scsi_Host *shost =
		container_of((void *)tgt, struct Scsi_Host, hostdata[0]);
	unsigned long flags;
	bool unblock = false;
	spin_lock_irqsave(&card->lock, flags);
	if (lu->blocked && lu->generation == card->generation) {
		lu->blocked = false;
		unblock = --tgt->blocked == 0;
	}
	spin_unlock_irqrestore(&card->lock, flags);
	if (unblock)
		scsi_unblock_requests(shost);
}