Re: [PATCH 07/22] ide-tape: struct idetape_tape_t: shorten membernames v2
From: Borislav Petkov
Date: Mon Feb 04 2008 - 23:47:30 EST
On Tue, Feb 05, 2008 at 02:23:21AM +0100, Bartlomiej Zolnierkiewicz wrote:
> On Monday 04 February 2008, Borislav Petkov wrote:
> > Shorten some member names not too aggressively since this driver might be gone
> > anyway soon.
> >
> > Signed-off-by: Borislav Petkov <petkovbb@xxxxxxxxx>
> > ---
> > drivers/ide/ide-tape.c | 210 ++++++++++++++++++++++++++----------------------
> > 1 files changed, 113 insertions(+), 97 deletions(-)
> >
> > diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
> > index 126e8a9..0b5ccce 100644
> > --- a/drivers/ide/ide-tape.c
> > +++ b/drivers/ide/ide-tape.c
>
> [...]
>
> > @@ -1583,7 +1579,8 @@ static void idetape_create_read_cmd(idetape_tape_t *tape, idetape_pc_t *pc, unsi
> > pc->bh = bh;
> > atomic_set(&bh->b_count, 0);
> > pc->buffer = NULL;
> > - pc->request_transfer = pc->buffer_size = length * tape->tape_block_size;
> > + pc->buffer_size = length * tape->blk_size;
> > + pc->request_transfer = length * tape->blk_size;
> > if (pc->request_transfer == tape->stage_size)
> > set_bit(PC_DMA_RECOMMENDED, &pc->flags);
> > }
> > @@ -1621,7 +1618,8 @@ static void idetape_create_write_cmd(idetape_tape_t *tape, idetape_pc_t *pc, uns
> > pc->b_data = bh->b_data;
> > pc->b_count = atomic_read(&bh->b_count);
> > pc->buffer = NULL;
> > - pc->request_transfer = pc->buffer_size = length * tape->tape_block_size;
> > + pc->request_transfer = length * tape->blk_size;
> > + pc->buffer_size = length * tape->blk_size;
> > if (pc->request_transfer == tape->stage_size)
> > set_bit(PC_DMA_RECOMMENDED, &pc->flags);
> > }
>
> for some reason gcc doesn't seem to optimize the new code as well as
> the old one (=> driver size goes up instead of staying unchanged)
>
> interdiff between original patch and merged version:
>
> diff -u b/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
> --- b/drivers/ide/ide-tape.c
> +++ b/drivers/ide/ide-tape.c
> @@ -324,7 +324,7 @@
> /* Current character device data transfer direction */
> u8 chrdev_dir;
>
> - /* tape block size, usu. 512 or 1024 bytes */
> + /* tape block size, usually 512 or 1024 bytes */
> unsigned short blk_size;
> int user_bs_factor;
>
> @@ -1580,8 +1580,8 @@
> pc->bh = bh;
> atomic_set(&bh->b_count, 0);
> pc->buffer = NULL;
> - pc->buffer_size = length * tape->blk_size;
> - pc->request_transfer = length * tape->blk_size;
> + pc->buffer_size = length * tape->blk_size;
> + pc->request_transfer = pc->buffer_size;
> if (pc->request_transfer == tape->stage_size)
> set_bit(PC_DMA_RECOMMENDED, &pc->flags);
> }
> @@ -1619,8 +1619,8 @@
> pc->b_data = bh->b_data;
> pc->b_count = atomic_read(&bh->b_count);
> pc->buffer = NULL;
> - pc->request_transfer = length * tape->blk_size;
> - pc->buffer_size = length * tape->blk_size;
> + pc->buffer_size = length * tape->blk_size;
> + pc->request_transfer = pc->buffer_size;
> if (pc->request_transfer == tape->stage_size)
> set_bit(PC_DMA_RECOMMENDED, &pc->flags);
> }
Yeah, i did that only because checkpatch.pl complained that multiple assignments
should be avoided. Now it looks kinda dumb that way besides improving readability
so converting it to the best form w.r.t generating smaller binary would be a reason
good enough to ignore checkpatch.pl in that case.
--
Regards/Gruß,
Boris.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/