linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: petkovbb@gmail.com, linux-ide@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/6] ide: remove ide_execute_pkt_cmd()
Date: Wed, 11 Feb 2009 17:37:07 +0100	[thread overview]
Message-ID: <200902111737.07551.bzolnier@gmail.com> (raw)
In-Reply-To: <4992D77F.3090802@ru.mvista.com>

On Wednesday 11 February 2009, Sergei Shtylyov wrote:
> Hello.
> 
> Borislav Petkov wrote:
> 
> >>>> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> >>>> Subject: [PATCH] ide: remove ide_execute_pkt_cmd()
> >>>>
> >>>> * Pass command structure to ide_execute_command() and skip
> >>>>  __ide_set_handler() for ATAPI protocols.
> >>>>
> >>>> * Convert ide_issue_pc() to always use ide_execute_command()
> >>>>  and remove no longer needed ide_execute_pkt_cmd().
> >>>>
> >>>> There should be no functional changes caused by this patch.
> >>>>
> >>>> Cc: Borislav Petkov <petkovbb@gmail.com>
> >>>> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> >>>> ---
> >>>>  drivers/ide/ide-atapi.c    |   15 +++++++--------
> >>>>  drivers/ide/ide-iops.c     |   23 ++++++-----------------
> >>>>  drivers/ide/ide-taskfile.c |    6 ++----
> >>>>  include/linux/ide.h        |    5 ++---
> >>>>  4 files changed, 17 insertions(+), 32 deletions(-)
> >>>>
> >>>> Index: b/drivers/ide/ide-atapi.c
> >>>> ===================================================================
> >>>> --- a/drivers/ide/ide-atapi.c
> >>>> +++ b/drivers/ide/ide-atapi.c
> >>>> @@ -481,6 +481,7 @@ static void ide_init_packet_cmd(struct i
> >>>>        cmd->protocol  = dma ? ATAPI_PROT_DMA : ATAPI_PROT_PIO;
> >>>>        cmd->tf_flags |= IDE_TFLAG_OUT_LBAH | IDE_TFLAG_OUT_LBAM |
> >>>>                         IDE_TFLAG_OUT_FEATURE | tf_flags;
> >>>> +       cmd->tf.command = ATA_CMD_PACKET;
> >>>>        cmd->tf.feature = dma;          /* Use PIO/DMA */
> >>>>        cmd->tf.lbam    = bcount & 0xff;
> >>>>        cmd->tf.lbah    = (bcount >> 8) & 0xff;
> >>>> @@ -626,6 +627,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t
> >>>>        unsigned int timeout;
> >>>>        u32 tf_flags;
> >>>>        u16 bcount;
> >>>> +       u8 drq_int = !!(drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT);
> >>>>
> >>>>         
> >>> How about we finally add those check macros in block layer fashion like
> >>> blk_pc_request et al and do
> >>>
> >>> #define drv_can_drq_interrupt(drive)    ((drive)->atapi_flags &
> >>> IDE_AFLAG_DRQ_INTERRUPT)
> >>>
> >>>       
> >>  I suppose it's for the devices that interrupt on packet DRQ? Then it's
> >> hardly a good name because it's not like this is some optional capability.
> >>     
> >
> > No, I was alluding to the command packet DRQ type used by the device as it is
> > put in SFF8020i, 7.1.7.1 General Configuration Word.
> >   
> 
>    I was talking about exactly the same feature. :-)
> 
> >>> or similar instead of wasting stack space?
> >>>       
> >>  It doesn't necessarily waste stack space. Haven't you heard about compiler
> >> putting local vairables into registers?
> >>     
> >
> > Yes, have you heard of unnecessary register spilling?
> >   
> 
>    No -- only about stack spilling on CPUs "caching" the top of stack in 
> their register file (like SPARC).
>    Linux runs not only on x86 and many RISCs can store several local 
> variables in the dedicated registers -- it's the part of say MIPS ABIs...
> 
> >>> It'll also read better in the if() check:
> >>>
> >>> if (drv_can_irq_interrupt(drive)) { ...
> >>>
> >>>       
> >>  It's faster to checj a local variable than to dereference drv several times
> >> -- unless gcc optimizes that away (by creating an implicit local variable
> >> :-).
> >>     
> >
> > I hope gcc is smart enough to do that.
> >   
> 
>    Then where's the win?

In having shorter & cleaner code:

	ide_dev_drq_int(drive)

vs

	((drive)->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT)

We can of course have both things -- using macros for all checks
but still cache the result when it makes sense.

The idea of having macros for ->dev_flags and ->atapi_flags sounds
fine to me (+ it abstracts the actual ->dev_flags + ->atapi_flags
split allowing easier sanitizations / enhancements later).

Thanks,
Bart

  parent reply	other threads:[~2009-02-11 16:49 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-09 23:19 [PATCH 0/6] ide: more unifications of ATA and ATAPI support Bartlomiej Zolnierkiewicz
2009-02-09 23:19 ` [PATCH 1/6] ide: pass command to ide_map_sg() Bartlomiej Zolnierkiewicz
2009-02-11  6:36   ` Borislav Petkov
2009-02-11 16:28     ` Bartlomiej Zolnierkiewicz
2009-02-09 23:19 ` [PATCH 2/6] ide: use do_rw_taskfile() for ATA_CMD_PACKET commands Bartlomiej Zolnierkiewicz
2009-02-09 23:20 ` [PATCH 3/6] ide: set hwif->expiry prior to calling [__]ide_set_handler() Bartlomiej Zolnierkiewicz
2009-03-16 14:23   ` Sergei Shtylyov
2009-02-09 23:20 ` [PATCH 4/6] ide: add ->dma_expiry method and remove ->dma_exec_cmd one Bartlomiej Zolnierkiewicz
2009-02-10 18:18   ` Sergei Shtylyov
2009-02-11 16:30     ` Bartlomiej Zolnierkiewicz
2009-02-11 17:30       ` Sergei Shtylyov
2009-02-17 14:16         ` Bartlomiej Zolnierkiewicz
2009-02-17 14:29           ` Sergei Shtylyov
2009-02-09 23:20 ` [PATCH 5/6] ide: remove ide_execute_pkt_cmd() Bartlomiej Zolnierkiewicz
2009-02-11  6:55   ` Borislav Petkov
2009-02-11 13:22     ` Sergei Shtylyov
2009-02-11 13:37       ` Borislav Petkov
2009-02-11 13:49         ` Sergei Shtylyov
2009-02-11 16:32           ` Borislav Petkov
2009-02-15 12:24             ` Sergei Shtylyov
2009-02-15 17:39               ` Borislav Petkov
2009-02-15 23:18                 ` Sergei Shtylyov
2009-02-16  8:56                   ` Borislav Petkov
2009-02-11 16:37           ` Bartlomiej Zolnierkiewicz [this message]
2009-02-09 23:20 ` [PATCH 6/6] ide: keep track of number of bytes instead of sectors in struct ide_cmd Bartlomiej Zolnierkiewicz
2009-02-11  7:16 ` [PATCH 0/6] ide: more unifications of ATA and ATAPI support Borislav Petkov
2009-02-23 22:51   ` Bartlomiej Zolnierkiewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200902111737.07551.bzolnier@gmail.com \
    --to=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=petkovbb@gmail.com \
    --cc=sshtylyov@ru.mvista.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).