/* RETURNS: Command allocated, or NULL if none available.  */
static struct ata_queued_cmd* ata_scsi_qc_new(struct ata_device *dev, struct scsi_cmnd *cmd, void(*done)(struct scsi_cmnd *))
/* RETURNS: Command allocated, or NULL if none available.  */
static struct ata_queued_cmd* ata_scsi_qc_new(struct ata_device *dev, struct scsi_cmnd *cmd, void(*done)(struct scsi_cmnd *))
{
	struct ata_queued_cmd *qc;
	qc = ata_qc_new_init(dev);
	if (qc) {
		qc->scsicmd = cmd;
		qc->scsidone = done;
		qc->sg = scsi_sglist(cmd);
		qc->n_elem = scsi_sg_count(cmd);
	} else {
		cmd->result = (DID_OK << 16) | (QUEUE_FULL << 1);
		done(cmd);
	}
	return qc;
}