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

Commit 03a2faae authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz
Browse files

ide: return request status from ->pc_callback method



Make ->pc_callback method return request status and then move
the request completion from ->pc_callback to ide_pc_intr().

There should be no functional changes caused by this patch.

Acked-by: default avatarBorislav Petkov <petkovbb@gmail.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 3ee38302
Loading
Loading
Loading
Loading
+11 −1
Original line number Original line Diff line number Diff line
@@ -357,6 +357,8 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)


	/* No more interrupts */
	/* No more interrupts */
	if ((stat & ATA_DRQ) == 0) {
	if ((stat & ATA_DRQ) == 0) {
		int uptodate;

		debug_log("Packet command completed, %d bytes transferred\n",
		debug_log("Packet command completed, %d bytes transferred\n",
			  pc->xferred);
			  pc->xferred);


@@ -395,7 +397,15 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
			dsc = 1;
			dsc = 1;


		/* Command finished - Call the callback function */
		/* Command finished - Call the callback function */
		drive->pc_callback(drive, dsc);
		uptodate = drive->pc_callback(drive, dsc);

		if (uptodate == 0)
			drive->failed_pc = NULL;

		if (blk_special_request(rq))
			ide_complete_rq(drive, 0);
		else
			ide_end_request(drive, uptodate, 0);


		return ide_stopped;
		return ide_stopped;
	}
	}
+4 −8
Original line number Original line Diff line number Diff line
@@ -71,7 +71,7 @@ static void idefloppy_update_buffers(ide_drive_t *drive,
		ide_end_request(drive, 1, 0);
		ide_end_request(drive, 1, 0);
}
}


static void ide_floppy_callback(ide_drive_t *drive, int dsc)
static int ide_floppy_callback(ide_drive_t *drive, int dsc)
{
{
	struct ide_disk_obj *floppy = drive->driver_data;
	struct ide_disk_obj *floppy = drive->driver_data;
	struct ide_atapi_pc *pc = drive->pc;
	struct ide_atapi_pc *pc = drive->pc;
@@ -108,14 +108,10 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc)
			       "Aborting request!\n");
			       "Aborting request!\n");
	}
	}


	if (uptodate == 0)
	if (blk_special_request(rq))
		drive->failed_pc = NULL;

	if (blk_special_request(rq)) {
		rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL;
		rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL;
		ide_complete_rq(drive, 0);

	} else
	return uptodate;
		ide_end_request(drive, uptodate, 0);
}
}


static void ide_floppy_report_error(struct ide_disk_obj *floppy,
static void ide_floppy_report_error(struct ide_disk_obj *floppy,
+2 −8
Original line number Original line Diff line number Diff line
@@ -463,7 +463,7 @@ static void ide_tape_kfree_buffer(idetape_tape_t *tape)


static void ide_tape_handle_dsc(ide_drive_t *);
static void ide_tape_handle_dsc(ide_drive_t *);


static void ide_tape_callback(ide_drive_t *drive, int dsc)
static int ide_tape_callback(ide_drive_t *drive, int dsc)
{
{
	idetape_tape_t *tape = drive->driver_data;
	idetape_tape_t *tape = drive->driver_data;
	struct ide_atapi_pc *pc = drive->pc;
	struct ide_atapi_pc *pc = drive->pc;
@@ -530,13 +530,7 @@ static void ide_tape_callback(ide_drive_t *drive, int dsc)


	rq->errors = err;
	rq->errors = err;


	if (uptodate == 0)
	return uptodate;
		drive->failed_pc = NULL;

	if (blk_special_request(rq))
		ide_complete_rq(drive, 0);
	else
		ide_end_request(drive, uptodate, 0);
}
}


/*
/*
+1 −1
Original line number Original line Diff line number Diff line
@@ -619,7 +619,7 @@ struct ide_drive_s {
	struct ide_atapi_pc *failed_pc;
	struct ide_atapi_pc *failed_pc;


	/* callback for packet commands */
	/* callback for packet commands */
	void (*pc_callback)(struct ide_drive_s *, int);
	int  (*pc_callback)(struct ide_drive_s *, int);


	void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *);
	void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *);
	int  (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *,
	int  (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *,