Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 79f97dad authored by Tejun Heo's avatar Tejun Heo Committed by Jeff Garzik
Browse files

libata: drop @finish_qc from ata_qc_complete_multiple()



ata_qc_complete_multiple() took @finish_qc and called it on every qc
before completing it.  This was to give opportunity to update TF cache
before ata_qc_complete() tries to fill result_tf.  Now that result TF
is a separate operation, this is no longer necessary.

Update sata_sil24, which was the only user of this mechanism, such
that it implements its own ops->qc_fill_rtf() and drop @finish_qc from
ata_qc_complete_multiple().

Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
parent 22183bf5
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1696,7 +1696,7 @@ static void ahci_port_intr(struct ata_port *ap)
	else
	else
		qc_active = readl(port_mmio + PORT_CMD_ISSUE);
		qc_active = readl(port_mmio + PORT_CMD_ISSUE);


	rc = ata_qc_complete_multiple(ap, qc_active, NULL);
	rc = ata_qc_complete_multiple(ap, qc_active);


	/* while resetting, invalid completions are expected */
	/* while resetting, invalid completions are expected */
	if (unlikely(rc < 0 && !resetting)) {
	if (unlikely(rc < 0 && !resetting)) {
+1 −5
Original line number Original line Diff line number Diff line
@@ -4673,7 +4673,6 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
 *	ata_qc_complete_multiple - Complete multiple qcs successfully
 *	ata_qc_complete_multiple - Complete multiple qcs successfully
 *	@ap: port in question
 *	@ap: port in question
 *	@qc_active: new qc_active mask
 *	@qc_active: new qc_active mask
 *	@finish_qc: LLDD callback invoked before completing a qc
 *
 *
 *	Complete in-flight commands.  This functions is meant to be
 *	Complete in-flight commands.  This functions is meant to be
 *	called from low-level driver's interrupt routine to complete
 *	called from low-level driver's interrupt routine to complete
@@ -4686,8 +4685,7 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
 *	RETURNS:
 *	RETURNS:
 *	Number of completed commands on success, -errno otherwise.
 *	Number of completed commands on success, -errno otherwise.
 */
 */
int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active,
int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active)
			     void (*finish_qc)(struct ata_queued_cmd *))
{
{
	int nr_done = 0;
	int nr_done = 0;
	u32 done_mask;
	u32 done_mask;
@@ -4708,8 +4706,6 @@ int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active,
			continue;
			continue;


		if ((qc = ata_qc_from_tag(ap, i))) {
		if ((qc = ata_qc_from_tag(ap, i))) {
			if (finish_qc)
				finish_qc(qc);
			ata_qc_complete(qc);
			ata_qc_complete(qc);
			nr_done++;
			nr_done++;
		}
		}
+9 −10
Original line number Original line Diff line number Diff line
@@ -348,6 +348,7 @@ static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
static int sil24_qc_defer(struct ata_queued_cmd *qc);
static int sil24_qc_defer(struct ata_queued_cmd *qc);
static void sil24_qc_prep(struct ata_queued_cmd *qc);
static void sil24_qc_prep(struct ata_queued_cmd *qc);
static unsigned int sil24_qc_issue(struct ata_queued_cmd *qc);
static unsigned int sil24_qc_issue(struct ata_queued_cmd *qc);
static bool sil24_qc_fill_rtf(struct ata_queued_cmd *qc);
static void sil24_pmp_attach(struct ata_port *ap);
static void sil24_pmp_attach(struct ata_port *ap);
static void sil24_pmp_detach(struct ata_port *ap);
static void sil24_pmp_detach(struct ata_port *ap);
static void sil24_freeze(struct ata_port *ap);
static void sil24_freeze(struct ata_port *ap);
@@ -407,6 +408,7 @@ static struct ata_port_operations sil24_ops = {
	.qc_defer		= sil24_qc_defer,
	.qc_defer		= sil24_qc_defer,
	.qc_prep		= sil24_qc_prep,
	.qc_prep		= sil24_qc_prep,
	.qc_issue		= sil24_qc_issue,
	.qc_issue		= sil24_qc_issue,
	.qc_fill_rtf		= sil24_qc_fill_rtf,


	.freeze			= sil24_freeze,
	.freeze			= sil24_freeze,
	.thaw			= sil24_thaw,
	.thaw			= sil24_thaw,
@@ -914,6 +916,12 @@ static unsigned int sil24_qc_issue(struct ata_queued_cmd *qc)
	return 0;
	return 0;
}
}


static bool sil24_qc_fill_rtf(struct ata_queued_cmd *qc)
{
	sil24_read_tf(qc->ap, qc->tag, &qc->result_tf);
	return true;
}

static void sil24_pmp_attach(struct ata_port *ap)
static void sil24_pmp_attach(struct ata_port *ap)
{
{
	sil24_config_pmp(ap, 1);
	sil24_config_pmp(ap, 1);
@@ -1098,15 +1106,6 @@ static void sil24_error_intr(struct ata_port *ap)
	}
	}
}
}


static void sil24_finish_qc(struct ata_queued_cmd *qc)
{
	struct ata_port *ap = qc->ap;
	struct sil24_port_priv *pp = ap->private_data;

	if (qc->flags & ATA_QCFLAG_RESULT_TF)
		sil24_read_tf(ap, qc->tag, &pp->tf);
}

static inline void sil24_host_intr(struct ata_port *ap)
static inline void sil24_host_intr(struct ata_port *ap)
{
{
	void __iomem *port = ap->ioaddr.cmd_addr;
	void __iomem *port = ap->ioaddr.cmd_addr;
@@ -1131,7 +1130,7 @@ static inline void sil24_host_intr(struct ata_port *ap)
	}
	}


	qc_active = slot_stat & ~HOST_SSTAT_ATTN;
	qc_active = slot_stat & ~HOST_SSTAT_ATTN;
	rc = ata_qc_complete_multiple(ap, qc_active, sil24_finish_qc);
	rc = ata_qc_complete_multiple(ap, qc_active);
	if (rc > 0)
	if (rc > 0)
		return;
		return;
	if (rc < 0) {
	if (rc < 0) {
+1 −2
Original line number Original line Diff line number Diff line
@@ -924,8 +924,7 @@ extern void ata_id_string(const u16 *id, unsigned char *s,
extern void ata_id_c_string(const u16 *id, unsigned char *s,
extern void ata_id_c_string(const u16 *id, unsigned char *s,
			    unsigned int ofs, unsigned int len);
			    unsigned int ofs, unsigned int len);
extern void ata_qc_complete(struct ata_queued_cmd *qc);
extern void ata_qc_complete(struct ata_queued_cmd *qc);
extern int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active,
extern int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active);
				    void (*finish_qc)(struct ata_queued_cmd *));
extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd,
extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd,
			      void (*done)(struct scsi_cmnd *));
			      void (*done)(struct scsi_cmnd *));
extern int ata_std_bios_param(struct scsi_device *sdev,
extern int ata_std_bios_param(struct scsi_device *sdev,