From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bartlomiej Zolnierkiewicz Subject: [PATCH 47/63] ide-cd: factor out request sense fixup from cdrom_pc_intr() Date: Thu, 20 Dec 2007 02:28:27 +0100 Message-ID: <200712200228.27682.bzolnier@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Return-path: Received: from ug-out-1314.google.com ([66.249.92.173]:11733 "EHLO ug-out-1314.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757408AbXLTBew (ORCPT ); Wed, 19 Dec 2007 20:34:52 -0500 Received: by ug-out-1314.google.com with SMTP id z38so389248ugc.16 for ; Wed, 19 Dec 2007 17:34:51 -0800 (PST) Content-Disposition: inline Sender: linux-ide-owner@vger.kernel.org List-Id: linux-ide@vger.kernel.org To: linux-ide@vger.kernel.org Cc: linux-kernel@vger.kernel.org This is a preparation for cdrom_pc_intr() and cdrom_newpc_intr() merge. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) Index: b/drivers/ide/ide-cd.c =================================================================== --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -1047,6 +1047,20 @@ static ide_startstop_t cdrom_start_read * Execute all other packet commands. */ +static void ide_cd_request_sense_fixup(struct request *rq) +{ + /* + * Some of the trailing request sense fields are optional, + * and some drives don't send them. Sigh. + */ + if (rq->cmd[0] == GPCMD_REQUEST_SENSE && + rq->data_len > 0 && rq->data_len <= 5) + while (rq->data_len > 0) { + *(u8 *)rq->data++ = 0; + --rq->data_len; + } +} + /* Interrupt routine for packet command completion. */ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive) { @@ -1069,16 +1083,7 @@ static ide_startstop_t cdrom_pc_intr (id /* If DRQ is clear, the command has completed. Complain if we still have data left to transfer. */ if ((stat & DRQ_STAT) == 0) { - /* Some of the trailing request sense fields are optional, and - some drives don't send them. Sigh. */ - if (rq->cmd[0] == GPCMD_REQUEST_SENSE && - rq->data_len > 0 && - rq->data_len <= 5) { - while (rq->data_len > 0) { - *(unsigned char *)rq->data++ = 0; - --rq->data_len; - } - } + ide_cd_request_sense_fixup(rq); if (rq->data_len == 0) cdrom_end_request(drive, 1);