/* __scsi_put_command - Free a struct scsi_cmnd @shost: dev->host @cmd: Command to free @dev: parent scsi device  */
void __scsi_put_command(struct Scsi_Host *shost, struct scsi_cmnd *cmd, struct device *dev)
/* __scsi_put_command - Free a struct scsi_cmnd @shost: dev->host @cmd: Command to free @dev: parent scsi device  */
void __scsi_put_command(struct Scsi_Host *shost, struct scsi_cmnd *cmd, struct device *dev)
{
	unsigned long flags;
	spin_lock_irqsave(&shost->free_list_lock, flags);
	if (unlikely(list_empty(&shost->free_list))) {
		list_add(&cmd->list, &shost->free_list);
		cmd = NULL;
	}
	spin_unlock_irqrestore(&shost->free_list_lock, flags);
	if (likely(cmd != NULL))
		scsi_pool_free_command(shost->cmd_pool, cmd);
	put_device(dev);
}