diff for duplicates of <200812212015.39677.bzolnier@gmail.com> diff --git a/a/1.txt b/N1/1.txt index c191a5d..d007a02 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -1,377 +1,7 @@ -On Thursday 18 December 2008, Borislav Petkov wrote: -> Remove cdrom_do_newpc_cont and cdrom_start_rw_cont wrappers and pass -> cdrom_transfer_packet_command to ide_execute_command directly. -> -> There should be no functionality change resulting from this patch. -> -> Signed-off-by: Borislav Petkov <petkovbb@gmail.com> -> --- -> drivers/ide/ide-cd.c | 121 ++++++++++++++++++++------------------------------ -> 1 files changed, 48 insertions(+), 73 deletions(-) -> -> diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c -> index 34981f5..f3c7cc3 100644 -> --- a/drivers/ide/ide-cd.c -> +++ b/drivers/ide/ide-cd.c -> @@ -511,48 +511,7 @@ end_request: -> return 1; -> } -> -> -/* -> - * Set up the device registers for transferring a packet command on DEV, -> - * expecting to later transfer XFERLEN bytes. HANDLER is the routine -> - * which actually transfers the command to the drive. If this is a -> - * drq_interrupt device, this routine will arrange for HANDLER to be -> - * called when the interrupt from the drive arrives. Otherwise, HANDLER -> - * will be called immediately after the drive is prepared for the transfer. -> - */ -> -static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive, -> - ide_handler_t *handler) -> -{ -> - ide_hwif_t *hwif = drive->hwif; -> - struct request *rq = hwif->hwgroup->rq; -> - int xferlen; -> - -> - xferlen = ide_cd_get_xferlen(rq); -> - -> - ide_debug_log(IDE_DBG_PC, "Call %s, xferlen: %d\n", __func__, xferlen); -> - -> - /* FIXME: for Virtual DMA we must check harder */ -> - if (drive->dma) -> - drive->dma = !hwif->dma_ops->dma_setup(drive); -> - -> - /* set up the controller registers */ -> - ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL, -> - xferlen, drive->dma); -> - -> - if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) { -> - /* waiting for CDB interrupt, not DMA yet. */ -> - if (drive->dma) -> - drive->waiting_for_dma = 0; -> - -> - /* packet command */ -> - ide_execute_command(drive, ATA_CMD_PACKET, handler, -> - ATAPI_WAIT_PC, ide_cd_expiry); -> - return ide_started; -> - } else { -> - ide_execute_pkt_cmd(drive); -> - -> - return (*handler) (drive); -> - } -> -} -> +static ide_startstop_t cdrom_newpc_intr(ide_drive_t *); -> -> /* -> * Send a packet command to DRIVE described by CMD_BUF and CMD_LEN. The device -> @@ -561,11 +520,10 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive, -> * there's data ready. -> */ -> #define ATAPI_MIN_CDB_BYTES 12 -> -static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive, -> - struct request *rq, -> - ide_handler_t *handler) -> +static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive) -> { -> ide_hwif_t *hwif = drive->hwif; -> + struct request *rq = hwif->hwgroup->rq; -> int cmd_len; -> ide_startstop_t startstop; -> -> @@ -592,7 +550,7 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive, -> } -> -> /* arm the interrupt handler */ -> - ide_set_handler(drive, handler, rq->timeout, ide_cd_expiry); -> + ide_set_handler(drive, cdrom_newpc_intr, rq->timeout, ide_cd_expiry); -> -> /* ATAPI commands get padded out to 12 bytes minimum */ -> cmd_len = COMMAND_SIZE(rq->cmd[0]); -> @@ -610,6 +568,49 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive, -> } -> -> /* -> + * Set up the device registers for transferring a packet command on DEV, -> + * expecting to later transfer XFERLEN bytes. HANDLER is the routine -> + * which actually transfers the command to the drive. If this is a -> + * drq_interrupt device, this routine will arrange for HANDLER to be -> + * called when the interrupt from the drive arrives. Otherwise, HANDLER -> + * will be called immediately after the drive is prepared for the transfer. -> + */ -> +static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive) -> +{ -> + ide_hwif_t *hwif = drive->hwif; -> + struct request *rq = hwif->hwgroup->rq; -> + int xferlen; -> + -> + xferlen = ide_cd_get_xferlen(rq); -> + -> + ide_debug_log(IDE_DBG_PC, "Call %s, xferlen: %d\n", __func__, xferlen); -> + -> + /* FIXME: for Virtual DMA we must check harder */ -> + if (drive->dma) -> + drive->dma = !hwif->dma_ops->dma_setup(drive); -> + -> + /* set up the controller registers */ -> + ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL, -> + xferlen, drive->dma); -> + -> + if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) { -> + /* waiting for CDB interrupt, not DMA yet. */ -> + if (drive->dma) -> + drive->waiting_for_dma = 0; -> + -> + /* packet command */ -> + ide_execute_command(drive, ATA_CMD_PACKET, -> + cdrom_transfer_packet_command, -> + ATAPI_WAIT_PC, ide_cd_expiry); -> + return ide_started; -> + } else { -> + ide_execute_pkt_cmd(drive); -> + -> + return cdrom_transfer_packet_command(drive); -> + } -> +} -> + -> +/* -> * Check the contents of the interrupt reason register from the cdrom -> * and attempt to recover if there are problems. Returns 0 if everything's -> * ok; nonzero if the request has been terminated. -> @@ -680,8 +681,6 @@ static int ide_cd_check_transfer_size(ide_drive_t *drive, int len) -> return 1; -> } -> -> -static ide_startstop_t cdrom_newpc_intr(ide_drive_t *); -> - -> static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive, -> struct request *rq) -> { -> @@ -724,20 +723,6 @@ static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive, -> } -> -> /* -> - * Routine to send a read/write packet command to the drive. This is usually -> - * called directly from cdrom_start_{read,write}(). However, for drq_interrupt -> - * devices, it is called from an interrupt when the drive is ready to accept -> - * the command. -> - */ -> -static ide_startstop_t cdrom_start_rw_cont(ide_drive_t *drive) -> -{ -> - struct request *rq = drive->hwif->hwgroup->rq; -> - -> - /* send the command to the drive and return */ -> - return cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr); -> -} -> - -> -/* -> * Fix up a possibly partially-processed request so that we can start it over -> * entirely, or even put it back on the request queue. -> */ -> @@ -1126,13 +1111,6 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq) -> return ide_started; -> } -> -> -static ide_startstop_t cdrom_do_newpc_cont(ide_drive_t *drive) -> -{ -> - struct request *rq = HWGROUP(drive)->rq; -> - -> - return cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr); -> -} -> - -> static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) -> { -> -> @@ -1177,7 +1155,6 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) -> static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, -> sector_t block) -> { -> - ide_handler_t *fn; -> -> ide_debug_log(IDE_DBG_RQ, "Call %s, rq->cmd[0]: 0x%x, " -> "rq->cmd_type: 0x%x, block: %llu\n", -> @@ -1185,7 +1162,6 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, -> (unsigned long long)block); -> -> if (blk_fs_request(rq)) { -> - fn = cdrom_start_rw_cont; -> -> if (cdrom_start_rw(drive, rq) == ide_stopped) -> return ide_stopped; -> @@ -1194,7 +1170,6 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, -> return ide_stopped; -> } else if (blk_sense_request(rq) || blk_pc_request(rq) || -> rq->cmd_type == REQ_TYPE_ATA_PC) { -> - fn = cdrom_do_newpc_cont; -> -> if (!rq->timeout) -> rq->timeout = ATAPI_WAIT_PC; -> @@ -1210,7 +1185,7 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, -> return ide_stopped; -> } -> -> - return cdrom_start_packet_command(drive, fn); -> + return cdrom_start_packet_command(drive); -> } - -There is no need to move cdrom_start_packet_command() around (especially -since it goes away in patch #9/8) and not doing so allows to see changes -to the function immediately. Fixed in the merged patch version: - -From: Borislav Petkov <petkovbb@googlemail.com> -Subject: [PATCH 5/8] ide-cd: remove handler wrappers - -Remove cdrom_do_newpc_cont and cdrom_start_rw_cont wrappers and pass -cdrom_transfer_packet_command to ide_execute_command directly. - +On Thursday 18 December 2008, Borislav Petkov wrote:> Remove cdrom_do_newpc_cont and cdrom_start_rw_cont wrappers and pass> cdrom_transfer_packet_command to ide_execute_command directly.> > There should be no functionality change resulting from this patch.> > Signed-off-by: Borislav Petkov <petkovbb@gmail.com>> ---> drivers/ide/ide-cd.c | 121 ++++++++++++++++++++------------------------------> 1 files changed, 48 insertions(+), 73 deletions(-)> > diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c> index 34981f5..f3c7cc3 100644> --- a/drivers/ide/ide-cd.c> +++ b/drivers/ide/ide-cd.c> @@ -511,48 +511,7 @@ end_request:> return 1;> }> > -/*> - * Set up the device registers for transferring a packet command on DEV,> - * expecting to later transfer XFERLEN bytes. HANDLER is the routine> - * which actually transfers the command to the drive. If this is a> - * drq_interrupt device, this routine will arrange for HANDLER to be> - * called when the interrupt from the drive arrives. Otherwise, HANDLER> - * will be called immediately after the drive is prepared for the transfer.> - */> -static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,> - ide_handler_t *handler)> -{> - ide_hwif_t *hwif = drive->hwif;> - struct request *rq = hwif->hwgroup->rq;> - int xferlen;> -> - xferlen = ide_cd_get_xferlen(rq);> -> - ide_debug_log(IDE_DBG_PC, "Call %s, xferlen: %d\n", __func__, xferlen);> -> - /* FIXME: for Virtual DMA we must check harder */> - if (drive->dma)> - drive->dma = !hwif->dma_ops->dma_setup(drive);> -> - /* set up the controller registers */> - ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL,> - xferlen, drive->dma);> -> - if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) {> - /* waiting for CDB interrupt, not DMA yet. */> - if (drive->dma)> - drive->waiting_for_dma = 0;> -> - /* packet command */> - ide_execute_command(drive, ATA_CMD_PACKET, handler,> - ATAPI_WAIT_PC, ide_cd_expiry);> - return ide_started;> - } else {> - ide_execute_pkt_cmd(drive);> -> - return (*handler) (drive);> - }> -}> +static ide_startstop_t cdrom_newpc_intr(ide_drive_t *);> > /*> * Send a packet command to DRIVE described by CMD_BUF and CMD_LEN. The device> @@ -561,11 +520,10 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,> * there's data ready.> */> #define ATAPI_MIN_CDB_BYTES 12> -static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,> - struct request *rq,> - ide_handler_t *handler)> +static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive)> {> ide_hwif_t *hwif = drive->hwif;> + struct request *rq = hwif->hwgroup->rq;> int cmd_len;> ide_startstop_t startstop;> > @@ -592,7 +550,7 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,> }> > /* arm the interrupt handler */> - ide_set_handler(drive, handler, rq->timeout, ide_cd_expiry);> + ide_set_handler(drive, cdrom_newpc_intr, rq->timeout, ide_cd_expiry);> > /* ATAPI commands get padded out to 12 bytes minimum */> cmd_len = COMMAND_SIZE(rq->cmd[0]);> @@ -610,6 +568,49 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,> }> > /*> + * Set up the device registers for transferring a packet command on DEV,> + * expecting to later transfer XFERLEN bytes. HANDLER is the routine> + * which actually transfers the command to the drive. If this is a> + * drq_interrupt device, this routine will arrange for HANDLER to be> + * called when the interrupt from the drive arrives. Otherwise, HANDLER> + * will be called immediately after the drive is prepared for the transfer.> + */> +static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive)> +{> + ide_hwif_t *hwif = drive->hwif;> + struct request *rq = hwif->hwgroup->rq;> + int xferlen;> +> + xferlen = ide_cd_get_xferlen(rq);> +> + ide_debug_log(IDE_DBG_PC, "Call %s, xferlen: %d\n", __func__, xferlen);> +> + /* FIXME: for Virtual DMA we must check harder */> + if (drive->dma)> + drive->dma = !hwif->dma_ops->dma_setup(drive);> +> + /* set up the controller registers */> + ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL,> + xferlen, drive->dma);> +> + if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) {> + /* waiting for CDB interrupt, not DMA yet. */> + if (drive->dma)> + drive->waiting_for_dma = 0;> +> + /* packet command */> + ide_execute_command(drive, ATA_CMD_PACKET,> + cdrom_transfer_packet_command,> + ATAPI_WAIT_PC, ide_cd_expiry);> + return ide_started;> + } else {> + ide_execute_pkt_cmd(drive);> +> + return cdrom_transfer_packet_command(drive);> + }> +}> +> +/*> * Check the contents of the interrupt reason register from the cdrom> * and attempt to recover if there are problems. Returns 0 if everything's> * ok; nonzero if the request has been terminated.> @@ -680,8 +681,6 @@ static int ide_cd_check_transfer_size(ide_drive_t *drive, int len)> return 1;> }> > -static ide_startstop_t cdrom_newpc_intr(ide_drive_t *);> -> static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive,> struct request *rq)> {> @@ -724,20 +723,6 @@ static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive,> }> > /*> - * Routine to send a read/write packet command to the drive. This is usually> - * called directly from cdrom_start_{read,write}(). However, for drq_interrupt> - * devices, it is called from an interrupt when the drive is ready to accept> - * the command.> - */> -static ide_startstop_t cdrom_start_rw_cont(ide_drive_t *drive)> -{> - struct request *rq = drive->hwif->hwgroup->rq;> -> - /* send the command to the drive and return */> - return cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr);> -}> -> -/*> * Fix up a possibly partially-processed request so that we can start it over> * entirely, or even put it back on the request queue.> */> @@ -1126,13 +1111,6 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq)> return ide_started;> }> > -static ide_startstop_t cdrom_do_newpc_cont(ide_drive_t *drive)> -{> - struct request *rq = HWGROUP(drive)->rq;> -> - return cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr);> -}> -> static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)> {> > @@ -1177,7 +1155,6 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)> static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,> sector_t block)> {> - ide_handler_t *fn;> > ide_debug_log(IDE_DBG_RQ, "Call %s, rq->cmd[0]: 0x%x, "> "rq->cmd_type: 0x%x, block: %llu\n",> @@ -1185,7 +1162,6 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,> (unsigned long long)block);> > if (blk_fs_request(rq)) {> - fn = cdrom_start_rw_cont;> > if (cdrom_start_rw(drive, rq) == ide_stopped)> return ide_stopped;> @@ -1194,7 +1170,6 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,> return ide_stopped;> } else if (blk_sense_request(rq) || blk_pc_request(rq) ||> rq->cmd_type == REQ_TYPE_ATA_PC) {> - fn = cdrom_do_newpc_cont;> > if (!rq->timeout)> rq->timeout = ATAPI_WAIT_PC;> @@ -1210,7 +1185,7 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,> return ide_stopped;> }> > - return cdrom_start_packet_command(drive, fn);> + return cdrom_start_packet_command(drive);> } +There is no need to move cdrom_start_packet_command() around (especiallysince it goes away in patch #9/8) and not doing so allows to see changesto the function immediately. Fixed in the merged patch version: +From: Borislav Petkov <petkovbb@googlemail.com>Subject: [PATCH 5/8] ide-cd: remove handler wrappers +Remove cdrom_do_newpc_cont and cdrom_start_rw_cont wrappers and passcdrom_transfer_packet_command to ide_execute_command directly. There should be no functionality change resulting from this patch. - -Signed-off-by: Borislav Petkov <petkovbb@gmail.com> -[bart: don't move cdrom_start_packet_command() around, remove newlines] -Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> ---- - drivers/ide/ide-cd.c | 49 +++++++++++-------------------------------------- - 1 file changed, 11 insertions(+), 38 deletions(-) - -Index: b/drivers/ide/ide-cd.c -=================================================================== ---- a/drivers/ide/ide-cd.c -+++ b/drivers/ide/ide-cd.c -@@ -511,6 +511,9 @@ end_request: - return 1; - } - -+static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *); -+static ide_startstop_t cdrom_newpc_intr(ide_drive_t *); -+ - /* - * Set up the device registers for transferring a packet command on DEV, - * expecting to later transfer XFERLEN bytes. HANDLER is the routine -@@ -519,8 +522,7 @@ end_request: - * called when the interrupt from the drive arrives. Otherwise, HANDLER - * will be called immediately after the drive is prepared for the transfer. - */ --static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive, -- ide_handler_t *handler) -+static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive) - { - ide_hwif_t *hwif = drive->hwif; - struct request *rq = hwif->hwgroup->rq; -@@ -544,13 +546,14 @@ static ide_startstop_t cdrom_start_packe - drive->waiting_for_dma = 0; - - /* packet command */ -- ide_execute_command(drive, ATA_CMD_PACKET, handler, -+ ide_execute_command(drive, ATA_CMD_PACKET, -+ cdrom_transfer_packet_command, - ATAPI_WAIT_PC, ide_cd_expiry); - return ide_started; - } else { - ide_execute_pkt_cmd(drive); - -- return (*handler) (drive); -+ return cdrom_transfer_packet_command(drive); - } - } - -@@ -561,11 +564,10 @@ static ide_startstop_t cdrom_start_packe - * there's data ready. - */ - #define ATAPI_MIN_CDB_BYTES 12 --static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive, -- struct request *rq, -- ide_handler_t *handler) -+static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive) - { - ide_hwif_t *hwif = drive->hwif; -+ struct request *rq = hwif->hwgroup->rq; - int cmd_len; - ide_startstop_t startstop; - -@@ -592,7 +594,7 @@ static ide_startstop_t cdrom_transfer_pa - } - - /* arm the interrupt handler */ -- ide_set_handler(drive, handler, rq->timeout, ide_cd_expiry); -+ ide_set_handler(drive, cdrom_newpc_intr, rq->timeout, ide_cd_expiry); - - /* ATAPI commands get padded out to 12 bytes minimum */ - cmd_len = COMMAND_SIZE(rq->cmd[0]); -@@ -680,8 +682,6 @@ static int ide_cd_check_transfer_size(id - return 1; - } - --static ide_startstop_t cdrom_newpc_intr(ide_drive_t *); -- - static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive, - struct request *rq) - { -@@ -724,20 +724,6 @@ static ide_startstop_t ide_cd_prepare_rw - } - - /* -- * Routine to send a read/write packet command to the drive. This is usually -- * called directly from cdrom_start_{read,write}(). However, for drq_interrupt -- * devices, it is called from an interrupt when the drive is ready to accept -- * the command. -- */ --static ide_startstop_t cdrom_start_rw_cont(ide_drive_t *drive) --{ -- struct request *rq = drive->hwif->hwgroup->rq; -- -- /* send the command to the drive and return */ -- return cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr); --} -- --/* - * Fix up a possibly partially-processed request so that we can start it over - * entirely, or even put it back on the request queue. - */ -@@ -1126,13 +1112,6 @@ static ide_startstop_t cdrom_start_rw(id - return ide_started; - } - --static ide_startstop_t cdrom_do_newpc_cont(ide_drive_t *drive) --{ -- struct request *rq = HWGROUP(drive)->rq; -- -- return cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr); --} -- - static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) - { - -@@ -1177,16 +1156,12 @@ static void cdrom_do_block_pc(ide_drive_ - static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, - sector_t block) - { -- ide_handler_t *fn; -- - ide_debug_log(IDE_DBG_RQ, "Call %s, rq->cmd[0]: 0x%x, " - "rq->cmd_type: 0x%x, block: %llu\n", - __func__, rq->cmd[0], rq->cmd_type, - (unsigned long long)block); - - if (blk_fs_request(rq)) { -- fn = cdrom_start_rw_cont; -- - if (cdrom_start_rw(drive, rq) == ide_stopped) - return ide_stopped; - -@@ -1194,8 +1169,6 @@ static ide_startstop_t ide_cd_do_request - return ide_stopped; - } else if (blk_sense_request(rq) || blk_pc_request(rq) || - rq->cmd_type == REQ_TYPE_ATA_PC) { -- fn = cdrom_do_newpc_cont; -- - if (!rq->timeout) - rq->timeout = ATAPI_WAIT_PC; - -@@ -1210,7 +1183,7 @@ static ide_startstop_t ide_cd_do_request - return ide_stopped; - } - -- return cdrom_start_packet_command(drive, fn); -+ return cdrom_start_packet_command(drive); - } - - /* -\0 +Signed-off-by: Borislav Petkov <petkovbb@gmail.com>[bart: don't move cdrom_start_packet_command() around, remove newlines]Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>--- drivers/ide/ide-cd.c | 49 +++++++++++-------------------------------------- 1 file changed, 11 insertions(+), 38 deletions(-) +Index: b/drivers/ide/ide-cd.c===================================================================--- a/drivers/ide/ide-cd.c+++ b/drivers/ide/ide-cd.c@@ -511,6 +511,9 @@ end_request: return 1; } +static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *);+static ide_startstop_t cdrom_newpc_intr(ide_drive_t *);+ /* * Set up the device registers for transferring a packet command on DEV, * expecting to later transfer XFERLEN bytes. HANDLER is the routine@@ -519,8 +522,7 @@ end_request: * called when the interrupt from the drive arrives. Otherwise, HANDLER * will be called immediately after the drive is prepared for the transfer. */-static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,- ide_handler_t *handler)+static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive) { ide_hwif_t *hwif = drive->hwif; struct request *rq = hwif->hwgroup->rq;@@ -544,13 +546,14 @@ static ide_startstop_t cdrom_start_packe drive->waiting_for_dma = 0; /* packet command */- ide_execute_command(drive, ATA_CMD_PACKET, handler,+ ide_execute_command(drive, ATA_CMD_PACKET,+ cdrom_transfer_packet_command, ATAPI_WAIT_PC, ide_cd_expiry); return ide_started; } else { ide_execute_pkt_cmd(drive); - return (*handler) (drive);+ return cdrom_transfer_packet_command(drive); } } @@ -561,11 +564,10 @@ static ide_startstop_t cdrom_start_packe * there's data ready. */ #define ATAPI_MIN_CDB_BYTES 12-static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,- struct request *rq,- ide_handler_t *handler)+static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive) { ide_hwif_t *hwif = drive->hwif;+ struct request *rq = hwif->hwgroup->rq; int cmd_len; ide_startstop_t startstop; @@ -592,7 +594,7 @@ static ide_startstop_t cdrom_transfer_pa } /* arm the interrupt handler */- ide_set_handler(drive, handler, rq->timeout, ide_cd_expiry);+ ide_set_handler(drive, cdrom_newpc_intr, rq->timeout, ide_cd_expiry); /* ATAPI commands get padded out to 12 bytes minimum */ cmd_len = COMMAND_SIZE(rq->cmd[0]);@@ -680,8 +682,6 @@ static int ide_cd_check_transfer_size(id return 1; } -static ide_startstop_t cdrom_newpc_intr(ide_drive_t *);- static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive, struct request *rq) {@@ -724,20 +724,6 @@ static ide_startstop_t ide_cd_prepare_rw } /*- * Routine to send a read/write packet command to the drive. This is usually- * called directly from cdrom_start_{read,write}(). However, for drq_interrupt- * devices, it is called from an interrupt when the drive is ready to accept- * the command.- */-static ide_startstop_t cdrom_start_rw_cont(ide_drive_t *drive)-{- struct request *rq = drive->hwif->hwgroup->rq;-- /* send the command to the drive and return */- return cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr);-}--/* * Fix up a possibly partially-processed request so that we can start it over * entirely, or even put it back on the request queue. */@@ -1126,13 +1112,6 @@ static ide_startstop_t cdrom_start_rw(id return ide_started; } -static ide_startstop_t cdrom_do_newpc_cont(ide_drive_t *drive)-{- struct request *rq = HWGROUP(drive)->rq;-- return cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr);-}- static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) { @@ -1177,16 +1156,12 @@ static void cdrom_do_block_pc(ide_drive_ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, sector_t block) {- ide_handler_t *fn;- ide_debug_log(IDE_DBG_RQ, "Call %s, rq->cmd[0]: 0x%x, " "rq->cmd_type: 0x%x, block: %llu\n", __func__, rq->cmd[0], rq->cmd_type, (unsigned long long)block); if (blk_fs_request(rq)) {- fn = cdrom_start_rw_cont;- if (cdrom_start_rw(drive, rq) == ide_stopped) return ide_stopped; @@ -1194,8 +1169,6 @@ static ide_startstop_t ide_cd_do_request return ide_stopped; } else if (blk_sense_request(rq) || blk_pc_request(rq) || rq->cmd_type == REQ_TYPE_ATA_PC) {- fn = cdrom_do_newpc_cont;- if (!rq->timeout) rq->timeout = ATAPI_WAIT_PC; @@ -1210,7 +1183,7 @@ static ide_startstop_t ide_cd_do_request return ide_stopped; } - return cdrom_start_packet_command(drive, fn);+ return cdrom_start_packet_command(drive); } /*\0ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥ diff --git a/a/content_digest b/N1/content_digest index 8000fc6..a6ae214 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -9,382 +9,12 @@ " Borislav Petkov <petkovbb@gmail.com>\0" "\00:1\0" "b\0" - "On Thursday 18 December 2008, Borislav Petkov wrote:\n" - "> Remove cdrom_do_newpc_cont and cdrom_start_rw_cont wrappers and pass\n" - "> cdrom_transfer_packet_command to ide_execute_command directly.\n" - "> \n" - "> There should be no functionality change resulting from this patch.\n" - "> \n" - "> Signed-off-by: Borislav Petkov <petkovbb@gmail.com>\n" - "> ---\n" - "> drivers/ide/ide-cd.c | 121 ++++++++++++++++++++------------------------------\n" - "> 1 files changed, 48 insertions(+), 73 deletions(-)\n" - "> \n" - "> diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c\n" - "> index 34981f5..f3c7cc3 100644\n" - "> --- a/drivers/ide/ide-cd.c\n" - "> +++ b/drivers/ide/ide-cd.c\n" - "> @@ -511,48 +511,7 @@ end_request:\n" - "> \treturn 1;\n" - "> }\n" - "> \n" - "> -/*\n" - "> - * Set up the device registers for transferring a packet command on DEV,\n" - "> - * expecting to later transfer XFERLEN bytes. HANDLER is the routine\n" - "> - * which actually transfers the command to the drive. If this is a\n" - "> - * drq_interrupt device, this routine will arrange for HANDLER to be\n" - "> - * called when the interrupt from the drive arrives. Otherwise, HANDLER\n" - "> - * will be called immediately after the drive is prepared for the transfer.\n" - "> - */\n" - "> -static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,\n" - "> -\t\t\t\t\t\t ide_handler_t *handler)\n" - "> -{\n" - "> -\tide_hwif_t *hwif = drive->hwif;\n" - "> -\tstruct request *rq = hwif->hwgroup->rq;\n" - "> -\tint xferlen;\n" - "> -\n" - "> -\txferlen = ide_cd_get_xferlen(rq);\n" - "> -\n" - "> -\tide_debug_log(IDE_DBG_PC, \"Call %s, xferlen: %d\\n\", __func__, xferlen);\n" - "> -\n" - "> -\t/* FIXME: for Virtual DMA we must check harder */\n" - "> -\tif (drive->dma)\n" - "> -\t\tdrive->dma = !hwif->dma_ops->dma_setup(drive);\n" - "> -\n" - "> -\t/* set up the controller registers */\n" - "> -\tide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL,\n" - "> -\t\t\t xferlen, drive->dma);\n" - "> -\n" - "> -\tif (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) {\n" - "> -\t\t/* waiting for CDB interrupt, not DMA yet. */\n" - "> -\t\tif (drive->dma)\n" - "> -\t\t\tdrive->waiting_for_dma = 0;\n" - "> -\n" - "> -\t\t/* packet command */\n" - "> -\t\tide_execute_command(drive, ATA_CMD_PACKET, handler,\n" - "> -\t\t\t\t ATAPI_WAIT_PC, ide_cd_expiry);\n" - "> -\t\treturn ide_started;\n" - "> -\t} else {\n" - "> -\t\tide_execute_pkt_cmd(drive);\n" - "> -\n" - "> -\t\treturn (*handler) (drive);\n" - "> -\t}\n" - "> -}\n" - "> +static ide_startstop_t cdrom_newpc_intr(ide_drive_t *);\n" - "> \n" - "> /*\n" - "> * Send a packet command to DRIVE described by CMD_BUF and CMD_LEN. The device\n" - "> @@ -561,11 +520,10 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,\n" - "> * there's data ready.\n" - "> */\n" - "> #define ATAPI_MIN_CDB_BYTES 12\n" - "> -static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,\n" - "> -\t\t\t\t\t struct request *rq,\n" - "> -\t\t\t\t\t ide_handler_t *handler)\n" - "> +static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive)\n" - "> {\n" - "> \tide_hwif_t *hwif = drive->hwif;\n" - "> +\tstruct request *rq = hwif->hwgroup->rq;\n" - "> \tint cmd_len;\n" - "> \tide_startstop_t startstop;\n" - "> \n" - "> @@ -592,7 +550,7 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,\n" - "> \t}\n" - "> \n" - "> \t/* arm the interrupt handler */\n" - "> -\tide_set_handler(drive, handler, rq->timeout, ide_cd_expiry);\n" - "> +\tide_set_handler(drive, cdrom_newpc_intr, rq->timeout, ide_cd_expiry);\n" - "> \n" - "> \t/* ATAPI commands get padded out to 12 bytes minimum */\n" - "> \tcmd_len = COMMAND_SIZE(rq->cmd[0]);\n" - "> @@ -610,6 +568,49 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,\n" - "> }\n" - "> \n" - "> /*\n" - "> + * Set up the device registers for transferring a packet command on DEV,\n" - "> + * expecting to later transfer XFERLEN bytes. HANDLER is the routine\n" - "> + * which actually transfers the command to the drive. If this is a\n" - "> + * drq_interrupt device, this routine will arrange for HANDLER to be\n" - "> + * called when the interrupt from the drive arrives. Otherwise, HANDLER\n" - "> + * will be called immediately after the drive is prepared for the transfer.\n" - "> + */\n" - "> +static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive)\n" - "> +{\n" - "> +\tide_hwif_t *hwif = drive->hwif;\n" - "> +\tstruct request *rq = hwif->hwgroup->rq;\n" - "> +\tint xferlen;\n" - "> +\n" - "> +\txferlen = ide_cd_get_xferlen(rq);\n" - "> +\n" - "> +\tide_debug_log(IDE_DBG_PC, \"Call %s, xferlen: %d\\n\", __func__, xferlen);\n" - "> +\n" - "> +\t/* FIXME: for Virtual DMA we must check harder */\n" - "> +\tif (drive->dma)\n" - "> +\t\tdrive->dma = !hwif->dma_ops->dma_setup(drive);\n" - "> +\n" - "> +\t/* set up the controller registers */\n" - "> +\tide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL,\n" - "> +\t\t\t xferlen, drive->dma);\n" - "> +\n" - "> +\tif (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) {\n" - "> +\t\t/* waiting for CDB interrupt, not DMA yet. */\n" - "> +\t\tif (drive->dma)\n" - "> +\t\t\tdrive->waiting_for_dma = 0;\n" - "> +\n" - "> +\t\t/* packet command */\n" - "> +\t\tide_execute_command(drive, ATA_CMD_PACKET,\n" - "> +\t\t\t\t cdrom_transfer_packet_command,\n" - "> +\t\t\t\t ATAPI_WAIT_PC, ide_cd_expiry);\n" - "> +\t\treturn ide_started;\n" - "> +\t} else {\n" - "> +\t\tide_execute_pkt_cmd(drive);\n" - "> +\n" - "> +\t\treturn cdrom_transfer_packet_command(drive);\n" - "> +\t}\n" - "> +}\n" - "> +\n" - "> +/*\n" - "> * Check the contents of the interrupt reason register from the cdrom\n" - "> * and attempt to recover if there are problems. Returns 0 if everything's\n" - "> * ok; nonzero if the request has been terminated.\n" - "> @@ -680,8 +681,6 @@ static int ide_cd_check_transfer_size(ide_drive_t *drive, int len)\n" - "> \treturn 1;\n" - "> }\n" - "> \n" - "> -static ide_startstop_t cdrom_newpc_intr(ide_drive_t *);\n" - "> -\n" - "> static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive,\n" - "> \t\t\t\t\t\t struct request *rq)\n" - "> {\n" - "> @@ -724,20 +723,6 @@ static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive,\n" - "> }\n" - "> \n" - "> /*\n" - "> - * Routine to send a read/write packet command to the drive. This is usually\n" - "> - * called directly from cdrom_start_{read,write}(). However, for drq_interrupt\n" - "> - * devices, it is called from an interrupt when the drive is ready to accept\n" - "> - * the command.\n" - "> - */\n" - "> -static ide_startstop_t cdrom_start_rw_cont(ide_drive_t *drive)\n" - "> -{\n" - "> -\tstruct request *rq = drive->hwif->hwgroup->rq;\n" - "> -\n" - "> -\t/* send the command to the drive and return */\n" - "> -\treturn cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr);\n" - "> -}\n" - "> -\n" - "> -/*\n" - "> * Fix up a possibly partially-processed request so that we can start it over\n" - "> * entirely, or even put it back on the request queue.\n" - "> */\n" - "> @@ -1126,13 +1111,6 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq)\n" - "> \treturn ide_started;\n" - "> }\n" - "> \n" - "> -static ide_startstop_t cdrom_do_newpc_cont(ide_drive_t *drive)\n" - "> -{\n" - "> -\tstruct request *rq = HWGROUP(drive)->rq;\n" - "> -\n" - "> -\treturn cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr);\n" - "> -}\n" - "> -\n" - "> static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)\n" - "> {\n" - "> \n" - "> @@ -1177,7 +1155,6 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)\n" - "> static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,\n" - "> \t\t\t\t\tsector_t block)\n" - "> {\n" - "> -\tide_handler_t *fn;\n" - "> \n" - "> \tide_debug_log(IDE_DBG_RQ, \"Call %s, rq->cmd[0]: 0x%x, \"\n" - "> \t\t \"rq->cmd_type: 0x%x, block: %llu\\n\",\n" - "> @@ -1185,7 +1162,6 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,\n" - "> \t\t (unsigned long long)block);\n" - "> \n" - "> \tif (blk_fs_request(rq)) {\n" - "> -\t\tfn = cdrom_start_rw_cont;\n" - "> \n" - "> \t\tif (cdrom_start_rw(drive, rq) == ide_stopped)\n" - "> \t\t\treturn ide_stopped;\n" - "> @@ -1194,7 +1170,6 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,\n" - "> \t\t\treturn ide_stopped;\n" - "> \t} else if (blk_sense_request(rq) || blk_pc_request(rq) ||\n" - "> \t\t rq->cmd_type == REQ_TYPE_ATA_PC) {\n" - "> -\t\tfn = cdrom_do_newpc_cont;\n" - "> \n" - "> \t\tif (!rq->timeout)\n" - "> \t\t\trq->timeout = ATAPI_WAIT_PC;\n" - "> @@ -1210,7 +1185,7 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,\n" - "> \t\treturn ide_stopped;\n" - "> \t}\n" - "> \n" - "> -\treturn cdrom_start_packet_command(drive, fn);\n" - "> +\treturn cdrom_start_packet_command(drive);\n" - "> }\n" - "\n" - "There is no need to move cdrom_start_packet_command() around (especially\n" - "since it goes away in patch #9/8) and not doing so allows to see changes\n" - "to the function immediately. Fixed in the merged patch version:\n" - "\n" - "From: Borislav Petkov <petkovbb@googlemail.com>\n" - "Subject: [PATCH 5/8] ide-cd: remove handler wrappers\n" - "\n" - "Remove cdrom_do_newpc_cont and cdrom_start_rw_cont wrappers and pass\n" - "cdrom_transfer_packet_command to ide_execute_command directly.\n" - "\n" + "On Thursday 18 December 2008, Borislav Petkov wrote:> Remove cdrom_do_newpc_cont and cdrom_start_rw_cont wrappers and pass> cdrom_transfer_packet_command to ide_execute_command directly.> > There should be no functionality change resulting from this patch.> > Signed-off-by: Borislav Petkov <petkovbb@gmail.com>> ---> drivers/ide/ide-cd.c | 121 ++++++++++++++++++++------------------------------> 1 files changed, 48 insertions(+), 73 deletions(-)> > diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c> index 34981f5..f3c7cc3 100644> --- a/drivers/ide/ide-cd.c> +++ b/drivers/ide/ide-cd.c> @@ -511,48 +511,7 @@ end_request:> \treturn 1;> }> > -/*> - * Set up the device registers for transferring a packet command on DEV,> - * expecting to later transfer XFERLEN bytes. HANDLER is the routine> - * which actually transfers the command to the drive. If this is a> - * drq_interrupt device, this routine will arrange for HANDLER to be> - * called when the interrupt from the drive arrives. Otherwise, HANDLER> - * will be called immediately after the drive is prepared for the transfer.> - */> -static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,> -\t\t\t\t\t\t ide_handler_t *handler)> -{> -\tide_hwif_t *hwif = drive->hwif;> -\tstruct request *rq = hwif->hwgroup->rq;> -\tint xferlen;> -> -\txferlen = ide_cd_get_xferlen(rq);> -> -\tide_debug_log(IDE_DBG_PC, \"Call %s, xferlen: %d\\n\", __func__, xferlen);> -> -\t/* FIXME: for Virtual DMA we must check harder */> -\tif (drive->dma)> -\t\tdrive->dma = !hwif->dma_ops->dma_setup(drive);> -> -\t/* set up the controller registers */> -\tide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL,> -\t\t\t xferlen, drive->dma);> -> -\tif (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) {> -\t\t/* waiting for CDB interrupt, not DMA yet. */> -\t\tif (drive->dma)> -\t\t\tdrive->waiting_for_dma = 0;> -> -\t\t/* packet command */> -\t\tide_execute_command(drive, ATA_CMD_PACKET, handler,> -\t\t\t\t ATAPI_WAIT_PC, ide_cd_expiry);> -\t\treturn ide_started;> -\t} else {> -\t\tide_execute_pkt_cmd(drive);> -> -\t\treturn (*handler) (drive);> -\t}> -}> +static ide_startstop_t cdrom_newpc_intr(ide_drive_t *);> > /*> * Send a packet command to DRIVE described by CMD_BUF and CMD_LEN. The device> @@ -561,11 +520,10 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,> * there's data ready.> */> #define ATAPI_MIN_CDB_BYTES 12> -static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,> -\t\t\t\t\t struct request *rq,> -\t\t\t\t\t ide_handler_t *handler)> +static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive)> {> \tide_hwif_t *hwif = drive->hwif;> +\tstruct request *rq = hwif->hwgroup->rq;> \tint cmd_len;> \tide_startstop_t startstop;> > @@ -592,7 +550,7 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,> \t}> > \t/* arm the interrupt handler */> -\tide_set_handler(drive, handler, rq->timeout, ide_cd_expiry);> +\tide_set_handler(drive, cdrom_newpc_intr, rq->timeout, ide_cd_expiry);> > \t/* ATAPI commands get padded out to 12 bytes minimum */> \tcmd_len = COMMAND_SIZE(rq->cmd[0]);> @@ -610,6 +568,49 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,> }> > /*> + * Set up the device registers for transferring a packet command on DEV,> + * expecting to later transfer XFERLEN bytes. HANDLER is the routine> + * which actually transfers the command to the drive. If this is a> + * drq_interrupt device, this routine will arrange for HANDLER to be> + * called when the interrupt from the drive arrives. Otherwise, HANDLER> + * will be called immediately after the drive is prepared for the transfer.> + */> +static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive)> +{> +\tide_hwif_t *hwif = drive->hwif;> +\tstruct request *rq = hwif->hwgroup->rq;> +\tint xferlen;> +> +\txferlen = ide_cd_get_xferlen(rq);> +> +\tide_debug_log(IDE_DBG_PC, \"Call %s, xferlen: %d\\n\", __func__, xferlen);> +> +\t/* FIXME: for Virtual DMA we must check harder */> +\tif (drive->dma)> +\t\tdrive->dma = !hwif->dma_ops->dma_setup(drive);> +> +\t/* set up the controller registers */> +\tide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL,> +\t\t\t xferlen, drive->dma);> +> +\tif (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) {> +\t\t/* waiting for CDB interrupt, not DMA yet. */> +\t\tif (drive->dma)> +\t\t\tdrive->waiting_for_dma = 0;> +> +\t\t/* packet command */> +\t\tide_execute_command(drive, ATA_CMD_PACKET,> +\t\t\t\t cdrom_transfer_packet_command,> +\t\t\t\t ATAPI_WAIT_PC, ide_cd_expiry);> +\t\treturn ide_started;> +\t} else {> +\t\tide_execute_pkt_cmd(drive);> +> +\t\treturn cdrom_transfer_packet_command(drive);> +\t}> +}> +> +/*> * Check the contents of the interrupt reason register from the cdrom> * and attempt to recover if there are problems. Returns 0 if everything's> * ok; nonzero if the request has been terminated.> @@ -680,8 +681,6 @@ static int ide_cd_check_transfer_size(ide_drive_t *drive, int len)> \treturn 1;> }> > -static ide_startstop_t cdrom_newpc_intr(ide_drive_t *);> -> static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive,> \t\t\t\t\t\t struct request *rq)> {> @@ -724,20 +723,6 @@ static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive,> }> > /*> - * Routine to send a read/write packet command to the drive. This is usually> - * called directly from cdrom_start_{read,write}(). However, for drq_interrupt> - * devices, it is called from an interrupt when the drive is ready to accept> - * the command.> - */> -static ide_startstop_t cdrom_start_rw_cont(ide_drive_t *drive)> -{> -\tstruct request *rq = drive->hwif->hwgroup->rq;> -> -\t/* send the command to the drive and return */> -\treturn cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr);> -}> -> -/*> * Fix up a possibly partially-processed request so that we can start it over> * entirely, or even put it back on the request queue.> */> @@ -1126,13 +1111,6 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq)> \treturn ide_started;> }> > -static ide_startstop_t cdrom_do_newpc_cont(ide_drive_t *drive)> -{> -\tstruct request *rq = HWGROUP(drive)->rq;> -> -\treturn cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr);> -}> -> static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)> {> > @@ -1177,7 +1155,6 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)> static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,> \t\t\t\t\tsector_t block)> {> -\tide_handler_t *fn;> > \tide_debug_log(IDE_DBG_RQ, \"Call %s, rq->cmd[0]: 0x%x, \"> \t\t \"rq->cmd_type: 0x%x, block: %llu\\n\",> @@ -1185,7 +1162,6 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,> \t\t (unsigned long long)block);> > \tif (blk_fs_request(rq)) {> -\t\tfn = cdrom_start_rw_cont;> > \t\tif (cdrom_start_rw(drive, rq) == ide_stopped)> \t\t\treturn ide_stopped;> @@ -1194,7 +1170,6 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,> \t\t\treturn ide_stopped;> \t} else if (blk_sense_request(rq) || blk_pc_request(rq) ||> \t\t rq->cmd_type == REQ_TYPE_ATA_PC) {> -\t\tfn = cdrom_do_newpc_cont;> > \t\tif (!rq->timeout)> \t\t\trq->timeout = ATAPI_WAIT_PC;> @@ -1210,7 +1185,7 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,> \t\treturn ide_stopped;> \t}> > -\treturn cdrom_start_packet_command(drive, fn);> +\treturn cdrom_start_packet_command(drive);> }\n" + "There is no need to move cdrom_start_packet_command() around (especiallysince it goes away in patch #9/8) and not doing so allows to see changesto the function immediately. Fixed in the merged patch version:\n" + "From: Borislav Petkov <petkovbb@googlemail.com>Subject: [PATCH 5/8] ide-cd: remove handler wrappers\n" + "Remove cdrom_do_newpc_cont and cdrom_start_rw_cont wrappers and passcdrom_transfer_packet_command to ide_execute_command directly.\n" "There should be no functionality change resulting from this patch.\n" - "\n" - "Signed-off-by: Borislav Petkov <petkovbb@gmail.com>\n" - "[bart: don't move cdrom_start_packet_command() around, remove newlines]\n" - "Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>\n" - "---\n" - " drivers/ide/ide-cd.c | 49 +++++++++++--------------------------------------\n" - " 1 file changed, 11 insertions(+), 38 deletions(-)\n" - "\n" - "Index: b/drivers/ide/ide-cd.c\n" - "===================================================================\n" - "--- a/drivers/ide/ide-cd.c\n" - "+++ b/drivers/ide/ide-cd.c\n" - "@@ -511,6 +511,9 @@ end_request:\n" - " \treturn 1;\n" - " }\n" - " \n" - "+static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *);\n" - "+static ide_startstop_t cdrom_newpc_intr(ide_drive_t *);\n" - "+\n" - " /*\n" - " * Set up the device registers for transferring a packet command on DEV,\n" - " * expecting to later transfer XFERLEN bytes. HANDLER is the routine\n" - "@@ -519,8 +522,7 @@ end_request:\n" - " * called when the interrupt from the drive arrives. Otherwise, HANDLER\n" - " * will be called immediately after the drive is prepared for the transfer.\n" - " */\n" - "-static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,\n" - "-\t\t\t\t\t\t ide_handler_t *handler)\n" - "+static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive)\n" - " {\n" - " \tide_hwif_t *hwif = drive->hwif;\n" - " \tstruct request *rq = hwif->hwgroup->rq;\n" - "@@ -544,13 +546,14 @@ static ide_startstop_t cdrom_start_packe\n" - " \t\t\tdrive->waiting_for_dma = 0;\n" - " \n" - " \t\t/* packet command */\n" - "-\t\tide_execute_command(drive, ATA_CMD_PACKET, handler,\n" - "+\t\tide_execute_command(drive, ATA_CMD_PACKET,\n" - "+\t\t\t\t cdrom_transfer_packet_command,\n" - " \t\t\t\t ATAPI_WAIT_PC, ide_cd_expiry);\n" - " \t\treturn ide_started;\n" - " \t} else {\n" - " \t\tide_execute_pkt_cmd(drive);\n" - " \n" - "-\t\treturn (*handler) (drive);\n" - "+\t\treturn cdrom_transfer_packet_command(drive);\n" - " \t}\n" - " }\n" - " \n" - "@@ -561,11 +564,10 @@ static ide_startstop_t cdrom_start_packe\n" - " * there's data ready.\n" - " */\n" - " #define ATAPI_MIN_CDB_BYTES 12\n" - "-static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,\n" - "-\t\t\t\t\t struct request *rq,\n" - "-\t\t\t\t\t ide_handler_t *handler)\n" - "+static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive)\n" - " {\n" - " \tide_hwif_t *hwif = drive->hwif;\n" - "+\tstruct request *rq = hwif->hwgroup->rq;\n" - " \tint cmd_len;\n" - " \tide_startstop_t startstop;\n" - " \n" - "@@ -592,7 +594,7 @@ static ide_startstop_t cdrom_transfer_pa\n" - " \t}\n" - " \n" - " \t/* arm the interrupt handler */\n" - "-\tide_set_handler(drive, handler, rq->timeout, ide_cd_expiry);\n" - "+\tide_set_handler(drive, cdrom_newpc_intr, rq->timeout, ide_cd_expiry);\n" - " \n" - " \t/* ATAPI commands get padded out to 12 bytes minimum */\n" - " \tcmd_len = COMMAND_SIZE(rq->cmd[0]);\n" - "@@ -680,8 +682,6 @@ static int ide_cd_check_transfer_size(id\n" - " \treturn 1;\n" - " }\n" - " \n" - "-static ide_startstop_t cdrom_newpc_intr(ide_drive_t *);\n" - "-\n" - " static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive,\n" - " \t\t\t\t\t\t struct request *rq)\n" - " {\n" - "@@ -724,20 +724,6 @@ static ide_startstop_t ide_cd_prepare_rw\n" - " }\n" - " \n" - " /*\n" - "- * Routine to send a read/write packet command to the drive. This is usually\n" - "- * called directly from cdrom_start_{read,write}(). However, for drq_interrupt\n" - "- * devices, it is called from an interrupt when the drive is ready to accept\n" - "- * the command.\n" - "- */\n" - "-static ide_startstop_t cdrom_start_rw_cont(ide_drive_t *drive)\n" - "-{\n" - "-\tstruct request *rq = drive->hwif->hwgroup->rq;\n" - "-\n" - "-\t/* send the command to the drive and return */\n" - "-\treturn cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr);\n" - "-}\n" - "-\n" - "-/*\n" - " * Fix up a possibly partially-processed request so that we can start it over\n" - " * entirely, or even put it back on the request queue.\n" - " */\n" - "@@ -1126,13 +1112,6 @@ static ide_startstop_t cdrom_start_rw(id\n" - " \treturn ide_started;\n" - " }\n" - " \n" - "-static ide_startstop_t cdrom_do_newpc_cont(ide_drive_t *drive)\n" - "-{\n" - "-\tstruct request *rq = HWGROUP(drive)->rq;\n" - "-\n" - "-\treturn cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr);\n" - "-}\n" - "-\n" - " static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)\n" - " {\n" - " \n" - "@@ -1177,16 +1156,12 @@ static void cdrom_do_block_pc(ide_drive_\n" - " static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,\n" - " \t\t\t\t\tsector_t block)\n" - " {\n" - "-\tide_handler_t *fn;\n" - "-\n" - " \tide_debug_log(IDE_DBG_RQ, \"Call %s, rq->cmd[0]: 0x%x, \"\n" - " \t\t \"rq->cmd_type: 0x%x, block: %llu\\n\",\n" - " \t\t __func__, rq->cmd[0], rq->cmd_type,\n" - " \t\t (unsigned long long)block);\n" - " \n" - " \tif (blk_fs_request(rq)) {\n" - "-\t\tfn = cdrom_start_rw_cont;\n" - "-\n" - " \t\tif (cdrom_start_rw(drive, rq) == ide_stopped)\n" - " \t\t\treturn ide_stopped;\n" - " \n" - "@@ -1194,8 +1169,6 @@ static ide_startstop_t ide_cd_do_request\n" - " \t\t\treturn ide_stopped;\n" - " \t} else if (blk_sense_request(rq) || blk_pc_request(rq) ||\n" - " \t\t rq->cmd_type == REQ_TYPE_ATA_PC) {\n" - "-\t\tfn = cdrom_do_newpc_cont;\n" - "-\n" - " \t\tif (!rq->timeout)\n" - " \t\t\trq->timeout = ATAPI_WAIT_PC;\n" - " \n" - "@@ -1210,7 +1183,7 @@ static ide_startstop_t ide_cd_do_request\n" - " \t\treturn ide_stopped;\n" - " \t}\n" - " \n" - "-\treturn cdrom_start_packet_command(drive, fn);\n" - "+\treturn cdrom_start_packet_command(drive);\n" - " }\n" - " \n" - " /*\n" - "\0" + "Signed-off-by: Borislav Petkov <petkovbb@gmail.com>[bart: don't move cdrom_start_packet_command() around, remove newlines]Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>--- drivers/ide/ide-cd.c | 49 +++++++++++-------------------------------------- 1 file changed, 11 insertions(+), 38 deletions(-)\n" + "Index: b/drivers/ide/ide-cd.c===================================================================--- a/drivers/ide/ide-cd.c+++ b/drivers/ide/ide-cd.c@@ -511,6 +511,9 @@ end_request: \treturn 1; } +static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *);+static ide_startstop_t cdrom_newpc_intr(ide_drive_t *);+ /* * Set up the device registers for transferring a packet command on DEV, * expecting to later transfer XFERLEN bytes. HANDLER is the routine@@ -519,8 +522,7 @@ end_request: * called when the interrupt from the drive arrives. Otherwise, HANDLER * will be called immediately after the drive is prepared for the transfer. */-static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,-\t\t\t\t\t\t ide_handler_t *handler)+static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive) { \tide_hwif_t *hwif = drive->hwif; \tstruct request *rq = hwif->hwgroup->rq;@@ -544,13 +546,14 @@ static ide_startstop_t cdrom_start_packe \t\t\tdrive->waiting_for_dma = 0; \t\t/* packet command */-\t\tide_execute_command(drive, ATA_CMD_PACKET, handler,+\t\tide_execute_command(drive, ATA_CMD_PACKET,+\t\t\t\t cdrom_transfer_packet_command, \t\t\t\t ATAPI_WAIT_PC, ide_cd_expiry); \t\treturn ide_started; \t} else { \t\tide_execute_pkt_cmd(drive); -\t\treturn (*handler) (drive);+\t\treturn cdrom_transfer_packet_command(drive); \t} } @@ -561,11 +564,10 @@ static ide_startstop_t cdrom_start_packe * there's data ready. */ #define ATAPI_MIN_CDB_BYTES 12-static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,-\t\t\t\t\t struct request *rq,-\t\t\t\t\t ide_handler_t *handler)+static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive) { \tide_hwif_t *hwif = drive->hwif;+\tstruct request *rq = hwif->hwgroup->rq; \tint cmd_len; \tide_startstop_t startstop; @@ -592,7 +594,7 @@ static ide_startstop_t cdrom_transfer_pa \t} \t/* arm the interrupt handler */-\tide_set_handler(drive, handler, rq->timeout, ide_cd_expiry);+\tide_set_handler(drive, cdrom_newpc_intr, rq->timeout, ide_cd_expiry); \t/* ATAPI commands get padded out to 12 bytes minimum */ \tcmd_len = COMMAND_SIZE(rq->cmd[0]);@@ -680,8 +682,6 @@ static int ide_cd_check_transfer_size(id \treturn 1; } -static ide_startstop_t cdrom_newpc_intr(ide_drive_t *);- static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive, \t\t\t\t\t\t struct request *rq) {@@ -724,20 +724,6 @@ static ide_startstop_t ide_cd_prepare_rw } /*- * Routine to send a read/write packet command to the drive. This is usually- * called directly from cdrom_start_{read,write}(). However, for drq_interrupt- * devices, it is called from an interrupt when the drive is ready to accept- * the command.- */-static ide_startstop_t cdrom_start_rw_cont(ide_drive_t *drive)-{-\tstruct request *rq = drive->hwif->hwgroup->rq;--\t/* send the command to the drive and return */-\treturn cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr);-}--/* * Fix up a possibly partially-processed request so that we can start it over * entirely, or even put it back on the request queue. */@@ -1126,13 +1112,6 @@ static ide_startstop_t cdrom_start_rw(id \treturn ide_started; } -static ide_startstop_t cdrom_do_newpc_cont(ide_drive_t *drive)-{-\tstruct request *rq = HWGROUP(drive)->rq;--\treturn cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr);-}- static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) { @@ -1177,16 +1156,12 @@ static void cdrom_do_block_pc(ide_drive_ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, \t\t\t\t\tsector_t block) {-\tide_handler_t *fn;- \tide_debug_log(IDE_DBG_RQ, \"Call %s, rq->cmd[0]: 0x%x, \" \t\t \"rq->cmd_type: 0x%x, block: %llu\\n\", \t\t __func__, rq->cmd[0], rq->cmd_type, \t\t (unsigned long long)block); \tif (blk_fs_request(rq)) {-\t\tfn = cdrom_start_rw_cont;- \t\tif (cdrom_start_rw(drive, rq) == ide_stopped) \t\t\treturn ide_stopped; @@ -1194,8 +1169,6 @@ static ide_startstop_t ide_cd_do_request \t\t\treturn ide_stopped; \t} else if (blk_sense_request(rq) || blk_pc_request(rq) || \t\t rq->cmd_type == REQ_TYPE_ATA_PC) {-\t\tfn = cdrom_do_newpc_cont;- \t\tif (!rq->timeout) \t\t\trq->timeout = ATAPI_WAIT_PC; @@ -1210,7 +1183,7 @@ static ide_startstop_t ide_cd_do_request \t\treturn ide_stopped; \t} -\treturn cdrom_start_packet_command(drive, fn);+\treturn cdrom_start_packet_command(drive); } /*\0\303\277\303\264\303\250\302\272{.n\303\207+\302\211\302\267\302\237\302\256\302\211\302\255\302\206+%\302\212\303\213\303\277\302\261\303\251\303\235\302\266\027\302\245\302\212w\303\277\302\272{.n\303\207+\302\211\302\267\302\245\302\212{\302\261\303\276G\302\253\302\235\303\251\303\277\302\212{ay\302\272\035\303\212\302\207\303\232\302\231\303\253,j\a\302\255\302\242f\302\243\302\242\302\267h\302\232\302\217\303\257\302\201\303\252\303\277\302\221\303\252\303\247z_\303\250\302\256\003(\302\255\303\251\302\232\302\216\302\212\303\235\302\242j\"\302\235\303\272\032\302\266\033m\302\247\303\277\303\277\302\276\a\302\253\303\276G\302\253\302\235\303\251\303\277\302\242\302\270?\302\231\302\250\303\250\302\255\303\232&\302\243\303\270\302\247~\302\217\303\241\302\266iO\302\225\303\246\302\254z\302\267\302\232v\303\230^\024\004\032\302\266\033m\302\247\303\277\303\277\303\203\f\303\277\302\266\303\254\303\277\302\242\302\270?\302\226I\302\245" -8deb828f1bf45c7da6933b370d2cfc30896fe6caa98b944ea63cbe50e4df7971 +27c77316d8e6ed70bec2dfb7a2939a014dd71742b31025a13444a4f20752c7be
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.